-
Notifications
You must be signed in to change notification settings - Fork 712
185 lines (150 loc) · 7.13 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
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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
name: CMake Build
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
push:
branches:
- rel/*
- dev/*
- main
pull_request:
branches:
- rel/*
- dev/*
- main
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release
VCPKG_GIT_REF: 8a9a97315aefb3f8bc5d81bf66ca0025938b9c91
jobs:
build-windows:
runs-on: windows-2019
steps:
- uses: actions/checkout@v1
- name: Install Build Tools
uses: crazy-max/ghaction-chocolatey@v1
with:
args: install wixtoolset
- name: Install pytest for easier to read test results
run: python3 -m pip install pytest
- uses: lukka/[email protected]
# Restore from cache the previously built ports. If cache-miss, download, build vcpkg ports.
- name: Restore vcpkg ports from cache or install vcpkg
# Download and build vcpkg, without installing any port. If content is cached already, it is a no-op.
uses: lukka/[email protected]
id: runvcpkg
with:
vcpkgArguments: "curl[openssl] json-c libxml2 pcre2 check pthreads zlib pdcurses bzip2"
vcpkgGitCommitId: "${{ env.VCPKG_GIT_REF }}"
vcpkgTriplet: "x64-windows"
- name: Print the VCPKG_ROOT & VCPKG_TRIPLET (for debugging)
shell: bash
run: echo "'${{ steps.runvcpkg.outputs.RUNVCPKG_VCPKG_ROOT_OUT }}' '${{ steps.runvcpkg.outputs.RUNVCPKG_VCPKG_TRIPLET_OUT }}' "
- name: dir the VCPKG_ROOT
run: dir ${{ steps.runvcpkg.outputs.RUNVCPKG_VCPKG_ROOT_OUT }}
- name: Create Build Directory
shell: bash
# Some projects don't allow in-source building, so create a separate build directory
# We'll use this as our working directory for all subsequent commands
run: cmake -E make_directory ${{runner.workspace}}/build
- name: Run CMake+Ninja with triplet (cmd)
uses: lukka/[email protected]
id: runcmake_cmd
with:
cmakeGenerator: "Ninja" # Visual Studio 15 2017
cmakeListsOrSettingsJson: "CMakeListsTxtBasic"
cmakeListsTxtPath: "${{runner.workspace}}/clamav/CMakeLists.txt"
useVcpkgToolchainFile: true
cmakeAppendedArgs: '-A x64 -DCMAKE_TOOLCHAIN_FILE="$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake" -DENABLE_EXAMPLES=ON -DENABLE_STATIC_LIB=ON -- -v'
cmakeBuildType: "${{ env.BUILD_TYPE }}"
vcpkgTriplet: ${{ steps.runvcpkg.outputs.RUNVCPKG_VCPKG_TRIPLET_OUT }}
buildDirectory: "${{runner.workspace}}/build"
- name: Test
working-directory: ${{runner.workspace}}/build
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest -C ${{ env.BUILD_TYPE }} -V
- name: Create Installer
working-directory: ${{runner.workspace}}/build
run: cpack -C ${{ env.BUILD_TYPE }}
build-macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v1
- name: Install Build Tools
run: brew install bison flex
- name: Install Dependencies
run: brew install bzip2 check curl-openssl json-c libxml2 ncurses [email protected] pcre2 zlib
- name: Install pytest for easier to read test results
run: python3 -m pip install pytest
- uses: lukka/[email protected]
- name: Create Build Directory
shell: bash
# Some projects don't allow in-source building, so create a separate build directory
# We'll use this as our working directory for all subsequent commands
run: cmake -E make_directory ${{runner.workspace}}/build
- name: Configure CMake
# Use a bash shell so we can use the same syntax for environment variable
# access regardless of the host operating system
working-directory: ${{runner.workspace}}/build
# Note the current convention is to use the -S and -B options here to specify source
# and build directories, but this is only available with CMake 3.13 and higher.
# The CMake binaries on the Github Actions machines are (as of this writing) 3.12
run:
cmake ${{runner.workspace}}/clamav -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }}
-DOPENSSL_ROOT_DIR=/usr/local/opt/[email protected]/
-DOPENSSL_CRYPTO_LIBRARY=/usr/local/opt/[email protected]/lib/libcrypto.1.1.dylib
-DOPENSSL_SSL_LIBRARY=/usr/local/opt/[email protected]/lib/libssl.1.1.dylib
-DENABLE_STATIC_LIB=ON
-DENABLE_EXAMPLES=ON
- name: Build
shell: bash
working-directory: ${{runner.workspace}}/build
# Execute the build. You can specify a specific target with "--target <NAME>"
run: cmake --build . --config ${{ env.BUILD_TYPE }}
- name: Test
shell: bash
working-directory: ${{runner.workspace}}/build
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest -C ${{ env.BUILD_TYPE }} -V
build-ubuntu:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Update package listings
run: sudo apt-get update
- name: Install Build Tools
run: sudo apt-get install -y bison flex valgrind
- name: Install Dependencies
run: sudo apt-get install -y check libbz2-dev libcurl4-openssl-dev libjson-c-dev libmilter-dev libncurses5-dev libpcre3-dev libssl-dev libxml2-dev zlib1g-dev
- name: Install pytest for easier to read test results
run: python3 -m pip install pytest
- uses: lukka/[email protected]
- name: Create Build Directory
shell: bash
# Some projects don't allow in-source building, so create a separate build directory
# We'll use this as our working directory for all subsequent commands
run: cmake -E make_directory ${{runner.workspace}}/build
- name: Configure CMake
# Use a bash shell so we can use the same syntax for environment variable
# access regardless of the host operating system
working-directory: ${{runner.workspace}}/build
# Note the current convention is to use the -S and -B options here to specify source
# and build directories, but this is only available with CMake 3.13 and higher.
# The CMake binaries on the Github Actions machines are (as of this writing) 3.12
run:
cmake ${{runner.workspace}}/clamav -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }}
-DENABLE_STATIC_LIB=ON
-DENABLE_EXAMPLES=ON
- name: Build
shell: bash
working-directory: ${{runner.workspace}}/build
# Execute the build. You can specify a specific target with "--target <NAME>"
run: cmake --build . --config ${{ env.BUILD_TYPE }}
- name: Test
shell: bash
working-directory: ${{runner.workspace}}/build
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest -C ${{ env.BUILD_TYPE }} -V