-
-
Notifications
You must be signed in to change notification settings - Fork 324
70 lines (60 loc) · 2.4 KB
/
build_on_push.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
name: continuous integration
on: [push, pull_request]
jobs:
build:
runs-on: ${{ matrix.os }}
name: Build on ${{ matrix.os }} with multilib ${{ matrix.multilib }}
strategy:
matrix:
include:
- os: ubuntu-latest
multilib: true
- os: ubuntu-latest
multilib: false
- os: macos-latest
multilib: false
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install package dependencies
if: startsWith( matrix.os, 'ubuntu' )
run: |
sudo apt-get update -y
sudo apt-get install -y cmake pkg-config gfortran nvidia-cuda-toolkit libtool-bin valgrind
- name: Install package dependencies
if: startsWith( matrix.os, 'macos' )
run: |
brew install cmake pkg-config fmt spdlog nlohmann-json grpc
echo "PKG_CONFIG_PATH=$(brew --prefix)/opt/[email protected]/lib/pkgconfig" >> $GITHUB_ENV
- uses: actions/setup-python@v2
with:
python-version: '3.x'
cache: 'pip'
cache-dependency-path: '**/requirements.txt'
- name: Prepare
run: |
pip install -r test/requirements.txt
mkdir "$HOME/work/bear_build"
mkdir "$HOME/work/bear_install"
echo "BUILD_DIR=$HOME/work/bear_build" >> $GITHUB_ENV
echo "INSTALL_DIR=$HOME/work/bear_install" >> $GITHUB_ENV
echo "ZLIB_SRC_DIR=$HOME/work/zlib" >> $GITHUB_ENV
echo "$HOME/work/bear_install/bin:$PATH" >> $GITHUB_PATH
- name: Build
env:
CTEST_OUTPUT_ON_FAILURE: 1
C_FLAGS: -Wall -Wextra -pedantic
CXX_FLAGS: -Wall -Wextra -pedantic
CMAKE_OPTIONS: -DENABLE_MULTILIB=${{ matrix.multilib }}
run: |
cmake -B "$BUILD_DIR" -S "$GITHUB_WORKSPACE" $CMAKE_OPTIONS -DCMAKE_INSTALL_PREFIX:PATH="$INSTALL_DIR" -DCMAKE_INSTALL_LIBDIR=lib/x86_64-linux-gnu
cmake --build "$BUILD_DIR" --parallel 4 --target install
- name: Run [functional test]
run: |
git clone https://github.com/madler/zlib.git $ZLIB_SRC_DIR -b v1.2.11
mkdir $HOME/work/zlib_compilations && cd $HOME/work/zlib_compilations
bear --help
bear -- $ZLIB_SRC_DIR/configure
bear -- make
cat compile_commands.json
$GITHUB_WORKSPACE/test/bin/assert_compilation compile_commands.json count -gt 30