Tidy #111
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
name: Test | |
on: | |
pull_request: | |
push: | |
branches: [master] | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
FORCE_COLOR: 2 | |
jobs: | |
test: | |
runs-on: ${{ matrix.os }} | |
timeout-minutes: 40 | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12'] | |
coverage: [false] | |
include: | |
# Modify existing configurations: | |
- os: ubuntu-latest | |
python-version: '3.12' | |
coverage: false | |
tz: 'XXX-05:30' # UTC+05:30 | |
# Add new configurations: | |
- os: ubuntu-latest | |
python-version: '3.12' | |
coverage: true | |
- os: macos-latest | |
python-version: '3.12' | |
coverage: false | |
name: ${{ matrix.os }} py-${{ matrix.python-version }} ${{ matrix.tz }} ${{ matrix.coverage && '(coverage)' || '' }} | |
env: | |
PYTEST_ADDOPTS: -n 5 -m 'slow or not slow' --color=yes | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install | |
run: pip install -e .[all] | |
- name: Style | |
if: ${{ !matrix.coverage }} | |
run: flake8 | |
- name: Bandit | |
if: ${{ !matrix.coverage }} | |
run: bandit -r metomi/isodatetime -c pyproject.toml | |
- name: Run tests | |
env: | |
TZ: ${{ matrix.tz }} | |
PYTEST_ADDOPTS: ${{ matrix.coverage && format('{0} --cov=metomi/isodatetime', env.PYTEST_ADDOPTS) || env.PYTEST_ADDOPTS }} | |
run: pytest | |
- name: Coverage report | |
if: matrix.coverage | |
run: | | |
coverage xml | |
coverage report | |
- name: Upload coverage artifact | |
if: matrix.coverage | |
uses: actions/upload-artifact@v4 | |
with: | |
name: coverage_${{ matrix.os }}_py-${{ matrix.python-version }} | |
path: coverage.xml | |
retention-days: 4 | |
codecov-upload: | |
needs: test | |
runs-on: ubuntu-latest | |
timeout-minutes: 2 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Download coverage artifacts | |
uses: actions/download-artifact@v4 | |
- name: Codecov upload | |
uses: codecov/codecov-action@v3 | |
with: | |
name: ${{ github.workflow }} | |
fail_ci_if_error: true | |
verbose: true | |
# Token not required for public repos, but avoids upload failure due | |
# to rate-limiting (but not for PRs opened from forks) | |
token: ${{ secrets.CODECOV_TOKEN }} |