-
Notifications
You must be signed in to change notification settings - Fork 5
117 lines (107 loc) · 3.53 KB
/
unittests.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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
name: Unit Tests
on:
push:
branches:
- main
pull_request:
# Cancel earlier jobs on new PR commit
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
# First list all the files in experiments/tests, and generate a JSON string of all the files
collect-experiments:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
# matrix-wip: ${{ steps.set-matrix-wip.outputs.matrix-wip }}
steps:
- uses: actions/checkout@v3
- id: set-matrix
run: |
echo "matrix=$(ls experiments/tests/*.yaml | jq -R -s -c 'split("\n")[:-1]')" >> $GITHUB_OUTPUT
# - id: set-matrix-wip
# run: echo "matrix-wip=$(ls experiments/wip/*.yaml | jq -R -s -c 'split("\n")[:-1]')" >> $GITHUB_OUTPUT
# Build a matrix run of all experiments generated in previous job
run-experiments:
needs: collect-experiments
runs-on: [self-hosted, linux]
strategy:
matrix:
experiment: ${{ fromJson(needs.collect-experiments.outputs.matrix) }}
steps:
- name: 'Cleanup build folder'
run: |
ls -la ./
rm -rf ./* || true
rm -rf ./.??* || true
ls -la ./
- uses: actions/checkout@v3
with:
# This is a personal access token with access to the gmt_tools repo.
# It is stored as a repo secret in BFASST and a dependabot secret in BFASST
# (for PRs generated by dependabot).
token: ${{ secrets.GMT_TOOLS_PAT }}
submodules: 'recursive'
- uses: ./.github/actions/setup_env
with:
cache_path: $HOME/actions-runner/cache
- name: experiments
timeout-minutes: 40
run: |
source .venv/bin/activate
python scripts/bfasster.py --yaml ${{ matrix.experiment }}
- name: 'Create fname'
if: failure()
id: set-fname
run: echo "fname=$(basename ${{ matrix.experiment }} .yaml)" >> $GITHUB_OUTPUT
- name: 'Upload artifacts'
if: failure()
uses: actions/upload-artifact@v3
with:
name: ${{ steps.set-fname.outputs.fname }}
path: |
build/**/log.txt
build/**/*.log
unittest:
runs-on: [self-hosted, linux]
steps:
- name: 'Cleanup build folder'
run: |
ls -la ./
rm -rf ./* || true
rm -rf ./.??* || true
ls -la ./
- uses: actions/checkout@v3
with:
# This is a personal access token with access to the gmt_tools repo.
# It is stored as a repo secret in BFASST and a dependabot secret in BFASST
# (for PRs generated by dependabot).
token: ${{ secrets.GMT_TOOLS_PAT }}
submodules: 'recursive'
- uses: ./.github/actions/setup_env
with:
cache_path: $HOME/actions-runner/cache
- name: Run unittest
run: |
make unittest
# Don't use WIP tests until Github UI is fixed (https://github.com/orgs/community/discussions/15452)
#
# run-experiments-wip:
# needs: collect-experiments
# runs-on: [self-hosted, linux]
# strategy:
# matrix:
# experiment: ${{ fromJson(needs.collect-experiments.outputs.matrix-wip) }}
# continue-on-error: true
# steps:
# - uses: actions/checkout@v3
# with:
# submodules: 'recursive'
# - uses: ./.github/actions/setup_env
# - name: experiments
# timeout-minutes: 30
# run: |
# source .venv/bin/activate
# source env.sh
# python scripts/run_experiment.py ${{ matrix.experiment }} -j8 --print_period 0