Skip to content

Commit 3f7868a

Browse files
committed
Add basic GitHub actions
Signed-off-by: Cristian Le <[email protected]>
1 parent f311295 commit 3f7868a

File tree

2 files changed

+82
-0
lines changed

2 files changed

+82
-0
lines changed

.github/workflows/ci.yaml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: CI
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
branches: [ master ]
7+
push:
8+
branches: [ master ]
9+
10+
permissions:
11+
contents: read
12+
13+
concurrency:
14+
group: ${{ github.workflow }}-${{ github.ref }}
15+
cancel-in-progress: true
16+
17+
jobs:
18+
tests:
19+
uses: ./.github/workflows/step_test.yaml
20+
21+
pass:
22+
needs: [ tests ]
23+
runs-on: ubuntu-latest
24+
steps:
25+
- name: Check all CI jobs
26+
uses: re-actors/alls-green@release/v1
27+
with:
28+
jobs: ${{ toJSON(needs) }}
29+
if: always()

.github/workflows/step_test.yaml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: test
2+
run-name: Run tests
3+
4+
on:
5+
workflow_call:
6+
7+
permissions:
8+
contents: read
9+
10+
jobs:
11+
tests:
12+
name: Check ${{ matrix.toolchain }}
13+
runs-on: ${{ matrix.os || 'ubuntu-latest' }}
14+
container: ${{ !matrix.os && 'ghcr.io/lecrisut/dev-env:main' || '' }}
15+
needs: [ pre-commit ]
16+
continue-on-error: ${{ matrix.experimental || false }}
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
toolchain: [ gcc, llvm, intel, windows, macos ]
21+
include:
22+
- os: windows-latest
23+
toolchain: windows
24+
- os: macos-latest
25+
toolchain: macos
26+
steps:
27+
- name: Enable msvc toolchain on windows
28+
uses: ilammy/msvc-dev-cmd@v1
29+
if: contains(matrix.os, 'windows')
30+
- name: Activate Intel compilers
31+
# Not elegant, it will propagate all environment variable.
32+
# Intel does not provide a way to output the environment variables to a file
33+
# Note: PATH needs to be exported to GITHUB_PATH otherwise it can be overwritten
34+
run: |
35+
source /opt/intel/oneapi/setvars.sh
36+
printenv >> $GITHUB_ENV
37+
echo $PATH >> $GITHUB_PATH
38+
if: matrix.toolchain == 'intel'
39+
- uses: actions/checkout@v4
40+
- uses: lukka/get-cmake@latest
41+
- name: Run CMake configuration for ${{ matrix.toolchain }} toolchain
42+
uses: lukka/[email protected]
43+
with:
44+
workflowPreset: "${{ matrix.toolchain }}-ci"
45+
pass:
46+
needs: [ tests ]
47+
runs-on: ubuntu-latest
48+
steps:
49+
- name: Check test jobs
50+
uses: re-actors/alls-green@release/v1
51+
with:
52+
jobs: ${{ toJSON(needs) }}
53+
if: always()

0 commit comments

Comments
 (0)