-
Notifications
You must be signed in to change notification settings - Fork 0
62 lines (54 loc) · 1.4 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build-and-test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
compiler: [gcc, clang]
exclude:
- os: windows-latest
compiler: clang # Clang is not available on Windows by default
steps:
- name: Checkout source code
uses: actions/checkout@v3
- name: Set up build tools
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest'
run: |
sudo apt-get update
if [ "${{ matrix.compiler }}" == "gcc" ]; then
sudo apt-get install -y gcc make
else
sudo apt-get install -y clang make
fi
shell: bash
- name: Set up build tools (Windows)
if: matrix.os == 'windows-latest'
run: |
choco install make
if (${{ matrix.compiler }} == 'gcc') {
choco install mingw
}
shell: bash
- name: Configure compiler
run: |
if [ "${{ matrix.compiler }}" == "gcc" ]; then
export CC=gcc
else
export CC=clang
fi
shell: bash
- name: Build the library
run: |
mkdir -p build
make
shell: bash
- name: Run tests
run: |
make test
shell: bash