-
Notifications
You must be signed in to change notification settings - Fork 51
145 lines (137 loc) · 4.36 KB
/
build_and_test.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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
name: build_and_test
on:
push:
branches:
- "master"
pull_request:
branches:
- "*"
jobs:
builds:
name: "${{ matrix.name }}"
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- name: "Ubuntu Jammy clang-14 build"
os: ubuntu-22.04
cpp_compiler: clang++
- name: "Ubuntu Jammy gcc-12 build"
os: ubuntu-22.04
cpp_compiler: g++-12
- name: "Ubuntu Jammy gcc-11 build"
os: ubuntu-22.04
cpp_compiler: g++-11
- name: "Mac OS clang-14 build"
os: macos-12
cpp_compiler: clang++
steps:
- uses: actions/checkout@v3
- name: Install (Ubuntu)
if: runner.os == 'Linux'
run: |
sudo apt update
sudo apt install -y --no-install-recommends ninja-build clang-tidy-14 libcurl4-openssl-dev
sudo ln -s /usr/bin/clang-tidy-14 /usr/local/bin/clang-tidy
- name: Install (macOS)
if: runner.os == 'macOS'
run: |
brew install ninja
sudo ln -s /usr/local/opt/llvm/bin/clang-tidy /usr/local/bin/clang-tidy
- name: Set environment variables
run: |
echo CXX="${{ matrix.cpp_compiler }}" >> $GITHUB_ENV
# '>' converts newlines into spaces
- name: Configure
run: >
cmake
-B build
-G Ninja
-DCMAKE_BUILD_TYPE=Release
-DBUILD_SHARED_LIBS=ON
- name: Build
run: cmake --build build
code_coverage:
name: "Run testcases with Code Coverage"
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Install packages
run: |
sudo apt update
sudo apt install -y --no-install-recommends libcurl4-openssl-dev gcovr
# '>' converts newlines into spaces
- name: Configure
run: >
cmake
-B build
-DCMAKE_BUILD_TYPE=Debug
-DCOVERAGE=ON
-DBUILD_SHARED_LIBS=ON
- name: Install IPFS
env:
GO_IPFS_VERSION: "v0.20.0"
run: |
GO_IPFS_DOWNLOAD_URL="https://dist.ipfs.io/go-ipfs/${GO_IPFS_VERSION}/go-ipfs_${GO_IPFS_VERSION}_linux-amd64.tar.gz"
GO_IPFS_DIR="${GITHUB_WORKSPACE}/go-ipfs"
GO_IPFS_ARCHIVE_FULLPATH="${GO_IPFS_DIR}/go-ipfs.tar.gz"
echo GO_IPFS_CMD="${GO_IPFS_DIR}/go-ipfs/ipfs" >> $GITHUB_ENV
mkdir -p "${GO_IPFS_DIR}"
wget --quiet -O "${GO_IPFS_ARCHIVE_FULLPATH}" "${GO_IPFS_DOWNLOAD_URL}"
tar -C "${GO_IPFS_DIR}" -vzxf "${GO_IPFS_ARCHIVE_FULLPATH}"
rm -rf "${GO_IPFS_ARCHIVE_FULLPATH}"
- name: Test
working-directory: ./build
run: |
./../scripts/ipfs_daemon_start.sh
make ctest_coverage_xml
./../scripts/ipfs_daemon_stop.sh
env:
CTEST_OUTPUT_ON_FAILURE: ON
- uses: codecov/codecov-action@v3
with:
file: ./build/ctest_coverage_xml.xml
doxygen:
name: "Generate Doxygen"
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Install
run: |
sudo apt update
sudo apt install -y --no-install-recommends libcurl4-openssl-dev
- name: Install latest Doxygen (v1.9.8)
run: |
wget https://www.doxygen.nl/files/doxygen-1.9.8.linux.bin.tar.gz
tar -xf doxygen-1.9.8.linux.bin.tar.gz
cd doxygen-1.9.8
sudo make install
- name: Configure
run: >
cmake
-B build
-DDOC=ON
- name: Build Doxygen
working-directory: ./build
run: make doc
static_analytics:
name: "Static code analysis"
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Install
run: |
sudo apt update
sudo apt install -y --no-install-recommends clang-tidy-14 libcurl4-openssl-dev
sudo ln -s /usr/bin/clang-tidy-14 /usr/local/bin/clang-tidy
- name: Analysis
run: |
CCC_CXX=clang++-10 scan-build-14 --status-bugs cmake -DBUILD_SHARED_LIBS=ON "${SOURCE_DIR}"
CCC_CXX=clang++-10 scan-build-14 --status-bugs make VERBOSE=1
code_style_guidelines:
name: "Coding style guidelines"
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Check style format
run: ./scripts/check_format.sh