CI #312
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: | |
- "master" | |
pull_request: | |
branches: | |
- "master" | |
schedule: | |
# Weekly tests run every Saturday on master by default: | |
# Scheduled workflows run on the latest commit on the default or base branch. | |
# (from https://help.github.com/en/actions/reference/events-that-trigger-workflows#scheduled-events-schedule) | |
- cron: "34 2 * * 6" | |
concurrency: | |
group: "${{ github.ref }}-${{ github.head_ref }}" | |
cancel-in-progress: true | |
jobs: | |
test: | |
name: Test on ${{ matrix.os }}, Python ${{ matrix.python-version }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [macOS-latest, ubuntu-latest, windows-latest] | |
python-version: ["3.9", "3.10", "3.11", "3.12"] | |
# Only test lowest and highest version on the expensive/slow | |
# macOS and windows runners (UPDATE when supported versions change): | |
exclude: | |
- os: macOS-latest | |
python-version: 3.10 | |
- os: macOS-latest | |
python-version: 3.11 | |
- os: windows-latest | |
python-version: 3.10 | |
- os: windows-latest | |
python-version: 3.11 | |
steps: | |
- uses: actions/checkout@v3 | |
# More info on options: https://github.com/marketplace/actions/provision-with-micromamba | |
- uses: mamba-org/provision-with-micromamba@main | |
with: | |
environment-file: devtools/conda-envs/test_env.yaml | |
environment-name: test | |
channels: conda-forge,defaults | |
extra-specs: | | |
python=${{ matrix.python-version }} | |
- name: Install package | |
# conda setup requires this special shell | |
shell: bash -l {0} | |
run: | | |
python -m pip install . --no-deps | |
micromamba list | |
- name: Run tests | |
# conda setup requires this special shell | |
shell: bash -l {0} | |
run: | | |
pytest -v --cov=alchemtest --cov-report=xml --color=yes alchemtest/tests/ | |
- name: CodeCov | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
name: codecov-${{ matrix.os }}-py${{ matrix.python-version }} | |
file: ./coverage.xml | |
flags: unittests | |
fail_ci_if_error: true | |
pypi_check: | |
name: Check source package integrity (for PyPi deployment) | |
if: "github.repository == 'alchemistry/alchemtest'" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.9 | |
- name: Install tools | |
run: | | |
python -m pip install twine build | |
- name: Build alchemtest source dist | |
run: | | |
python -m build --sdist --wheel --outdir dist/ | |
- name: Check package build sdist | |
run: | | |
DISTRIBUTION=$(ls -t1 dist/alchemtest-*.tar.gz | head -n 1) | |
test -n "${DISTRIBUTION}" || { echo "no distribution dist/alchemtest-*.tar.gz found"; exit 1; } | |
echo "twine check $DISTRIBUTION" | |
twine check $DISTRIBUTION |