Skip to content

Commit

Permalink
Test workflow changes
Browse files Browse the repository at this point in the history
  • Loading branch information
atharva-2001 committed Jan 24, 2025
1 parent b2f3e31 commit 12d8cdb
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 55 deletions.
26 changes: 20 additions & 6 deletions .github/actions/setup_env/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,27 @@ inputs:
runs:
using: "composite"
steps:
- uses: mamba-org/setup-micromamba@v1
- name: Download Lock File
run: wget -q https://raw.githubusercontent.com/tardis-sn/tardis/master/conda-${{ inputs.os-label }}.lock
if: matrix.pip == true
shell: bash

- name: Generate Cache Key
run: |
file_hash=$(cat conda-${{ inputs.os-label }}.lock | shasum -a 256 | cut -d' ' -f1)
echo "file_hash=$file_hash" >> "${GITHUB_OUTPUT}"
id: cache-environment-key
shell: bash

- uses: mamba-org/setup-micromamba@v2
with:
create-args: >-
conda-lock
environment-name: tardis
init-shell: bash
create-args: conda-lock
environment-name: tardis-base

- name: Install packages
run: |
conda-lock install --name tardis conda-${{ inputs.os-label }}.lock
shell: bash -el {0}
mkdir micromamba_tardis
conda-lock install --prefix micromamba_tardis conda-${{ inputs.os-label }}.lock
micromamba activate ./micromamba_tardis
shell: bash -el {0}
78 changes: 39 additions & 39 deletions .github/actions/setup_lfs/action.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: "Setup LFS"
description: "Pull LFS repositories and caches them"
description: "Downloads and extracts regression data from Zenodo"


inputs:
Expand All @@ -11,43 +11,43 @@ inputs:
runs:
using: "composite"
steps:
- name: Clone atharva-2001/tardis-regression-data
uses: actions/checkout@v4
with:
repository: atharva-2001/tardis-regression-data
path: tardis-regression-data
ref: numpy_v2_2

- name: Create LFS file list
run: git lfs ls-files -l | cut -d' ' -f1 | sort > .lfs-assets-id
working-directory: tardis-regression-data
- name: Download regression data from Zenodo
run: |
wget --show-progress --progress=bar:force https://sandbox.zenodo.org/records/156229/files/tardis-regression-np.zip
mkdir -p tardis-regression-data
unzip -q tardis-regression-np.zip -d tardis-regression-data
shell: bash

- name: Restore LFS cache
uses: actions/cache/restore@v4
id: lfs-cache-regression-data
with:
path: tardis-regression-data/.git/lfs
key: ${{ runner.os }}-lfs-${{ hashFiles('tardis-regression-data/.lfs-assets-id') }}-v1

- name: Git LFS Pull
run: git lfs pull
working-directory: tardis-regression-data
if: steps.lfs-cache-regression-data.outputs.cache-hit != 'true'
shell: bash

- name: Git LFS Checkout
run: git lfs checkout
working-directory: tardis-regression-data
if: steps.lfs-cache-regression-data.outputs.cache-hit == 'true'
shell: bash

- 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-regression-data.outputs.cache-hit != 'true' && !contains(github.ref, 'merge') && always() || false }}
uses: actions/cache/save@v4
id: lfs-cache-regression-data-save
with:
path: tardis-regression-data/.git/lfs
key: ${{ runner.os }}-lfs-${{ hashFiles('tardis-regression-data/.lfs-assets-id') }}-v1
# - name: Create LFS file list
# run: git lfs ls-files -l | cut -d' ' -f1 | sort > .lfs-assets-id
# working-directory: tardis-regression-data
# shell: bash

# - name: Restore LFS cache
# uses: actions/cache/restore@v4
# id: lfs-cache-regression-data
# with:
# path: tardis-regression-data/.git/lfs
# key: ${{ runner.os }}-lfs-${{ hashFiles('tardis-regression-data/.lfs-assets-id') }}-v1

# - name: Git LFS Pull
# run: git lfs pull
# working-directory: tardis-regression-data
# if: steps.lfs-cache-regression-data.outputs.cache-hit != 'true'
# shell: bash

# - name: Git LFS Checkout
# run: git lfs checkout
# working-directory: tardis-regression-data
# if: steps.lfs-cache-regression-data.outputs.cache-hit == 'true'
# shell: bash

# - 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-regression-data.outputs.cache-hit != 'true' && !contains(github.ref, 'merge') && always() || false }}
# uses: actions/cache/save@v4
# id: lfs-cache-regression-data-save
# with:
# path: tardis-regression-data/.git/lfs
# key: ${{ runner.os }}-lfs-${{ hashFiles('tardis-regression-data/.lfs-assets-id') }}-v1
15 changes: 10 additions & 5 deletions .github/workflows/build-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ name: docs
on:
push:
branches:
- master
- '*'

pull_request_target:
branches:
Expand Down Expand Up @@ -77,8 +77,8 @@ jobs:

build-docs:
runs-on: ubuntu-latest
needs: check-for-changes
if: needs.check-for-changes.outputs.trigger-check-outcome == 'success' || needs.check-for-changes.outputs.docs-check-outcome == 'success'
# needs: check-for-changes
# if: needs.check-for-changes.outputs.trigger-check-outcome == 'success' || needs.check-for-changes.outputs.docs-check-outcome == 'success'
steps:
- uses: actions/checkout@v4
if: github.event_name != 'pull_request_target'
Expand Down Expand Up @@ -108,14 +108,19 @@ jobs:
mkdir -p ~/Downloads/tardis-data && cp -a ./tardis-regression-data/atom_data/. ~/Downloads/tardis-data
- name: Install package
run: pip install -e .
run: |
micromamba activate ./micromamba_tardis
pip install -e .
- name: Install Sphinx extensions
run: |
micromamba activate ./micromamba_tardis
pip install sphinxcontrib-googleanalytics
- name: Build documentation
run: cd docs/ && make html NCORES=auto
run: |
micromamba activate ./micromamba_tardis
cd docs/ && make html NCORES=auto
- name: Set destination directory
run: |
Expand Down
17 changes: 12 additions & 5 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,34 +58,41 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Setup LFS
uses: ./.github/actions/setup_lfs

- name: Setup environment
uses: ./.github/actions/setup_env
with:
os-label: ${{ matrix.label }}

- name: Setup LFS
uses: ./.github/actions/setup_lfs

- name: Install package editable
if: ${{ !inputs.pip_git }}
run: |
micromamba activate ./micromamba_tardis
pip install -e . --user
- name: Install package git
if: ${{ inputs.pip_git }}
run: |
micromamba activate ./micromamba_tardis
pip install git+https://github.com/tardis-sn/tardis.git@master
- name: Install qgridnext
if: ${{ !inputs.pip_git }}
run: |
micromamba activate ./micromamba_tardis
pip install qgridnext
- name: Run tests
run: pytest tardis ${{ env.PYTEST_FLAGS }} -m "${{ matrix.continuum }} continuum"
run: |
micromamba activate ./micromamba_tardis
pytest tardis ${{ env.PYTEST_FLAGS }} -m "${{ matrix.continuum }} continuum"
- name: Regression Data Generation tests
run: pytest tardis ${{ env.PYTEST_FLAGS }} --generate-reference -m "${{ matrix.continuum }} continuum"
run: |
micromamba activate ./micromamba_tardis
pytest tardis ${{ env.PYTEST_FLAGS }} --generate-reference -m "${{ matrix.continuum }} continuum"
if: contains(github.event.pull_request.labels.*.name, 'run-generation-tests') || github.ref == 'refs/heads/master'

- run: mv .coverage .coverage.${{ strategy.job-index }}
Expand Down

0 comments on commit 12d8cdb

Please sign in to comment.