CI: Back to Old Actions #37
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: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
tests: | |
name: ${{ matrix.toxenv }} | |
runs-on: ubuntu-latest | |
if: "!(contains(github.event.head_commit.message, '[skip ci]') || contains(github.event.head_commit.message, '[ci skip]'))" | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- python: '3.8' | |
toxenv: py38-test-online | |
- python: '3.9' | |
toxenv: py39-test-online | |
- python: '3.10' | |
toxenv: py310-test-online | |
- python: '3.11' | |
toxenv: py311-test-online | |
- python: '3.12' | |
toxenv: py312-test-online | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python ${{ matrix.python }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python }} | |
cache: pip | |
cache-dependency-path: '**/pyproject.toml' | |
- name: Install base dependencies | |
run: | | |
python -m pip install --upgrade --quiet pip setuptools tox | |
python -c "import sys; print(f'Python {sys.version}')" | |
python -c "import pip; print(f'pip {pip.__version__}')" | |
python -c "import setuptools; print(f'setuptools {setuptools.__version__}')" | |
python -c "import tox; print(f'tox {tox.__version__}')" | |
- name: Install graphviz dependency | |
if: "endsWith(matrix.toxenv, 'build_docs')" | |
run: sudo apt-get -y install graphviz | |
- name: Install build dependencies | |
if: "contains(matrix.toxenv, 'devdeps')" | |
run: | | |
sudo apt-get -y install libopenblas-base libopenblas-dev | |
- name: Cache tox environments | |
uses: actions/cache@v3 | |
with: | |
path: .tox | |
# setup.cfg and pyproject.toml have versioning info that would | |
# impact the tox environment. | |
key: ${{ github.ref }}-${{ matrix.toxenv }}-tox-${{ hashFiles('pyproject.toml') }} | |
- name: Cache astropy cache | |
uses: actions/cache@v3 | |
with: | |
path: ~/.astropy | |
# setup.cfg and pyproject.toml have versioning info that would | |
# impact the tox environment. | |
key: ${{ github.ref }}-${{ matrix.toxenv }}-astropycache | |
- name: Run tests | |
run: tox -v -e ${{ matrix.toxenv }} | |
build_docs: | |
uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@v1 | |
if: "!(contains(github.event.head_commit.message, '[skip ci]') || contains(github.event.head_commit.message, '[ci skip]'))" | |
with: | |
cache-path: .tox | |
cache-key: build_docs-astropy | |
libraries: | | |
apt: | |
- pandoc | |
- graphviz | |
envs: | | |
- linux: build_docs | |
coverage: | |
name: "Conda/Coverage/Astrometry.net" | |
runs-on: ubuntu-latest | |
if: "!(contains(github.event.head_commit.message, '[skip ci]') || contains(github.event.head_commit.message, '[ci skip]'))" | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Get Date | |
id: get-date | |
run: echo "today=$(/bin/date -u '+%Y%m%d')" >> $GITHUB_OUTPUT | |
shell: bash | |
- name: Cache conda | |
uses: actions/cache@v3 | |
with: | |
path: ~/conda_pkgs_dir | |
key: | |
${{ runner.os }}-${{ runner.arch }}-conda-${{ hashFiles('pyproject.toml') }} | |
- name: Cache env | |
uses: actions/cache@v3 | |
with: | |
path: ${{ env.CONDA }}/envs | |
key: | |
${{ github.ref }}-${{ runner.os }}-${{ runner.arch }}-${{ steps.get-date.outputs.today }}-conda-envs-${{ hashFiles('pyproject.toml') }} | |
- uses: conda-incubator/setup-miniconda@v2 | |
with: | |
miniforge-variant: Mambaforge | |
miniforge-version: latest | |
activate-environment: astropop | |
use-mamba: true | |
mamba-version: "*" | |
channels: conda-forge,defaults | |
python-version: "3.12" | |
- name: Cache astropy cache | |
uses: actions/cache@v3 | |
with: | |
path: ~/.astropy | |
# setup.cfg and pyproject.toml have versioning info that would | |
# impact the tox environment. | |
key: ${{ github.ref }}-conda-astropy | |
- name: Install dependencies | |
shell: bash -l {0} | |
run: | | |
mamba install -y -q pytest astrometry \ | |
astropy scipy numpy matplotlib \ | |
scikit-image scikit-learn \ | |
sep astroquery | |
pip install astroscrappy | |
pip install coveralls .[test] | |
- name: Install astropop | |
shell: bash -l {0} | |
run: pip install -U .[all] | |
- name: Print versions | |
shell: bash -l {0} | |
run: | | |
conda info | |
conda list | |
- name: Run Pytest and generate coverage | |
shell: bash -l {0} | |
run: | | |
pytest --pyargs ./tests ./docs --remote-data --cov astropop --cov-config=./pyproject.toml | |
coverage xml -o ./coverage.xml | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v4 | |
with: | |
file: ./coverage.xml | |
token: ${{ secrets.CODECOV_TOKEN }} | |
- name: Upload coverage to Coveralls | |
shell: bash -l {0} | |
if: github.event_name != 'pull_request' | |
env: | |
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: coveralls |