Merge pull request #189 from spacetelescope/dependabot/github_actions… #382
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: | |
pull_request: | |
schedule: | |
# Weekly Tuesday 6AM build | |
# * is a special character in YAML so you have to quote this string | |
- cron: '0 6 * * 2' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
permissions: | |
contents: read | |
env: | |
PYSYN_CDBS: "https://ssb.stsci.edu/trds" | |
jobs: | |
initial_check: | |
name: Mandatory checks before CI | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check base branch | |
uses: actions/github-script@v6 | |
if: github.event_name == 'pull_request' | |
with: | |
script: | | |
const allowed_basebranch = 'master'; | |
const pr = context.payload.pull_request; | |
if (pr.base.ref !== allowed_basebranch) { | |
core.setFailed(`PR opened against ${pr.base.ref}, not ${allowed_basebranch}`); | |
} else { | |
core.info(`PR opened correctly against ${allowed_basebranch}`); | |
} | |
# The rest only run if above are done | |
tests: | |
name: ${{ matrix.name }} | |
runs-on: ${{ matrix.os }} | |
needs: initial_check | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- name: Code style checks | |
os: ubuntu-latest | |
python: 3.x | |
toxenv: codestyle | |
- name: PEP 517 build | |
os: ubuntu-latest | |
python: 3.x | |
toxenv: twine | |
- name: Security audit | |
os: ubuntu-latest | |
python: 3.x | |
toxenv: bandit | |
- name: Link check | |
os: ubuntu-latest | |
python: 3.x | |
toxenv: linkcheck | |
- name: Test without optional deps | |
os: ubuntu-latest | |
python: 3.9 | |
toxenv: py39-test | |
- name: Coverage test with remote data | |
os: ubuntu-latest | |
python: '3.10' | |
toxenv: py310-test-alldeps-cov | |
toxposargs: --remote-data | |
- name: Test with dev dependencies | |
os: ubuntu-latest | |
python: '3.12' | |
toxenv: py312-test-devdeps | |
- name: Test with old dependencies | |
os: ubuntu-20.04 | |
python: 3.9 | |
toxenv: py39-test-oldestdeps | |
- name: Test in OSX | |
os: macos-latest | |
python: '3.10' | |
toxenv: py310-test | |
# NOTE: If TRDS cannot take the hit, disable --remote-data | |
- name: Test in Windows with remote data | |
os: windows-latest | |
python: '3.11' | |
toxenv: py311-test | |
toxposargs: --remote-data | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python }} | |
- name: Install Python dependencies | |
run: | | |
python -m pip install --upgrade pip tox | |
- name: Run tests | |
run: tox -e ${{ matrix.toxenv }} -- ${{ matrix.toxposargs }} | |
- name: Upload coverage to codecov | |
if: ${{ contains(matrix.toxenv,'-cov') }} | |
uses: codecov/codecov-action@v4 | |
with: | |
file: ./coverage.xml |