@@ -13,128 +13,99 @@ env:
13
13
CTEST_PARALLEL_LEVEL : 2
14
14
15
15
jobs :
16
- # ###################
17
- # Linux / macOS
18
- # ###################
19
-
20
- Unix :
16
+ Build :
21
17
name : ${{ matrix.name }} (${{ matrix.config }})
22
18
runs-on : ${{ matrix.os }}
23
19
strategy :
24
20
fail-fast : false
25
21
matrix :
26
- os : [ubuntu-20.04 , macos-latest]
22
+ os : [ubuntu-latest , macos-latest, windows -latest]
27
23
config : [Debug, Release]
28
24
include :
29
25
- os : macos-latest
30
26
name : macOS
31
- - os : ubuntu-20.04
27
+ - os : ubuntu-latest
32
28
name : Linux
29
+ - os : windows-latest
30
+ name : Windows
33
31
steps :
34
32
- name : Checkout repository
35
- uses : actions/checkout@v3
33
+ uses : actions/checkout@v4.0.0
36
34
with :
37
35
fetch-depth : 10
38
36
39
37
- name : Dependencies (Linux)
40
38
if : runner.os == 'Linux'
41
39
run : |
42
- sudo apt-get update
43
- sudo apt-get install ccache
40
+ sudo apt-get install ccache
41
+ echo 'CACHE_PATH=~/.cache/ccache' >> "$GITHUB_ENV"
44
42
45
43
- name : Dependencies (macOS)
46
44
if : runner.os == 'macOS'
47
- run : brew install ccache
45
+ run : |
46
+ brew install ccache
47
+ echo 'CACHE_PATH=~/Library/Caches/ccache' >> "$GITHUB_ENV"
48
+
49
+ - name : Dependencies (Windows)
50
+ if : runner.os == 'Windows'
51
+ run : |
52
+ choco install ccache
53
+ "CACHE_PATH=${env:LOCALAPPDATA}\ccache" | Out-File -FilePath $env:GITHUB_ENV -Append
54
+
55
+ # Install Ninja (only needed on Windows)
56
+ - name : Install Ninja
57
+ if : runner.os == 'Windows'
58
+ uses : seanmiddleditch/gha-setup-ninja@master
59
+
60
+ - name : Get number of CPU cores
61
+
62
+ id : cpu-cores
48
63
49
64
- name : Cache Build
50
65
id : cache-build
51
- uses : actions/cache@v1
66
+ uses : actions/cache@v4
52
67
with :
53
- path : ~/.ccache
68
+ path : ${{ env.CACHE_PATH }}
54
69
key : ${{ runner.os }}-${{ matrix.config }}-cache
55
70
56
71
- name : Prepare ccache
57
72
run : |
58
73
ccache --max-size=1.0G
59
- ccache -V && ccache --show-stats && ccache --zero-stats
74
+ ccache -V && ccache --show-config
75
+ ccache --show-stats && ccache --zero-stats
60
76
61
- - name : Configure
77
+ - name : Configure (Linux/macOS)
78
+ if : runner.os != 'Windows'
62
79
run : |
63
80
mkdir -p build
64
81
cd build
65
82
cmake .. \
66
- -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
67
83
-DFINITE_DIFF_BUILD_UNIT_TESTS=ON \
68
84
-DCMAKE_BUILD_TYPE=${{ matrix.config }}
69
85
70
- - name : Build
71
- run : cd build; make -j2; ccache --show-stats
72
-
73
- - name : Tests
74
- run : cd build; ctest --verbose
75
-
76
- # ###################
77
- # Windows
78
- # ###################
79
-
80
- Windows :
81
- name : ${{ matrix.name }} (${{ matrix.config }})
82
- runs-on : windows-2019
83
- env :
84
- CC : cl.exe
85
- CXX : cl.exe
86
- SCCACHE_IDLE_TIMEOUT : " 12000"
87
- strategy :
88
- fail-fast : false
89
- matrix :
90
- config : [Debug, Release]
91
- include :
92
- - os : windows-2019
93
- name : Windows
94
- steps :
95
- - name : Checkout repository
96
- uses : actions/checkout@v3
97
- with :
98
- fetch-depth : 10
99
- - uses : seanmiddleditch/gha-setup-ninja@master
100
-
101
- # https://github.com/actions/cache/issues/101
102
- - name : Set env
103
- run : |
104
- echo "appdata=$env:LOCALAPPDATA" >> ${env:GITHUB_ENV}
105
-
106
- - name : Cache build
107
- id : cache-build
108
- uses : actions/cache@v2
109
- with :
110
- path : ${{ env.appdata }}\Mozilla\sccache
111
- key : ${{ runner.os }}-${{ matrix.config }}-cache-${{ github.sha }}
112
- restore-keys : ${{ runner.os }}-${{ matrix.config }}-cache
113
-
114
- - name : Prepare sccache
115
- run : |
116
- iwr -useb 'https://raw.githubusercontent.com/scoopinstaller/install/master/install.ps1' -outfile 'install.ps1'
117
- .\install.ps1 -RunAsAdmin
118
- scoop install sccache --global
119
- # Scoop modifies the PATH so we make it available for the next steps of the job
120
- echo "${env:PATH}" >> ${env:GITHUB_PATH}
121
-
122
- # We run configure + build in the same step, since they both need to call VsDevCmd
123
- # Also, cmd uses ^ to break commands into multiple lines (in powershell this is `)
124
- - name : Configure and build
86
+ - name : Configure (Windows)
87
+ if : runner.os == 'Windows'
125
88
shell : cmd
126
89
run : |
127
- call "C:\Program Files (x86) \Microsoft Visual Studio\2019 \Enterprise\Common7\Tools\VsDevCmd.bat" -arch=x64
90
+ call "C:\Program Files\Microsoft Visual Studio\2022 \Enterprise\Common7\Tools\VsDevCmd.bat" -arch=x64
128
91
cmake -G Ninja ^
129
- -DCMAKE_CXX_COMPILER_LAUNCHER=sccache ^
130
- -DCMAKE_BUILD_TYPE=${{ matrix.config }} ^
131
92
-DFINITE_DIFF_BUILD_UNIT_TESTS=ON ^
93
+ -DCMAKE_BUILD_TYPE=${{ matrix.config }} ^
132
94
-B build ^
133
95
-S .
134
- cd build
135
- ninja -j1
136
96
137
- - name : Tests
97
+ - name : Build (Linux/macOS)
98
+ if : runner.os != 'Windows'
138
99
run : |
139
- cd build
140
- ctest --verbose --output-on-failure
100
+ cmake --build build -j ${{ steps.cpu-cores.outputs.count }}
101
+ ccache --show-stats
102
+
103
+ - name : Build (Windows)
104
+ if : runner.os == 'Windows'
105
+ shell : cmd
106
+ run : |
107
+ call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\VsDevCmd.bat" -arch=x64
108
+ cmake --build build -j ${{ steps.cpu-cores.outputs.count }} && ccache --show-stats
109
+
110
+ - name : Tests
111
+ run : cd build; ctest --verbose -j ${{ steps.cpu-cores.outputs.count }}
0 commit comments