Skip to content

Commit 0fab2c3

Browse files
authored
chore(ci): modernize Github Actions (#51)
1 parent ccb7c50 commit 0fab2c3

6 files changed

Lines changed: 34 additions & 31 deletions

File tree

.github/workflows/macos.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,20 @@ jobs:
1717
if: "!contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, '[ci skip]')"
1818

1919
steps:
20-
- uses: actions/checkout@v2
20+
- uses: actions/checkout@v4
2121

2222
- name: cache dependencies
23-
uses: actions/cache@v2
23+
uses: actions/cache@v4
2424
id: cache
2525
with:
2626
path: ${{ github.workspace }}/${{ env.INSTALL_LOCATION }}
27-
key: ${{ runner.os }}-dependencies
27+
key: ${{ runner.os }}-dependencies-${{ hashFiles('CMakeLists.txt') }}
2828

2929
- name: install GoogleTest
30-
if: ${{ steps.cache.output.cache-hit != 'true' }}
30+
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
3131
run: |
3232
cd ..
33-
git clone https://github.com/google/googletest.git --branch release-1.10.0
33+
git clone https://github.com/google/googletest.git --branch v1.17.0
3434
cd googletest
3535
cmake -Bbuild -DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/$INSTALL_LOCATION
3636
cmake --build build --config Release

.github/workflows/release.yml

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -44,32 +44,35 @@ jobs:
4444
- name: set version name (Windows)
4545
id: version_win
4646
if: ${{ runner.os == 'Windows' }}
47+
shell: pwsh
4748
run: |
4849
$TAG = (${env:GITHUB_REF} -replace 'refs/tags/', '')
49-
echo "::set-output name=name::$TAG"
50+
echo "name=$TAG" >> ${env:GITHUB_OUTPUT}
5051
5152
- name: set version name
5253
id: version
5354
if: ${{ runner.os != 'Windows' }}
54-
run: echo ::set-output name=name::${GITHUB_REF#refs/tags/}
55+
run: |
56+
TAG=${GITHUB_REF#refs/tags/}
57+
echo "name=$TAG" >> "$GITHUB_OUTPUT"
5558
5659
- name: Checkout
57-
uses: actions/checkout@v2
60+
uses: actions/checkout@v4
5861
with:
5962
submodules: recursive
6063

6164
- name: cache dependencies
62-
uses: actions/cache@v2
65+
uses: actions/cache@v4
6366
id: cache
6467
with:
6568
path: ${{ github.HOME }}/.local
66-
key: ${{ runner.os }}-dependencies
69+
key: ${{ runner.os }}-dependencies-${{ hashFiles('CMakeLists.txt') }}
6770

6871
- name: install GoogleTest
69-
if: ${{ steps.cache.output.cache-hit != 'true' }}
72+
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
7073
run: |
7174
cd ..
72-
git clone https://github.com/google/googletest.git --branch release-1.10.0
75+
git clone https://github.com/google/googletest.git --branch v1.17.0
7376
cd googletest
7477
cmake -Bbuild -DCMAKE_INSTALL_PREFIX="$HOME/.local" -Dgtest_force_shared_crt=1
7578
cmake --build build --config Release
@@ -104,14 +107,14 @@ jobs:
104107
tar -cvzf $HOME/artifact.tar.gz .
105108
106109
- name: upload artifacts
107-
uses: actions/upload-artifact@v2
110+
uses: actions/upload-artifact@v4
108111
if: ${{ runner.os == 'Windows' }}
109112
with:
110113
name: ${{ runner.os }}-${{ steps.version_win.outputs.name }}
111114
path: '~/artifact.*'
112115

113116
- name: upload artifacts
114-
uses: actions/upload-artifact@v2
117+
uses: actions/upload-artifact@v4
115118
if: ${{ runner.os != 'Windows' }}
116119
with:
117120
name: ${{ runner.os }}-${{ steps.version.outputs.name }}
@@ -141,7 +144,7 @@ jobs:
141144
prerelease: false
142145

143146
- name: download artifact
144-
uses: actions/download-artifact@v2
147+
uses: actions/download-artifact@v4
145148
with:
146149
name: "Linux-${{ steps.version.outputs.name }}"
147150
path: ./
@@ -157,7 +160,7 @@ jobs:
157160
asset_content_type: application/x-tar
158161

159162
- name: download artifact
160-
uses: actions/download-artifact@v2
163+
uses: actions/download-artifact@v4
161164
with:
162165
name: "Windows-${{ steps.version.outputs.name }}"
163166
path: ./
@@ -173,7 +176,7 @@ jobs:
173176
asset_content_type: application/zip
174177

175178
- name: download artifact
176-
uses: actions/download-artifact@v2
179+
uses: actions/download-artifact@v4
177180
with:
178181
name: "macOS-${{ steps.version.outputs.name }}"
179182
path: ./

.github/workflows/ubuntu.yml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,20 @@ jobs:
1717
if: "!contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, '[ci skip]')"
1818

1919
steps:
20-
- uses: actions/checkout@v2
20+
- uses: actions/checkout@v4
2121

2222
- name: cache dependencies
23-
uses: actions/cache@v2
23+
uses: actions/cache@v4
2424
id: cache
2525
with:
2626
path: ${{ github.workspace }}/${{ env.INSTALL_LOCATION }}
27-
key: ${{ runner.os }}-dependencies
27+
key: ${{ runner.os }}-dependencies-${{ hashFiles('CMakeLists.txt') }}
2828

2929
- name: install GoogleTest
30-
if: ${{ steps.cache.output.cache-hit != 'true' }}
30+
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
3131
run: |
3232
cd ..
33-
git clone https://github.com/google/googletest.git --branch release-1.10.0
33+
git clone https://github.com/google/googletest.git --branch v1.17.0
3434
cd googletest
3535
cmake -Bbuild -DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/$INSTALL_LOCATION
3636
cmake --build build --config Release
@@ -47,8 +47,10 @@ jobs:
4747
cd build
4848
ctest -C $BUILD_TYPE -VV
4949
50-
- name: Code coverage using Codecov
51-
run: bash <(curl -s https://codecov.io/bash)
50+
- name: Upload coverage to Codecov
51+
uses: codecov/codecov-action@v4
52+
with:
53+
fail_ci_if_error: false
5254

5355
- name: install project
5456
run: cmake --build build --target install --config Release

.github/workflows/windows.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,20 @@ jobs:
1717
if: "!contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, '[ci skip]')"
1818

1919
steps:
20-
- uses: actions/checkout@v2
20+
- uses: actions/checkout@v4
2121

2222
- name: cache dependencies
23-
uses: actions/cache@v2
23+
uses: actions/cache@v4
2424
id: cache
2525
with:
2626
path: ${{env.INSTALL_LOCATION}}
27-
key: ${{runner.os}}-dependencies
27+
key: ${{ runner.os }}-dependencies-${{ hashFiles('CMakeLists.txt') }}
2828

2929
- name: install GoogleTest
3030
if: ${{steps.cache.output.cache-hit != 'true'}}
3131
run: |
3232
cd ..
33-
git clone https://github.com/google/googletest.git --branch release-1.10.0
33+
git clone https://github.com/google/googletest.git --branch v1.17.0
3434
cd googletest
3535
cmake -Bbuild -DCMAKE_INSTALL_PREFIX="$HOME/$env:INSTALL_LOCATION" -Dgtest_force_shared_crt=1
3636
cmake --build build --config Release

cmake/Utils.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#
44

55
function(verbose_message content)
6-
if(${PROJECT_NAME}_VERBOSE_OUTPUT)
6+
if(${CMAKE_PROJECT_NAME}_VERBOSE_OUTPUT)
77
message(STATUS ${content})
88
endif()
99
endfunction()

test/CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ cmake_minimum_required(VERSION 3.15)
44
# Project details
55
#
66

7-
set(${CMAKE_PROJECT_NAME}Tests_VERBOSE_OUTPUT ${PROJECT_NAME}_VERBOSE_OUTPUT)
8-
97
project(
108
${CMAKE_PROJECT_NAME}Tests
119
LANGUAGES CXX

0 commit comments

Comments
 (0)