Skip to content

Commit f62856e

Browse files
committed
Refactor build workflow to improve GCC 15 support and streamline job configurations
1 parent 35274a7 commit f62856e

1 file changed

Lines changed: 53 additions & 37 deletions

File tree

.github/workflows/build.yml

Lines changed: 53 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
name: build
22

3-
# Trigger on push, pull request, or via manual dispatch.
43
on:
54
push:
65
pull_request:
@@ -10,65 +9,82 @@ on:
109
jobs:
1110
build:
1211
runs-on: ${{ matrix.os }}
13-
name: ${{ matrix.os }} (${{ matrix.preset }}) ${{ matrix.build_type }}
12+
name: ${{ matrix.name }}
1413
timeout-minutes: 30
1514

1615
strategy:
1716
fail-fast: false
1817
matrix:
19-
# When adding another, also add to copybara's github_check_runs.
20-
os: ['ubuntu-latest', 'macos-latest', 'windows-latest']
21-
build_type: ['Release']
22-
preset: ['make', 'windows']
23-
exclude:
24-
- os: ubuntu-latest
25-
preset: windows
26-
- os: macos-latest
27-
preset: windows
28-
- os: windows-latest
18+
include:
19+
- name: ubuntu-latest (make) Release
20+
os: ubuntu-latest
2921
preset: make
22+
build_type: Release
23+
cc: gcc-13
24+
cxx: g++-13
25+
26+
- name: ubuntu-latest (gcc-15) Release
27+
os: ubuntu-latest
28+
preset: make
29+
build_type: Release
30+
cc: gcc-15
31+
cxx: g++-15
32+
33+
- name: macos-latest (make) Release
34+
os: macos-latest
35+
preset: make
36+
build_type: Release
37+
cc: clang
38+
cxx: clang++
39+
40+
- name: windows-latest (windows) Release
41+
os: windows-latest
42+
preset: windows
43+
build_type: Release
3044

3145
concurrency:
32-
group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.os }}-${{ matrix.preset }}-${{ matrix.build_type }}
46+
group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.name }}
3347
cancel-in-progress: true
3448

3549
steps:
36-
- uses: actions/checkout@v6
50+
- uses: actions/checkout@v6
51+
52+
- name: Install Linux toolchain
53+
if: runner.os == 'Linux'
54+
run: |
55+
if [[ "${{ matrix.cc }}" == "gcc-15" ]]; then
56+
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
57+
fi
58+
sudo apt-get update
59+
sudo apt-get install -y ${{ matrix.cc }} ${{ matrix.cxx }}
3760
38-
# Set up ccache
39-
- name: ccache
40-
uses: hendrikmuhs/ccache-action@v1.2
61+
- name: ccache
62+
uses: hendrikmuhs/ccache-action@v1.2
4163

42-
- name: Configure CMake
43-
run: >
44-
cmake --preset ${{ matrix.preset }}
45-
-S ${{ github.workspace }} -B ${{ github.workspace }}/build
46-
-D CMAKE_BUILD_TYPE=${{ matrix.build_type }}
47-
-D CMAKE_C_COMPILER_LAUNCHER=ccache
48-
-D CMAKE_CXX_COMPILER_LAUNCHER=ccache
49-
-DCMAKE_POLICY_VERSION_MINIMUM=3.5
64+
- name: Configure CMake
65+
run: >
66+
cmake --preset ${{ matrix.preset }}
67+
-S ${{ github.workspace }} -B ${{ github.workspace }}/build
68+
-D CMAKE_BUILD_TYPE=${{ matrix.build_type }}
69+
-D CMAKE_C_COMPILER=${{ matrix.cc || '' }}
70+
-D CMAKE_CXX_COMPILER=${{ matrix.cxx || '' }}
71+
-D CMAKE_C_COMPILER_LAUNCHER=ccache
72+
-D CMAKE_CXX_COMPILER_LAUNCHER=ccache
73+
-DCMAKE_POLICY_VERSION_MINIMUM=3.5
74+
${{ matrix.cc == 'gcc-15' && '-DCMAKE_CXX_FLAGS=-Wno-error=missing-declarations -Wno-error=missing-field-initializers' || '' }}
5075
51-
- name: Build
52-
run: cmake --build ${{ github.workspace }}/build --preset ${{ matrix.preset }} --config ${{ matrix.build_type }} -j 4
76+
- name: Build
77+
run: cmake --build ${{ github.workspace }}/build --preset ${{ matrix.preset }} --config ${{ matrix.build_type }} -j 4
5378

5479
- name: Archive production artifacts
55-
uses: actions/upload-artifact@v4
80+
uses: actions/upload-artifact@v6
5681
with:
5782
name: gemma-${{ matrix.os }}-${{ matrix.preset }}-${{ matrix.build_type }}-${{ matrix.cc || 'default' }}
5883
path: |
5984
${{ github.workspace }}/build/${{ matrix.build_type }}/gemma.exe
6085
${{ github.workspace }}/build/${{ matrix.build_type }}/libgemma.lib
6186
${{ github.workspace }}/build/gemma
6287
${{ github.workspace }}/build/libgemma.a
63-
- name: Archive production artifacts
64-
uses: actions/upload-artifact@v6
65-
with:
66-
name: gemma-${{ matrix.os }}-${{ matrix.preset }}-${{ matrix.build_type }}
67-
path: |
68-
${{ github.workspace }}/build/${{ matrix.build_type }}/gemma.exe
69-
${{ github.workspace }}/build/${{ matrix.build_type }}/libgemma.lib
70-
${{ github.workspace }}/build/gemma
71-
${{ github.workspace }}/build/libgemma.a
7288
7389
bazel:
7490
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)