Skip to content

Commit

Permalink
Use trimja-action
Browse files Browse the repository at this point in the history
Use trimja ourselves to reduce the amount we need to build on pull
requests.  Unfortunately the Ninja file generated from CMake doesn't
have good dependencies for the tests.  The tests don't have a proper
dependency on the `trimja` executable, nor the test files that it reads.

For the moment we pass both `trimja` and `test` into `affected` so that
everything is always built.  However, we should look into improving
this.
  • Loading branch information
elliotgoodrich committed Oct 13, 2024
1 parent ac0be44 commit 2626d7c
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,25 +24,32 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: seanmiddleditch/gha-setup-ninja@master
- name: Set reusable strings
id: strings
shell: bash
run: |
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
- name: Configure CMake
run: >
cmake -B ${{ steps.strings.outputs.build-output-dir }}
cmake -B output
-DCMAKE_CXX_COMPILER=${{ matrix.environment.cpp }}
-DCMAKE_C_COMPILER=${{ matrix.environment.c }}
${{ format('-D{0}={1}', matrix.environment.name == 'Windows' && 'CMAKE_CONFIGURATION_TYPES' || 'CMAKE_BUILD_TYPE', matrix.build_type) }}
${{ matrix.environment.name != 'Windows' && '-G Ninja' || ''}}
- uses: elliotgoodrich/trimja-action@v1
# Skip Windows (which doesn't yet use Ninja) and releases
if: matrix.environment.name != 'Windows' && !startsWith(github.ref, 'refs/tags/')
with:
path: output/build.ninja
build-configuration: ${{ matrix.build_type }}
# CTest does not have the right dependencies so we always build everything, we
# won't gain any time, but will verify that trimja can at least handle a Ninja
# file generated by CMake.
affected: |
test
trimja
- name: Build
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }}
run: cmake --build output --config ${{ matrix.build_type }}
- name: Test
run: ctest --test-dir ${{ steps.strings.outputs.build-output-dir }} --build-config ${{ matrix.build_type }} --output-on-failure
run: ctest --test-dir output --build-config ${{ matrix.build_type }} --output-on-failure
- name: Install
if: startsWith(github.ref, 'refs/tags/') && matrix.build_type == 'Release'
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} --target package
run: cmake --build output --config ${{ matrix.build_type }} --target package
- name: Generate Changelog
run: git show -s --format='%b' > build/CHANGELOG.txt
if: startsWith(github.ref, 'refs/tags/') && matrix.build_type == 'Release'
Expand Down

0 comments on commit 2626d7c

Please sign in to comment.