Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: refine checks and pages deploy #67

Merged
merged 4 commits into from
Mar 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ concurrency:
env:
FORCE_COLOR: 3

permissions:
contents: read
pages: write
id-token: write

jobs:
pages:
name: Deploy to GitHub Pages
Expand All @@ -26,8 +31,13 @@ jobs:
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
ref: ${{ github.head_ref }}

- name: Configure git
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"

- name: Cache
uses: actions/cache@v4
Expand All @@ -51,7 +61,7 @@ jobs:
pip install -r docs/requirements.txt

- name: Configure
run: cmake -S . --preset=x64-linux-gcc -DBUILD_TESTING=OFF -DCODE_COVERAGE=OFF
run: cmake -S . --preset=x64-linux-gcc -DUSE_SANITIZER=OFF -DBUILD_TESTING=OFF -DCODE_COVERAGE=OFF

- name: Build Docs
run: cmake --build out/build/x64-linux-gcc --target ss-cpp-docs
Expand Down
24 changes: 13 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ jobs:

checks:
runs-on: ${{ matrix.presets.os.name }}
timeout-minutes: 15
permissions:
actions: read
contents: read
Expand All @@ -87,16 +88,13 @@ jobs:
- {os: {name: ubuntu-latest, type: linux}, compiler: {name: gcc-11, type: gcc}}
- {os: {name: ubuntu-latest, type: linux}, compiler: {name: llvm, type: llvm}}
- {os: {name: ubuntu-latest, type: mingw-dynamic-linux}, compiler: {name: mingw, type: mingw}}
- {os: {name: ubuntu-latest, type: mingw-static-linux}, compiler: {name: mingw, type: mingw}}
- {os: {name: macos-latest, type: osx}, compiler: {name: applellvm, type: llvm}}
- {os: {name: macos-latest, type: osx}, compiler: {name: llvm, type: llvm}}
# setup-cpp doesn't support mingw on macOS yet
# - {os: {name: macos-latest, type: mingw-dynamic-darwin}, compiler: {name: mingw, type: mingw}}
# - {os: {name: macos-latest, type: mingw-static-darwin}, compiler: {name: mingw, type: mingw}}
- {os: {name: windows-latest, type: windows}, compiler: {name: msvc, type: msvc}}
- {os: {name: windows-latest, type: windows}, compiler: {name: llvm, type: llvm}}
- {os: {name: windows-latest, type: mingw-dynamic-windows}, compiler: {name: mingw, type: mingw}}
- {os: {name: windows-latest, type: mingw-static-windows}, compiler: {name: mingw, type: mingw}}
arch:
- {name: x64, type: x64}
vcpkg:
Expand All @@ -117,9 +115,9 @@ jobs:
~/.cache/vcpkg
~/AppData/Local/vcpkg
key: |
${{ matrix.arch.name }}-${{ matrix.presets.os.type }}-${{ matrix.presets.compiler.name }}-${{ matrix.vcpkg }}-${{ hashFiles('./vcpkg.json') }}
${{ matrix.arch.name }}-${{ matrix.presets.os.type }}-${{ matrix.presets.compiler.name }}-${{ hashFiles('./vcpkg.json') }}-${{ matrix.vcpkg }}
restore-keys: |
${{ matrix.arch.name }}-${{ matrix.presets.os.type }}-${{ matrix.presets.compiler.name }}-${{ matrix.vcpkg }}-${{ hashFiles('./vcpkg.json') }}
${{ matrix.arch.name }}-${{ matrix.presets.os.type }}-${{ matrix.presets.compiler.name }}-${{ hashFiles('./vcpkg.json') }}-

- uses: aminya/setup-cpp@v1
with:
Expand All @@ -130,15 +128,15 @@ jobs:
vcpkg: ${{ matrix.vcpkg }}
ccache: true
python: true
opencppcoverage: true
opencppcoverage: ${{ contains(matrix.presets.os.type, 'windows' )}}

- name: Gcc Lcov
- name: Lcov for coverage
if: contains(matrix.presets.compiler.type, 'gcc') && contains(matrix.presets.os.type, 'linux')
run: |
sudo apt-get update
sudo apt-get install lcov

- name: Gcovr
- name: Gcovr for coverage
if: contains(matrix.presets.compiler.type, 'mingw') && contains(matrix.presets.os.type, 'mingw')
run: |
pip install gcovr
Expand All @@ -156,7 +154,11 @@ jobs:

- name: Configure CMake
run: |
cmake -S . --preset=${{ matrix.arch.type }}-${{ matrix.presets.os.type }}-${{ matrix.presets.compiler.type }} -DCMAKE_BUILD_TYPE=Debug -DCODE_COVERAGE=ON -DBUILD_TESTING=ON -DCMAKE_VERBOSE_MAKEFILE=TRUE
cmake -S . --preset=${{ matrix.arch.type }}-${{ matrix.presets.os.type }}-${{ matrix.presets.compiler.type }} -DCMAKE_BUILD_TYPE=Debug -DCODE_COVERAGE=ON -DBUILD_TESTING=ON ${{ matrix.presets.os.type == 'linux' && '-DUSE_SANITIZER=OFF' || '' }}

- name: Build
run: |
cmake --build out/build/${{ matrix.arch.type }}-${{ matrix.presets.os.type }}-${{ matrix.presets.compiler.type }} --target all

- name: Coverage
run: |
Expand All @@ -167,8 +169,8 @@ jobs:
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: out/build/${{ matrix.arch.type }}-${{ matrix.presets.os.type }}-${{ matrix.presets.compiler.type }}/code_coverage/coverage.xml
flags: ${{ matrix.arch.type }}-${{ matrix.presets.os.type }}-${{ matrix.presets.compiler.type }}
name: ${{ matrix.arch.type }}-${{ matrix.presets.os.type }}-${{ matrix.presets.compiler.type }}-coverage
flags: ${{ matrix.arch.type }}-${{ matrix.presets.os.type }}-${{ matrix.presets.compiler.name }}-${{ matrix.presets.compiler.type }}-${{ matrix.vcpkg }}
name: ${{ matrix.arch.type }}-${{ matrix.presets.os.type }}-${{ matrix.presets.compiler.name }}-${{ matrix.presets.compiler.type }}-${{ matrix.vcpkg }}-coverage

pass:
if: always()
Expand Down
3 changes: 2 additions & 1 deletion cmake/presets/triplets/x64-mingw-dynamic.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
],
"cacheVariables": {
"VCPKG_TARGET_TRIPLET": "x64-mingw-dynamic",
"VCPKG_HOST_TRIPLET": "x64-mingw-dynamic"
"VCPKG_HOST_TRIPLET": "x64-mingw-dynamic",
"USE_SANITIZER": "OFF"
}
}
]
Expand Down
3 changes: 2 additions & 1 deletion cmake/presets/triplets/x64-mingw-static.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
],
"cacheVariables": {
"VCPKG_TARGET_TRIPLET": "x64-mingw-static",
"VCPKG_HOST_TRIPLET": "x64-mingw-static"
"VCPKG_HOST_TRIPLET": "x64-mingw-static",
"USE_SANITIZER": "OFF"
}
}
]
Expand Down
5 changes: 1 addition & 4 deletions cmake/presets/x64-mingw-dynamic-linux-mingw.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@
"linux",
"mingw",
"x64-mingw-dynamic"
],
"cacheVariables": {
"USE_SANITIZER": "FALSE"
}
]
}
],
"buildPresets": [
Expand Down
6 changes: 2 additions & 4 deletions cmake/presets/x64-mingw-dynamic-windows-mingw.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,8 @@
"windows",
"mingw",
"x64-mingw-dynamic"
],
"cacheVariables": {
"USE_SANITIZER": "FALSE"
}
]

}
],
"buildPresets": [
Expand Down
5 changes: 1 addition & 4 deletions cmake/presets/x64-mingw-static-linux-mingw.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@
"linux",
"mingw",
"x64-mingw-static"
],
"cacheVariables": {
"USE_SANITIZER": "FALSE"
}
]
}
],
"buildPresets": [
Expand Down
5 changes: 1 addition & 4 deletions cmake/presets/x64-mingw-static-windows-mingw.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@
"windows",
"mingw",
"x64-mingw-static"
],
"cacheVariables": {
"USE_SANITIZER": "FALSE"
}
]
}
],
"buildPresets": [
Expand Down
2 changes: 1 addition & 1 deletion cmake/presets/x64-windows-llvm.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"x64-windows"
],
"cacheVariables": {
"USE_SANITIZER": "FALSE"
"USE_SANITIZER": "OFF"
}
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ concurrency:
env:
FORCE_COLOR: 3

permissions:
contents: read
pages: write
id-token: write

jobs:
pages:
name: Deploy to GitHub Pages
Expand All @@ -26,8 +31,13 @@ jobs:
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: {{ '${{ secrets.GITHUB_TOKEN }}' }}
ref: {{ '${{ github.head_ref }}' }}

- name: Configure git
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"

- name: Cache
uses: actions/cache@v4
Expand All @@ -51,7 +61,7 @@ jobs:
pip install -r docs/requirements.txt

- name: Configure
run: cmake -S . --preset=x64-linux-gcc -DBUILD_TESTING=OFF -DCODE_COVERAGE=OFF
run: cmake -S . --preset=x64-linux-gcc -DUSE_SANITIZER=OFF -DBUILD_TESTING=OFF -DCODE_COVERAGE=OFF

- name: Build Docs
run: cmake --build out/build/x64-linux-gcc --target {{ repo_name }}-docs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ jobs:

checks:
runs-on: ${{ matrix.presets.os.name }}
timeout-minutes: 15
permissions:
actions: read
contents: read
Expand All @@ -87,16 +88,13 @@ jobs:
- {os: {name: ubuntu-latest, type: linux}, compiler: {name: gcc-11, type: gcc}}
- {os: {name: ubuntu-latest, type: linux}, compiler: {name: llvm, type: llvm}}
- {os: {name: ubuntu-latest, type: mingw-dynamic-linux}, compiler: {name: mingw, type: mingw}}
- {os: {name: ubuntu-latest, type: mingw-static-linux}, compiler: {name: mingw, type: mingw}}
- {os: {name: macos-latest, type: osx}, compiler: {name: applellvm, type: llvm}}
- {os: {name: macos-latest, type: osx}, compiler: {name: llvm, type: llvm}}
# setup-cpp doesn't support mingw on macOS yet
# - {os: {name: macos-latest, type: mingw-dynamic-darwin}, compiler: {name: mingw, type: mingw}}
# - {os: {name: macos-latest, type: mingw-static-darwin}, compiler: {name: mingw, type: mingw}}
- {os: {name: windows-latest, type: windows}, compiler: {name: msvc, type: msvc}}
- {os: {name: windows-latest, type: windows}, compiler: {name: llvm, type: llvm}}
- {os: {name: windows-latest, type: mingw-dynamic-windows}, compiler: {name: mingw, type: mingw}}
- {os: {name: windows-latest, type: mingw-static-windows}, compiler: {name: mingw, type: mingw}}
arch:
- {name: x64, type: x64}
vcpkg:
Expand All @@ -117,9 +115,9 @@ jobs:
~/.cache/vcpkg
~/AppData/Local/vcpkg
key: |
${{ matrix.arch.name }}-${{ matrix.presets.os.type }}-${{ matrix.presets.compiler.name }}-${{ matrix.vcpkg }}-${{ hashFiles('./vcpkg.json') }}
${{ matrix.arch.name }}-${{ matrix.presets.os.type }}-${{ matrix.presets.compiler.name }}-${{ hashFiles('./vcpkg.json') }}-${{ matrix.vcpkg }}
restore-keys: |
${{ matrix.arch.name }}-${{ matrix.presets.os.type }}-${{ matrix.presets.compiler.name }}-${{ matrix.vcpkg }}-${{ hashFiles('./vcpkg.json') }}
${{ matrix.arch.name }}-${{ matrix.presets.os.type }}-${{ matrix.presets.compiler.name }}-${{ hashFiles('./vcpkg.json') }}-

- uses: aminya/setup-cpp@v1
with:
Expand All @@ -130,15 +128,15 @@ jobs:
vcpkg: ${{ matrix.vcpkg }}
ccache: true
python: true
opencppcoverage: true
opencppcoverage: ${{ contains(matrix.presets.os.type, 'windows' )}}

- name: Gcc Lcov
- name: Lcov for coverage
if: contains(matrix.presets.compiler.type, 'gcc') && contains(matrix.presets.os.type, 'linux')
run: |
sudo apt-get update
sudo apt-get install lcov

- name: Gcovr
- name: Gcovr for coverage
if: contains(matrix.presets.compiler.type, 'mingw') && contains(matrix.presets.os.type, 'mingw')
run: |
pip install gcovr
Expand All @@ -156,7 +154,11 @@ jobs:

- name: Configure CMake
run: |
cmake -S . --preset=${{ matrix.arch.type }}-${{ matrix.presets.os.type }}-${{ matrix.presets.compiler.type }} -DCMAKE_BUILD_TYPE=Debug -DCODE_COVERAGE=ON -DBUILD_TESTING=ON -DCMAKE_VERBOSE_MAKEFILE=TRUE
cmake -S . --preset=${{ matrix.arch.type }}-${{ matrix.presets.os.type }}-${{ matrix.presets.compiler.type }} -DCMAKE_BUILD_TYPE=Debug -DCODE_COVERAGE=ON -DBUILD_TESTING=ON ${{ matrix.presets.os.type == 'linux' && '-DUSE_SANITIZER=OFF' || '' }}

- name: Build
run: |
cmake --build out/build/${{ matrix.arch.type }}-${{ matrix.presets.os.type }}-${{ matrix.presets.compiler.type }} --target all

- name: Coverage
run: |
Expand All @@ -167,8 +169,8 @@ jobs:
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: out/build/${{ matrix.arch.type }}-${{ matrix.presets.os.type }}-${{ matrix.presets.compiler.type }}/code_coverage/coverage.xml
flags: ${{ matrix.arch.type }}-${{ matrix.presets.os.type }}-${{ matrix.presets.compiler.type }}
name: ${{ matrix.arch.type }}-${{ matrix.presets.os.type }}-${{ matrix.presets.compiler.type }}-coverage
flags: ${{ matrix.arch.type }}-${{ matrix.presets.os.type }}-${{ matrix.presets.compiler.name }}-${{ matrix.presets.compiler.type }}-${{ matrix.vcpkg }}
name: ${{ matrix.arch.type }}-${{ matrix.presets.os.type }}-${{ matrix.presets.compiler.name }}-${{ matrix.presets.compiler.type }}-${{ matrix.vcpkg }}-coverage

pass:
if: always()
Expand Down
3 changes: 2 additions & 1 deletion template/cmake/presets/triplets/x64-mingw-dynamic.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
],
"cacheVariables": {
"VCPKG_TARGET_TRIPLET": "x64-mingw-dynamic",
"VCPKG_HOST_TRIPLET": "x64-mingw-dynamic"
"VCPKG_HOST_TRIPLET": "x64-mingw-dynamic",
"USE_SANITIZER": "OFF"
}
}
]
Expand Down
3 changes: 2 additions & 1 deletion template/cmake/presets/triplets/x64-mingw-static.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
],
"cacheVariables": {
"VCPKG_TARGET_TRIPLET": "x64-mingw-static",
"VCPKG_HOST_TRIPLET": "x64-mingw-static"
"VCPKG_HOST_TRIPLET": "x64-mingw-static",
"USE_SANITIZER": "OFF"
}
}
]
Expand Down
5 changes: 1 addition & 4 deletions template/cmake/presets/x64-mingw-dynamic-linux-mingw.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@
"linux",
"mingw",
"x64-mingw-dynamic"
],
"cacheVariables": {
"USE_SANITIZER": "FALSE"
}
]
}
],
"buildPresets": [
Expand Down
6 changes: 2 additions & 4 deletions template/cmake/presets/x64-mingw-dynamic-windows-mingw.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,8 @@
"windows",
"mingw",
"x64-mingw-dynamic"
],
"cacheVariables": {
"USE_SANITIZER": "FALSE"
}
]

}
],
"buildPresets": [
Expand Down
5 changes: 1 addition & 4 deletions template/cmake/presets/x64-mingw-static-linux-mingw.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@
"linux",
"mingw",
"x64-mingw-static"
],
"cacheVariables": {
"USE_SANITIZER": "FALSE"
}
]
}
],
"buildPresets": [
Expand Down
5 changes: 1 addition & 4 deletions template/cmake/presets/x64-mingw-static-windows-mingw.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@
"windows",
"mingw",
"x64-mingw-static"
],
"cacheVariables": {
"USE_SANITIZER": "FALSE"
}
]
}
],
"buildPresets": [
Expand Down
2 changes: 1 addition & 1 deletion template/cmake/presets/x64-windows-llvm.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"x64-windows"
],
"cacheVariables": {
"USE_SANITIZER": "FALSE"
"USE_SANITIZER": "OFF"
}
}
],
Expand Down
Loading