Skip to content

Update Compare Refdata With New Action And Other Fixes #68

Update Compare Refdata With New Action And Other Fixes

Update Compare Refdata With New Action And Other Fixes #68

Workflow file for this run

name: compare-refdata
on:
push:
branches:
- '*'
pull_request:
branches:
- '*'
repository_dispatch:
types: [compare-refdata-command]
workflow_dispatch:
workflow_call: # to be called by pre release workflow
env:
PYTEST_FLAGS_COMPARE: --tardis-refdata=${{ github.workspace }}/tardis-refdata --tardis-regression-data=${{ github.workspace }}/tardis-regression-data --generate-reference
REF2_HASH: origin/master
defaults:
run:
shell: bash -l {0}
jobs:
build:
# if: github.repository_owner == 'tardis-sn'
runs-on: ubuntu-latest
steps:
- name: Setup LFS
uses: tardis-sn/github_action_setup_lfs@v1
- name: Checkout TARDIS (master)
uses: actions/checkout@v4
if: ${{ (github.event_name == 'push') || (github.event_name == 'pull_request') || (github.event_name == 'workflow_dispatch') || (github.event_name == 'schedule') }} # for checking master
with:
repository: tardis-sn/tardis
path: tardis/
- name: Checkout TARDIS (PR)
uses: actions/checkout@v4
if: ${{ (github.event_name == 'repository_dispatch') }} # for checking PRs
with:
repository: ${{ github.event.client_payload.pull_request.head.repo.full_name }}
path: tardis/
ref: ${{ github.event.client_payload.pull_request.head.ref }}
- name: Download Lock File
run: wget -q https://raw.githubusercontent.com/tardis-sn/tardis/master/conda-linux-64.lock
- name: Generate Cache Key
run: |
file_hash=$(cat conda-linux-64.lock | shasum -a 256 | cut -d' ' -f1)
echo "file_hash=$file_hash" >> "${GITHUB_OUTPUT}"
id: cache-environment-key
- uses: mamba-org/setup-micromamba@v1
with:
environment-file: conda-linux-64.lock
cache-environment-key: ${{ steps.cache-environment-key.outputs.file_hash }}
cache-downloads-key: ${{ steps.cache-environment-key.outputs.file_hash }}
environment-name: tardis
cache-environment: true
cache-downloads: true
- name: Install Bokeh
run: micromamba install bokeh --channel conda-forge --no-deps --yes
- name: Generate reference data for comparison
working-directory: tardis/
run: pytest tardis ${{ env.PYTEST_FLAGS_COMPARE }}
- name: Compare Reference Data
working-directory: tardis-refdata/notebooks/
run: |
jupyter nbconvert ref_data_compare.ipynb --to html --allow-errors --execute --ExecutePreprocessor.timeout=6000
- name: Upload comparison notebook
uses: actions/upload-artifact@v2
with:
name: Comparison Notebook
path: tardis-refdata/notebooks/ref_data_compare.html
- name: Check if reference data are equal
run: if [ "$(cat ../refdata_compare_result)" == "REFDATA COMPARISON FAILED" ]; then exit 1; fi