Add branches to CI #358
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: CI | |
on: | |
push: | |
branches: | |
- main | |
- 'v*' | |
tags: | |
- '*' | |
pull_request: | |
permissions: | |
contents: read | |
env: | |
ARCH_ON_CI: "normal" | |
IS_CRON: "false" | |
jobs: | |
initial_checks: | |
name: Mandatory checks before CI | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check base branch | |
uses: actions/github-script@v3 | |
if: github.event_name == 'pull_request' | |
with: | |
script: | | |
const skip_label = 'skip-basebranch-check'; | |
const { default_branch: allowed_basebranch } = context.payload.repository; | |
const pr = context.payload.pull_request; | |
if (pr.labels.find(lbl => lbl.name === skip_label)) { | |
core.info(`Base branch check is skipped due to the presence of ${skip_label} label`); | |
return; | |
} | |
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}`); | |
} | |
tests: | |
uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@v1 | |
needs: initial_checks | |
with: | |
envs: | | |
- linux: py311-test-cov | |
- linux: py310-test-alldeps | |
toxargs: '-v --develop' | |
- linux: py39-test-oldestdeps-alldeps-cov-clocale | |
- windows: py310-test-alldeps | |
- macos: py310-test-alldeps | |
conda: true | |
coverage: codecov | |
fail-fast: true | |
secrets: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
wheels_tests: | |
uses: OpenAstronomy/github-actions-workflows/.github/workflows/publish_pure_python.yml@v1 | |
needs: initial_checks | |
permissions: | |
contents: none | |
with: | |
upload_to_pypi: false | |
upload_to_anaconda: false | |
test_extras: test | |
test_command: pytest $GITHUB_WORKSPACE/tests $GITHUB_WORKSPACE/docs -p no:warnings |