Skip to content

Avoid error if no files were changed #12

Avoid error if no files were changed

Avoid error if no files were changed #12

Workflow file for this run

name: Test builds
on:
push:
branches:
- main
- gh_actions
workflow_dispatch:
jobs:
setup-matrix:
runs-on: ubuntu-latest
name: Test 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: |
*/src/day*.cpp
*/src/lib.h*
*/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
cat $GITHUB_OUTPUT
outputs:
matrix-combinations: ${{ steps.setup-matrix-combinations.outputs.matrix-combinations }}
matrix-job:
runs-on: ubuntu-latest
needs: setup-matrix
if: ${{ fromJson(needs.setup-matrix.outputs.matrix-combinations) }}
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.setup-matrix.outputs.matrix-combinations) }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1
- name: Install dependencies
run: |
sudo apt-get update -y -qq
sudo apt-get -qq -y install clang g++>=9.3.0
- name: Build targets
run: |
cd ${{ matrix.directory }}
make -j2 CXX=${{ matrix.compiler }} DISABLE_BEAR=TRUE build/release/${{ matrix.target }} build/debug/${{ matrix.target }}