Skip to content

Commit d1bd74d

Browse files
committed
add CI
1 parent 06a06c7 commit d1bd74d

1 file changed

Lines changed: 112 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
name: CI for CMake
2+
3+
on:
4+
push:
5+
paths:
6+
- "**/CMakeLists.txt"
7+
- "**.cmake"
8+
- "**.cmake.in"
9+
- "**.c"
10+
- "**.h"
11+
- "**.h.in"
12+
- ".github/workflows/ci.yml"
13+
pull_request:
14+
release:
15+
types: [published]
16+
17+
env:
18+
CTEST_NO_TESTS_ACTION: "error"
19+
20+
jobs:
21+
22+
unix:
23+
24+
strategy:
25+
matrix:
26+
cc: [gcc-9, gcc-10, gcc-11, gcc-12, clang-14]
27+
os: [ubuntu-latest]
28+
include:
29+
- os: macos-latest
30+
cc: clang
31+
32+
runs-on: ${{ matrix.os }}
33+
timeout-minutes: 5
34+
35+
env:
36+
CC: ${{ matrix.cc }}
37+
38+
steps:
39+
40+
- name: install prereqs (Linux)
41+
if: runner.os == 'Linux'
42+
run: |
43+
sudo apt update
44+
sudo apt install --no-install-recommends libxt-dev libxaw7-dev libx11-dev
45+
46+
- name: install prereqs (macOS)
47+
if: runner.os == 'macOS'
48+
run: brew install libxt libxaw libx11
49+
50+
- uses: actions/checkout@v3
51+
name: Checkout source code
52+
53+
- name: CMake configure
54+
run: cmake -B build --install-prefix=${{ runner.temp }} -DCOMPILE_WARNING_AS_ERROR=ON
55+
56+
- name: CMake build
57+
run: cmake --build build --parallel
58+
59+
- name: CMake install (for examples)
60+
run: cmake --install build
61+
62+
- name: CMake configure examples
63+
run: cmake -B demos/build -S demos -DCMAKE_PREFIX_PATH:PATH=${{ runner.temp }}
64+
65+
- name: CMake build examples
66+
run: cmake --build demos/build --parallel
67+
68+
- name: Create package
69+
if: github.event.action == 'published'
70+
run: cpack --config build/CPackConfig.cmake
71+
72+
- name: Upload package
73+
if: github.event.action == 'published'
74+
uses: actions/upload-artifact@v3
75+
with:
76+
name: binary-archive
77+
path: build/package
78+
79+
80+
windows:
81+
runs-on: windows-latest
82+
timeout-minutes: 10
83+
84+
steps:
85+
- uses: actions/checkout@v3
86+
name: Checkout source code
87+
88+
- name: CMake configure
89+
run: cmake -B build --install-prefix=${{ runner.temp }}
90+
91+
- name: CMake build
92+
run: cmake --build build --parallel --config Release
93+
94+
- name: CMake install (for examples)
95+
run: cmake --install build --config Release
96+
97+
- name: CMake configure examples
98+
run: cmake -B demos/build -S demos -DCMAKE_PREFIX_PATH:PATH=${{ runner.temp }}
99+
100+
- name: CMake build examples
101+
run: cmake --build demos/build --parallel
102+
103+
- name: Create package
104+
if: github.event.action == 'published'
105+
run: cpack --config build/CPackConfig.cmake
106+
107+
- name: Upload package
108+
if: github.event.action == 'published'
109+
uses: actions/upload-artifact@v3
110+
with:
111+
name: binary-archive
112+
path: build/package

0 commit comments

Comments
 (0)