Skip to content

Merge pull request #511 from byuccl/k0 #1549

Merge pull request #511 from byuccl/k0

Merge pull request #511 from byuccl/k0 #1549

Workflow file for this run

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 tests/ci, 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@v4
- id: set-matrix
run: |
echo "matrix=$(ls tests/ci/*.yaml | jq -R -s -c 'split("\n")[:-1]')" >> $GITHUB_OUTPUT
# - id: set-matrix-wip
# run: echo "matrix-wip=$(ls tests/wip/*.yaml | jq -R -s -c 'split("\n")[:-1]')" >> $GITHUB_OUTPUT
# Build a matrix run of all experiments generated in previous job
run-test:
needs: collect-experiments
runs-on: [self-hosted, linux, bfasst]
strategy:
fail-fast: false
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@v4
- name: Environment variables
run: |
mkdir -p ${{ runner.temp }}/../../cache/fasm2bels
echo "BFASST_PATH_FASM2BELS=$(realpath -se ${{ runner.temp }}/../../cache/fasm2bels)" >> $GITHUB_ENV
- name: Install external tools
run: |
eval `ssh-agent -s`
ssh-add - <<< '${{ secrets.GMT_TOOLS_DEPLOY_SSH_KEY }}'
make env
. .venv/bin/activate && python bfasst/external_tools.py install_test_yaml ${{ matrix.experiment }}
- name: experiments
timeout-minutes: 40
run: |
. .venv/bin/activate && python scripts/run.py ${{ matrix.experiment }}
- name: Check ninja
if: ${{ matrix.experiment != 'tests/ci/vivado_phys_netlist_error_inject.yaml' }}
run: |
ninja_output=$(ninja -n)
echo "$ninja_output"
if [[ "$ninja_output" != *"ninja: no work to do."* ]]; then
echo "Ninja reported remaining work to do." && exit 1
fi
- 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, bfasst]
steps:
- name: 'Cleanup build folder'
run: |
ls -la ./
rm -rf ./* || true
rm -rf ./.??* || true
ls -la ./
- uses: actions/checkout@v4
- name: Environment variables
run: |
echo "BFASST_PATH_FASM2BELS=$(realpath -se ${{ runner.temp }}/../../cache/fasm2bels)" >> $GITHUB_ENV
- name: Install external tools
run: |
eval `ssh-agent -s`
ssh-add - <<< '${{ secrets.GMT_TOOLS_DEPLOY_SSH_KEY }}'
make env
. .venv/bin/activate && python bfasst/external_tools.py install rapidwright fasm2bels gmt_tools
- name: Run unittest
run: |
make unittest