build-fast #1
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
# Build directly on the GitHub runner with caching | |
name: build-fast | |
on: | |
workflow_dispatch: | |
workflow_call: | |
concurrency: | |
group: build-fast-${{github.ref}}-${{github.event.pull_request.number || github.run_number}}-${{github.workflow}} | |
cancel-in-progress: true | |
jobs: | |
linux: | |
name: "${{matrix.runner}}-${{matrix.compiler}}-${{matrix.version}}" | |
strategy: | |
matrix: | |
include: | |
- runner: focal | |
compiler: gcc | |
version: 8 | |
- runner: jammy | |
compiler: gcc | |
version: 12 | |
- runner: focal | |
compiler: clang | |
version: 10 | |
- runner: jammy | |
compiler: clang | |
version: 15 | |
env: | |
GHA_JOB_NAME: "${{matrix.runner}}-${{matrix.compiler}}-${{matrix.version}}" | |
CCACHE_DIR: "${{github.workspace}}/.ccache" | |
CCACHE_MAXSIZE: "100Mi" | |
CMAKE_PRESET: fast | |
CC: ${{matrix.compiler}}-${{matrix.version}} | |
CXX: ${{matrix.compiler == 'gcc' && 'g++' || 'clang++'}}-${{matrix.version}} | |
runs-on: >- | |
${{ matrix.runner == 'focal' && 'ubuntu-20.04' | |
|| matrix.runner == 'jammy' && 'ubuntu-22.04' | |
}} | |
steps: | |
- name: Install dependencies | |
run: | | |
sudo apt-get -q -y update | |
sudo apt-get -q -y install \ | |
ccache cmake ninja-build python3 \ | |
nlohmann-json3-dev libgtest-dev libhepmc3-dev \ | |
${{matrix.compiler}}-${{matrix.version}} \ | |
${{matrix.compiler == 'gcc' && format('g++-{0}', matrix.version) || ''}} | |
echo "Installed toolchain:" | |
ld --version | head -1 | |
$CC --version | head -1 | |
$CXX --version | head -1 | |
- name: Check out Celeritas | |
uses: actions/checkout@v4 | |
- name: Cache ccache | |
uses: actions/cache@v4 | |
with: | |
path: ${{env.CCACHE_DIR}} | |
key: ccache-backport-${{env.GHA_JOB_NAME}}-${{github.run_id}} | |
restore-keys: | | |
ccache-backport-${{env.GHA_JOB_NAME}} | |
ccache-${{env.GHA_JOB_NAME}} | |
- name: Zero ccache stats | |
run: | | |
ccache -z | |
- name: Configure Celeritas | |
run: | | |
ln -fs scripts/cmake-presets/ci-ubuntu-github.json CMakeUserPresets.json | |
cmake --preset=${CMAKE_PRESET} \ | |
-DCeleritas_GIT_DESCRIBE="${{github.event.pull_request | |
&& format(';-pr.{0};', github.event.pull_request.number) | |
|| format(';-{0};', github.ref_name)}}" | |
- name: Build all | |
working-directory: build | |
run: | | |
ninja | |
- name: Run tests | |
working-directory: build | |
run: | | |
ctest --parallel $(nproc) --timeout 15 --output-on-failure | |
- name: Install | |
working-directory: build | |
run: | | |
ninja install | |
- name: Check installation | |
working-directory: install | |
run: | | |
./bin/celer-sim --version | |
- name: Show ccache stats | |
if: ${{!cancelled()}} | |
run: | | |
ccache -s | |
# vim: set nowrap tw=100: |