| 1 |
name: Build and Test |
| 2 |
|
| 3 |
on: |
| 4 |
- pull_request |
| 5 |
- push |
| 6 |
|
| 7 |
jobs: |
| 8 |
# Linux builds. |
| 9 |
# |
| 10 |
# gcc sometimes warns (e.g. about potentially uninitialized variables) only |
| 11 |
# when some optimizations are enabled. So we build Debug as well as Release |
| 12 |
# on Linux. The Debug build also collects and uploads test coverage. |
| 13 |
linux-debug: |
| 14 |
runs-on: ubuntu-latest |
| 15 |
steps: |
| 16 |
- name: Checkout |
| 17 |
uses: actions/checkout@v4 |
| 18 |
- name: Configure |
| 19 |
run: CFLAGS='--coverage -Werror' cmake -DCMAKE_BUILD_TYPE=Debug -G 'Unix Makefiles' . |
| 20 |
- name: Build |
| 21 |
run: make VERBOSE=1 |
| 22 |
- name: Test |
| 23 |
run: python3 ./scripts/run-tests.py |
| 24 |
- name: Create coverage report |
| 25 |
run: | |
| 26 |
sudo apt-get install -y lcov |
| 27 |
lcov --directory . --capture --branch-coverage --output-file coverage.info |
| 28 |
lcov --list coverage.info --branch-coverage |
| 29 |
- name: Upload coverage report |
| 30 |
uses: codecov/codecov-action@v4 |
| 31 |
with: |
| 32 |
token: ${{ secrets.CODECOV_TOKEN }} |
| 33 |
|
| 34 |
linux-release: |
| 35 |
runs-on: ubuntu-latest |
| 36 |
steps: |
| 37 |
- name: Checkout |
| 38 |
uses: actions/checkout@v4 |
| 39 |
- name: Configure |
| 40 |
run: CFLAGS='--coverage -Werror' cmake -DCMAKE_BUILD_TYPE=Release -G 'Unix Makefiles' . |
| 41 |
- name: Build |
| 42 |
run: make VERBOSE=1 |
| 43 |
- name: Test |
| 44 |
run: python3 ./scripts/run-tests.py |
| 45 |
|
| 46 |
# Windows builds. |
| 47 |
# |
| 48 |
# We do both 32 and 64-bit builds. Also note 32-bit does Debug build while |
| 49 |
# 64-bit one does Release build. (Full matrix would likely be an overkill.) |
| 50 |
windows-32-debug: |
| 51 |
runs-on: windows-latest |
| 52 |
steps: |
| 53 |
- name: Checkout |
| 54 |
uses: actions/checkout@v4 |
| 55 |
- name: Dev command prompt |
| 56 |
uses: ilammy/msvc-dev-cmd@v1 |
| 57 |
with: |
| 58 |
arch: x86 |
| 59 |
- name: Configure |
| 60 |
run: cmake -DCMAKE_BUILD_TYPE=Debug -G "NMake Makefiles" . |
| 61 |
- name: Build |
| 62 |
run: nmake |
| 63 |
- name: Test |
| 64 |
run: python .\scripts\run-tests.py |
| 65 |
|
| 66 |
windows-64-release: |
| 67 |
runs-on: windows-latest |
| 68 |
steps: |
| 69 |
- name: Checkout |
| 70 |
uses: actions/checkout@v4 |
| 71 |
- name: Dev command prompt |
| 72 |
uses: ilammy/msvc-dev-cmd@v1 |
| 73 |
with: |
| 74 |
arch: x64 |
| 75 |
- name: Configure |
| 76 |
run: cmake -DCMAKE_BUILD_TYPE=Release -G "NMake Makefiles" . |
| 77 |
- name: Build |
| 78 |
run: nmake |
| 79 |
- name: Test |
| 80 |
run: python .\scripts\run-tests.py |