Skip to content

Direct reduction unit tests #76

Direct reduction unit tests

Direct reduction unit tests #76

Workflow file for this run

name: Direct reduction unit tests
on:
push:
branches: [main]
pull_request:
branches: [main]
types: [opened, reopened, synchronize]
release:
types: [published]
schedule:
- cron: '1 1 * * 1'
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
#- name: Cache mamba
# uses: actions/cache@v3
# env:
# CACHE_NUMBER: 0
# with:
# path: ~/conda_pkgs_dir
# key: mamba-${{ hashFiles('environment.yml') }}
- name: Setup Miniconda
uses: mamba-org/setup-micromamba@v1
with:
environment-file: environment.yml
create-args: >-
python=3.10
- name: Cache data and instrument files
id: cache-files
uses: actions/cache@v3
with:
path: |
InstrumentFiles
direct_reduction_test
key: cached-data-${{ hashFiles('**/cached_git_hashes') }}
- name: Install Mantid
run: |
micromamba install -c mantid/label/nightly mantid
- name: Clone data instrument files
if: ${{ steps.cache-files.outputs.cache-hit != 'true' }}
run: |
git clone https://github.com/pace-neutrons/InstrumentFiles.git
git clone https://github.com/mducle/direct_reduction_test.git
- name: Update data instrument files
run: |
cwd=$(pwd)
cd $cwd/InstrumentFiles && git pull && git rev-parse --short HEAD > ../direct_reduction_test/cached_git_hashes
cd $cwd/direct_reduction_test && git pull && git rev-parse --short HEAD >> cached_git_hashes
cd $cwd && cp -rpa direct_reduction_test/datafiles ./
- name: Run Tests and Coverage
run: |
cd tests
coverage run --source=.. run_test.py
- name: Report Coverage
run: |
cd tests
coverage report
#- name: Setup tmate
# if: ${{ failure() }}
# uses: mxschmitt/action-tmate@v3