Apply suggestions to the deployment workflow #219
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
# Builds wheels and libraries used to run tests, uploads them, then runs the standard tests. | |
name: Python Package | |
on: | |
push: | |
branches: | |
- "*" | |
tags: | |
- "*.*.*" | |
pull_request: | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
pre-commit: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.x" | |
- uses: pre-commit/action@v3.0.1 | |
mypy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.x" | |
- name: Install MyPy | |
run: | | |
pip install mypy | |
- name: Install Delocate dependencies. | |
run: | | |
pip install --requirement test-requirements.txt | |
pip install --editable . | |
- name: MyPy | |
uses: liskin/gh-problem-matcher-wrap@v3 | |
with: | |
linters: mypy | |
run: mypy --show-column-numbers delocate/ | |
tests: | |
needs: [pre-commit, mypy] | |
runs-on: macos-12 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- uses: maxim-lobanov/setup-xcode@v1 | |
with: | |
xcode-version: "14.0" | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.x" | |
- name: Build libs and wheels | |
# Use a venv from multibuild for this step. | |
run: | | |
source multibuild/osx_utils.sh | |
get_macpython_environment $MB_PYTHON_VERSION venv | |
make | |
env: | |
MB_PYTHON_VERSION: "3.9" | |
MB_PYTHON_OSX_VER: "10.9" | |
SOURCE_DATE_EPOCH: "0" | |
PYTHONHASHSEED: "0" | |
- name: Upload test data | |
uses: actions/upload-artifact@v4 | |
with: | |
name: delocate-tests-data | |
path: | | |
delocate/tests/data/ | |
retention-days: 3 | |
if-no-files-found: error | |
- name: Install test dependencies | |
run: | | |
pip install -r test-requirements.txt build | |
- name: Build delocate | |
run: | | |
python -m build | |
- name: Install delocate | |
run: | | |
pip install -e . | |
- name: Upload wheel | |
uses: actions/upload-artifact@v4 | |
with: | |
name: delocate-wheel | |
path: dist/delocate-*.whl | |
retention-days: 3 | |
if-no-files-found: error | |
compression-level: 0 | |
- name: Upload sdist | |
uses: actions/upload-artifact@v4 | |
with: | |
name: delocate-sdist | |
path: dist/delocate-*.tar.gz | |
retention-days: 3 | |
if-no-files-found: error | |
compression-level: 0 | |
- name: Upload requirements | |
uses: actions/upload-artifact@v4 | |
with: | |
name: test-requirements | |
path: test-requirements.txt | |
retention-days: 3 | |
if-no-files-found: error | |
- name: Run tests | |
run: | | |
pytest | |
- name: Collect code coverage data | |
run: | | |
coverage xml | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v4 | |
with: | |
fail_ci_if_error: false | |
token: "624762bf-aaf0-4a75-b450-16f5ebece0b1" | |
- name: Check reproducable test data | |
run: | | |
git status | |
git diff | |
isolated_tests: | |
needs: tests | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: true | |
matrix: | |
include: | |
- os: "macos-12" | |
xcode: "14.0" | |
python: "3.x" | |
- os: "macos-13" | |
xcode: "14.2" | |
python: "3.x" | |
- os: "ubuntu-latest" | |
python: "3.7" | |
- os: "ubuntu-latest" | |
python: "3.8" | |
- os: "ubuntu-latest" | |
python: "3.9" | |
- os: "ubuntu-latest" | |
python: "3.10" | |
- os: "ubuntu-latest" | |
python: "3.11" | |
- os: "ubuntu-latest" | |
python: "3.12" | |
- os: "ubuntu-latest" | |
python: "3.13-dev" | |
- os: "windows-latest" | |
python: "3.x" | |
steps: | |
- if: runner.os == 'macOS' | |
uses: maxim-lobanov/setup-xcode@v1 | |
with: | |
xcode-version: ${{ matrix.xcode }} | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python }} | |
- if: runner.os == 'macOS' | |
name: Check otool version | |
run: otool --version | |
- name: Download wheel | |
uses: actions/download-artifact@v4 | |
with: | |
name: delocate-wheel | |
- name: Install delocate | |
run: | | |
pip install delocate-*.whl | |
- name: Download requirements | |
uses: actions/download-artifact@v4 | |
with: | |
name: test-requirements | |
- name: Install test dependencies | |
run: | | |
pip install -r test-requirements.txt | |
- name: Run isolated tests | |
run: | | |
pytest --pyargs delocate --log-level DEBUG --doctest-modules | |
deploy: | |
needs: isolated_tests | |
if: github.ref_type == 'tag' | |
runs-on: ubuntu-latest | |
environment: | |
name: pypi | |
url: https://pypi.org/project/delocate/${{ github.ref_name }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.x" | |
- name: Install deployment dependencies | |
run: pip install twine | |
- name: Download wheel | |
uses: actions/download-artifact@v4 | |
with: | |
name: delocate-wheel | |
path: dist/ | |
- name: Download sdist | |
uses: actions/download-artifact@v4 | |
with: | |
name: delocate-sdist | |
path: dist/ | |
- uses: pypa/gh-action-pypi-publish@release/v1 |