ci: add needs: test
to publish
job
#4
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: lint-test-coverage | |
on: [ push, workflow_call ] | |
env: | |
MAX_PYTHON_V: 3.12 | |
EXTRA_DEPS: dev,dev-fastapi,dev-sanic,dev-sqlalchemy | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ env.MAX_PYTHON_V }} | |
cache: 'pip' | |
- name: Install deps | |
run: | | |
python -m pip install -U pip | |
python -m pip install -e .[$EXTRA_DEPS] | |
- name: Lint | |
run: ./scripts/lint.sh | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
py-v: [ "3.10", "3.11", "3.12" ] | |
env: | |
COVERAGE_FILE: .coverage.py-${{ matrix.py-v }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.py-v }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.py-v }} | |
cache: 'pip' | |
- name: Install deps | |
run: | | |
python -m pip install -U pip | |
python -m pip install -e .[$EXTRA_DEPS] | |
- name: Test | |
run: ./scripts/cov.sh | |
- name: Upload coverage | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.COVERAGE_FILE }} | |
path: ${{ env.COVERAGE_FILE }} | |
if-no-files-found: error | |
retention-days: 14 | |
coverage: | |
runs-on: ubuntu-latest | |
needs: test | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ env.MAX_PYTHON_V }} | |
- name: Download coverage | |
uses: actions/download-artifact@v4 | |
with: | |
path: cov | |
pattern: .coverage.py-* | |
merge-multiple: true | |
- name: Merge coverage | |
run: | | |
pip install -U coverage | |
coverage combine --keep ./cov/ | |
coverage xml | |
coverage report | |
- name: Upload coverage-total | |
uses: actions/upload-artifact@v4 | |
with: | |
name: coverage-total | |
path: coverage.xml | |
if-no-files-found: error | |
retention-days: 14 |