forked from StaticScript/StaticScript
-
Notifications
You must be signed in to change notification settings - Fork 0
111 lines (108 loc) · 4.03 KB
/
build.yml
File metadata and controls
111 lines (108 loc) · 4.03 KB
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
name: Build
on:
push:
branches:
- '**'
paths-ignore:
- 'README.md'
- 'README-zh_CN.md'
- 'ROADMAP-zh_CN.md'
- 'LICENSE'
tags-ignore:
- '**'
pull_request:
branches:
- '**'
paths-ignore:
- 'README.md'
- 'README-zh_CN.md'
- 'ROADMAP-zh_CN.md'
- 'LICENSE'
tags-ignore:
- '**'
jobs:
build_and_test_on_linux:
name: Build and Test on Linux
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-18.04, ubuntu-20.04 ]
compiler:
- { cc: gcc, cxx: g++ }
- { cc: clang, cxx: clang++ }
env:
CC: ${{ matrix.compiler.cc }}
CXX: ${{ matrix.compiler.cxx }}
steps:
- name: Fetch Codebase
uses: actions/checkout@v2
- name: Cache Antlr4 and Antlr4 Runtime
id: cache-antlr
uses: actions/cache@v2
with:
path: ${{ github.workspace }}/thirdparty
key: ${{ matrix.os }}-${{ matrix.compiler.cc }}-antlr4.9
- name: Install Prerequirements
run: |
sudo wget https://apt.llvm.org/llvm.sh
sudo chmod +x llvm.sh
sudo ./llvm.sh
sudo apt-get -y install uuid-dev pkg-config doxygen graphviz
- name: Install Antlr4 and Antlr4 Runtime
if: steps.cache-antlr.outputs.cache-hit != 'true'
run: |
sudo mkdir -p thirdparty/antlr && cd thirdparty/antlr
sudo wget https://www.antlr.org/download/antlr-4.9.2-complete.jar
sudo wget -O ${{ runner.temp }}/antlr4-src.zip https://www.antlr.org/download/antlr4-cpp-runtime-4.9.2-source.zip
cd ${{ runner.temp }}
sudo unzip antlr4-src.zip
sudo mkdir build && cd build
sudo mkdir -p ${{ github.workspace }}/thirdparty/antlr-runtime
sudo cmake .. -DANTLR4_INSTALL=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="-w" -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/thirdparty/antlr-runtime
sudo cmake --build . --target install -- -j 2
- name: Move Antlr Runtime into /usr/local
run: |
cd ${{ github.workspace }}/thirdparty/antlr-runtime
sudo cp -r include/* /usr/local/include/
sudo cp -r lib/* /usr/local/lib/
- name: CMake Build
run: |
echo "THREAD_COUNT=$(sudo cat /proc/cpuinfo| grep "processor"| wc -l)" >> $GITHUB_ENV
sudo mkdir cmake-build-debug cmake-build-release
cd cmake-build-debug
sudo cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="-w" -G "Unix Makefiles" ..
sudo cmake --build . --target staticscript document -- -j $THREAD_COUNT
sudo ctest --extra-verbose
cd ../cmake-build-release
sudo cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="-w" -G "Unix Makefiles" ..
sudo cmake --build . --target staticscript document -- -j $THREAD_COUNT
sudo ctest --extra-verbose
build_and_test_on_macos:
name: Build and Test on macOS
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ macos-10.15 ]
compiler:
- { cc: gcc, cxx: g++ }
- { cc: clang, cxx: clang++ }
env:
CC: ${{ matrix.compiler.cc }}
CXX: ${{ matrix.compiler.cxx }}
steps:
- name: Install Prerequirements
run: brew install antlr antlr4-cpp-runtime doxygen graphviz
- name: Fetch Codebase
uses: actions/checkout@v2
- name: CMake Build
run: |
echo "THREAD_COUNT=$(sudo sysctl -n machdep.cpu.thread_count)" >> $GITHUB_ENV
sudo mkdir cmake-build-debug cmake-build-release
cd cmake-build-debug
sudo cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="-w" -G "Unix Makefiles" ..
sudo cmake --build . --target staticscript document -- -j $THREAD_COUNT
sudo ctest --extra-verbose
cd ../cmake-build-release
sudo cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="-w" -G "Unix Makefiles" ..
sudo cmake --build . --target staticscript document -- -j $THREAD_COUNT
sudo ctest --extra-verbose