Skip to content

Commit

Permalink
Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
atharva-2001 committed Jan 24, 2025
1 parent 7f7cfb0 commit 82c49b4
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 13 deletions.
24 changes: 18 additions & 6 deletions .github/actions/setup_env/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +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
micromamba activate tardis
mkdir micromamba_tardis
conda-lock install --prefix micromamba_tardis conda-${{ inputs.os-label }}.lock
micromamba activate ./micromamba_tardis
shell: bash -el {0}
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
11 changes: 9 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,23 +69,30 @@ jobs:
- 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 82c49b4

Please sign in to comment.