Merge remote-tracking branch 'origin/tardis_env_upgrade_2023' into ta… #83
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
# For more information about TARDIS pipelines, please refer to: | |
# | |
# https://tardis-sn.github.io/tardis/development/continuous_integration.html | |
name: tests | |
on: | |
push: | |
branches: | |
- '*' | |
pull_request: | |
branches: | |
- '*' | |
env: | |
CACHE_NUMBER: 1 # increase to reset cache manually | |
PYTEST_FLAGS: --tardis-refdata=${{ github.workspace }}/tardis-refdata | |
--cov=tardis --cov-report=xml --cov-report=html | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} | |
cancel-in-progress: true | |
defaults: | |
run: | |
shell: bash -l {0} | |
jobs: | |
build: | |
if: github.repository_owner == 'tardis-sn' | |
strategy: | |
matrix: | |
include: | |
- os: ubuntu-latest | |
label: linux-64 | |
prefix: /usr/share/miniconda3/envs/tardis | |
- os: macos-latest | |
label: osx-64 | |
prefix: /Users/runner/miniconda3/envs/tardis | |
name: ${{ matrix.label }} | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Clone tardis-sn/tardis-refdata | |
uses: actions/checkout@v2 | |
with: | |
repository: tardis-sn/tardis-refdata | |
path: tardis-refdata | |
lfs: false | |
- name: Create LFS file list | |
run: git lfs ls-files -l | cut -d' ' -f1 | sort > .lfs-assets-id | |
working-directory: tardis-refdata | |
- name: Restore LFS cache | |
uses: actions/cache/restore@v3 | |
id: lfs-cache | |
with: | |
path: tardis-refdata/.git/lfs | |
key: ${{ runner.os }}-lfs-${{ hashFiles('tardis-refdata/.lfs-assets-id') }}-v1 | |
- name: Git LFS Pull | |
run: git lfs pull | |
working-directory: tardis-refdata | |
if: steps.lfs-cache.outputs.cache-hit != 'true' | |
- name: Git LFS Checkout | |
run: git lfs checkout | |
working-directory: tardis-refdata | |
if: steps.lfs-cache.outputs.cache-hit == 'true' | |
- name: Save LFS cache if not found | |
# uses fake ternary | |
# for reference: https://github.com/orgs/community/discussions/26738#discussioncomment-3253176 | |
if: ${{ steps.lfs-cache.outputs.cache-hit != 'true' && always() || false }} | |
uses: actions/cache/save@v3 | |
id: lfs-cache-save | |
with: | |
path: tardis-refdata/.git/lfs | |
key: ${{ runner.os }}-lfs-${{ hashFiles('tardis-refdata/.lfs-assets-id') }}-v1 | |
- name: Setup environment | |
uses: conda-incubator/setup-miniconda@v2 | |
with: | |
miniforge-variant: Mambaforge | |
miniforge-version: latest | |
activate-environment: tardis | |
use-mamba: true | |
- uses: actions/cache@v2 | |
with: | |
path: ${{ matrix.prefix }} | |
key: conda-${{ matrix.label }}-${{ hashFiles('conda-${{ matrix.label }}.lock') }}-${{ env.CACHE_NUMBER }} | |
id: cache-conda | |
- name: Update environment | |
run: mamba update -n tardis --file conda-${{ matrix.label }}.lock | |
if: steps.cache-conda.outputs.cache-hit != 'true' | |
- name: Install package | |
run: pip install -e . | |
- name: Run tests | |
run: pytest tardis ${{ env.PYTEST_FLAGS }} | |
- name: Upload to Codecov | |
run: bash <(curl -s https://codecov.io/bash) |