bump to 0.11.1 #39
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This workflow will build the package with Pyinstaller, upload it to GitHub Releases, and publish it to PyPI | |
name: Release | |
on: | |
push: | |
tags: | |
- "v*.*.*" | |
jobs: | |
build_and_release: | |
if: ${{ startsWith(github.ref, 'refs/tags/') }} | |
strategy: | |
matrix: | |
python-version: ["3.11"] | |
platform: ["ubuntu-20.04", "macos-latest", "windows-latest"] | |
architecture: ["x64"] | |
include: | |
- architecture: "x86" | |
platform: "windows-latest" | |
python-version: "3.11" | |
runs-on: ${{ matrix.platform }} | |
defaults: | |
run: | |
working-directory: ./main | |
steps: | |
# https://github.com/actions/checkout#Checkout-multiple-repos-side-by-side | |
# pull into mapillary/mapillary_tools/main | |
- uses: actions/checkout@v3 | |
with: | |
path: main | |
# https://github.com/actions/checkout#Checkout-multiple-repos-side-by-side | |
# pull into mapillary/mapillary_tools/exiftool | |
- name: Setup ExifTool | |
uses: actions/checkout@v3 | |
with: | |
repository: "exiftool/exiftool" | |
path: exiftool | |
- name: Check ExifTool version | |
# DO NOT USE envvars here which does not work on Windows (needs prefixing with $env:) | |
# need to rename exiftool to exiftool.pl according to https://exiftool.org/install.html | |
run: | | |
mv ${{ github.workspace }}/exiftool/exiftool ${{ github.workspace }}/exiftool/exiftool.pl | |
perl ${{ github.workspace }}/exiftool/exiftool.pl -ver | |
- name: Setup FFmpeg | |
uses: FedericoCarboni/setup-ffmpeg@v2 | |
- name: Set up ${{ matrix.architecture }} Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
# optional x64 or x86. Defaults to x64 if not specified | |
architecture: ${{ matrix.architecture }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install . | |
python -m pip install -r requirements-dev.txt | |
- name: Validate version | |
run: | | |
EXPECTED_GITHUB_REF=$(mapillary_tools --version | awk '{print "refs/tags/v" $3}') | |
if [[ "$EXPECTED_GITHUB_REF" != "$GITHUB_REF" ]]; then | |
echo "Version mismatch: $EXPECTED_GITHUB_REF != $GITHUB_REF" | |
exit 1 | |
fi | |
if: matrix.platform != 'windows-latest' | |
- name: Build and test with Pyinstaller on MacOS | |
# Enable for Python3.11 only because it often fails at codesign (subprocess timeout) | |
if: matrix.platform == 'macos-latest' | |
run: | | |
# see https://github.com/mapillary/mapillary_tools/issues/566 | |
# TODO: move it to extras in setup.py | |
python3 -m pip install pysocks | |
./script/build_osx | |
# Could run full integration tests with the binary (it might be slow) | |
pytest tests/integration | |
env: | |
MAPILLARY_TOOLS__TESTS_EXECUTABLE: ./dist/osx/mapillary_tools | |
MAPILLARY_TOOLS__TESTS_EXIFTOOL_EXECUTABLE: perl ${{ github.workspace }}/exiftool/exiftool.pl | |
- name: Build and test with Pyinstaller on Ubuntu | |
if: matrix.platform == 'ubuntu-20.04' | |
run: | | |
# see https://github.com/mapillary/mapillary_tools/issues/566 | |
# TODO: move it to extras in setup.py | |
python3 -m pip install pysocks | |
./script/build_linux | |
# Could run full integration tests with the binary (it might be slow) | |
pytest tests/integration | |
env: | |
MAPILLARY_TOOLS__TESTS_EXECUTABLE: ./dist/linux/mapillary_tools | |
MAPILLARY_TOOLS__TESTS_EXIFTOOL_EXECUTABLE: perl ${{ github.workspace }}/exiftool/exiftool.pl | |
- name: Build and test with Pyinstaller on Windows | |
if: matrix.platform == 'windows-latest' | |
run: | | |
# see https://github.com/mapillary/mapillary_tools/issues/566 | |
# TODO: move it to extras in setup.py | |
python3 -m pip install pysocks | |
./script/build_bootloader.ps1 | |
./script/build_win.ps1 | |
# Could run full integration tests with the binary (it might be slow) | |
cp ./dist/win/mapillary_tools.exe mapillary_tools_WINDOWS_VERY_HARD_TO_FIND_YOU_IN_ANOTHER_DIR_SO_I_MOVE_YOU_HERE.exe | |
pytest tests/integration | |
env: | |
MAPILLARY_TOOLS__TESTS_EXECUTABLE: mapillary_tools_WINDOWS_VERY_HARD_TO_FIND_YOU_IN_ANOTHER_DIR_SO_I_MOVE_YOU_HERE.exe | |
MAPILLARY_TOOLS__TESTS_EXIFTOOL_EXECUTABLE: perl ${{ github.workspace }}/exiftool/exiftool.pl | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
draft: true | |
generate_release_notes: true | |
fail_on_unmatched_files: true | |
files: | | |
./main/dist/releases/* | |
pypi-publish: | |
if: ${{ startsWith(github.ref, 'refs/tags/') }} | |
name: Upload release to PyPI | |
needs: ["build_and_release"] | |
runs-on: "ubuntu-20.04" | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.x" | |
# https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/ | |
- name: Install pypa/build | |
run: python3 -m pip install build | |
- name: Build | |
# the default ouput dir dist/ was used by pyinstaller | |
run: python3 -m build --outdir pypa_dist/ . | |
- name: Publish package distributions to TestPyPI | |
uses: pypa/[email protected] | |
with: | |
repository-url: https://test.pypi.org/legacy/ | |
password: ${{ secrets.TEST_PYPI_API_TOKEN }} | |
packages-dir: pypa_dist/ | |
- name: Publish package distributions to PyPI | |
uses: pypa/[email protected] | |
with: | |
password: ${{ secrets.PYPI_API_TOKEN }} | |
packages-dir: pypa_dist/ |