-
Notifications
You must be signed in to change notification settings - Fork 28
112 lines (96 loc) · 3.03 KB
/
cmake.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
name: GitHub actions
on:
push:
branches: ["**"]
pull_request:
branches: ["**"]
env:
BUILD_TYPE: Debug
jobs:
build:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Install vcpkg (Windows)
if: runner.os == 'Windows'
run: |
git clone https://github.com/microsoft/vcpkg
.\vcpkg\bootstrap-vcpkg.bat
.\vcpkg\vcpkg install pkgconf:x64-windows
- name: Install gmp
shell: bash
run: |
if [ "$RUNNER_OS" == "Windows" ]; then
./vcpkg/vcpkg install gmp:x64-windows
elif [ "$RUNNER_OS" == "Linux" ]; then
sudo apt-get install -y libgmp-dev
elif [ "$RUNNER_OS" == "macOS" ]; then
brew install gmp
else
echo "$RUNNER_OS not supported"
exit 1
fi
- name: Configure staq
shell: bash
run: |
if [ "$RUNNER_OS" == "Windows" ]; then
cmake -B build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \
-DCMAKE_TOOLCHAIN_FILE=./vcpkg/scripts/buildsystems/vcpkg.cmake \
-DINSTALL_SOURCES=ON
else
cmake -B build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \
-DINSTALL_SOURCES=ON
fi
- name: Build staq
shell: bash
run: |
if [ "$RUNNER_OS" == "macOS" ]; then
export CPATH=$LIBRARY_PATH:/usr/local/include
export LIBRARY_PATH=$LIBRARY_PATH:/usr/local/lib
fi
cmake --build build
- name: Install staq
shell: bash
run: |
if [ "$RUNNER_OS" == "Windows" ]; then
cmake --build build --target install
else
sudo cmake --install build
fi
- name: Configure standalone example
run: |
cmake -S examples/standalone -B examples/standalone/build
- name: Build standalone example
run: |
cmake --build examples/standalone/build --target standalone
- name: Run standalone example
shell: bash
run: |
if [ "$RUNNER_OS" == "Windows" ]; then
./examples/standalone/build/${{env.BUILD_TYPE}}/standalone.exe --version
else
./examples/standalone/build/standalone --version
fi
- name: Build unit tests
shell: bash
run: |
if [ "$RUNNER_OS" == "macOS" ]; then
export CPATH=$LIBRARY_PATH:/usr/local/include
export LIBRARY_PATH=$LIBRARY_PATH:/usr/local/lib
fi
cmake --build build --target build/unit_tests
- name: Run unit tests
run: ctest --test-dir build
- name: Uninstall
shell: bash
run: |
if [ "$RUNNER_OS" == "Windows" ]; then
cmake --build build --target uninstall
else
sudo cmake --build build --target uninstall
fi
- name: Install pystaq
run: pip3 install --user .