Merge pull request #345 from byuccl/tokens #885
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |