-
Notifications
You must be signed in to change notification settings - Fork 0
81 lines (69 loc) · 2.1 KB
/
tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
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