2023: day 14 part 1 complete #60
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: Test building C++ targets | |
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/test-build.yml | |
*/src/day*.cpp | |
*/src/day*.hpp | |
*/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 "day|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 targets | |
run: | | |
cd ${{ matrix.directory }} | |
make -j2 CXX=${{ matrix.compiler }} DISABLE_SANITIZERS=TRUE DISABLE_BEAR=TRUE build/release/${{ matrix.target }} build/debug/${{ matrix.target }} build/fast/${{ matrix.target }} |