Skip to content

Rewrite gen_matrix.py #29

Rewrite gen_matrix.py

Rewrite gen_matrix.py #29

Workflow file for this run

name: Run unit tests
on:
push:
branches:
- main
jobs:
setup-matrix:
runs-on: ubuntu-latest
name: Get changed files
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v40
with:
json: true
files: |
.github/workflows/gen_matrix.py
.github/workflows/unit-tests.yml
*/src/day*.hpp
*/src/test*.cpp
*/src/lib.h*
*/src/unit_test/*
*/Makefile
# reference: https://stackoverflow.com/a/65094398
- name: Setup matrix combinations
id: setup-matrix-combinations
run: python $GITHUB_WORKSPACE/.github/workflows/gen_matrix.py "${{ steps.changed-files.outputs.all_changed_files }}" $GITHUB_OUTPUT "test"
outputs:
matrix-combinations: ${{ steps.setup-matrix-combinations.outputs.matrix-combinations }}
matrix-job:
runs-on: ubuntu-latest
needs: setup-matrix
if: ${{ needs.setup-matrix.outputs.matrix-combinations != '{}' }}
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.setup-matrix.outputs.matrix-combinations) }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Install compiler
run: |
sudo apt-get -qq -y update
if [[ ${{ matrix.compiler }} == clang++ ]]; then
sudo apt-get -qq -y install clang
else
sudo apt-get -qq -y install g++
fi
- name: Build test
run: |
cd ${{ matrix.directory }}
make CXX=${{ matrix.compiler }} DISABLE_BEAR=TRUE build/debug/${{ matrix.target }}
- name: Run test
run: |
cd ${{ matrix.directory }}
make CXX=${{ matrix.compiler }} DISABLE_BEAR=TRUE ${{ matrix.target }}