ci: try reusable workflow #496
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
name: CI | |
on: | |
push: | |
branches: [main] | |
pull_request: {} | |
workflow_dispatch: | |
schedule: | |
- cron: "0 0 * * 0" # run once a week | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
check-manifest: | |
name: Check Manifest | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- run: pipx run check-manifest | |
test: | |
name: Test | |
uses: pyapp-kit/workflows/.github/workflows/test-pyrepo.yml@main | |
with: | |
os: ${{ matrix.os }} | |
python-version: ${{ matrix.python-version }} | |
fail-on-coverage-error: false | |
pip-install-pre-release: ${{ github.event_name == 'schedule' }} | |
report-failures: ${{ github.event_name == 'schedule' }} | |
cache-key: 65a8e27d8879283831b664bd8b7f0ad4 # change to reset cache | |
cache-path: tests/data | |
cache-script: "pip install requests && python scripts/download_samples.py" | |
secrets: | |
codecov-token: ${{ secrets.CODECOV_TOKEN }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [macos-latest, windows-latest, "ubuntu-latest"] | |
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] | |
benchmarks: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.11" | |
- uses: actions/cache@v4 | |
id: cache | |
with: | |
path: tests/data | |
key: ${{ hashFiles('scripts/download_samples.py') }} | |
- name: Download Samples | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: | | |
pip install requests | |
python scripts/download_samples.py | |
- name: install | |
run: python -m pip install .[test] | |
- name: Run benchmarks | |
uses: CodSpeedHQ/action@v2 | |
with: | |
run: pytest --codspeed -v --color=yes | |
deploy: | |
needs: test | |
runs-on: ubuntu-latest | |
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v') | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.x" | |
- name: 👷 Build | |
run: | | |
python -m pip install build | |
python -m build | |
- uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
user: __token__ | |
password: ${{ secrets.TWINE_API_KEY }} | |
- uses: softprops/action-gh-release@v1 | |
with: | |
generate_release_notes: true |