-
Notifications
You must be signed in to change notification settings - Fork 21
137 lines (133 loc) · 4.87 KB
/
build.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
#
# Copyright (c) 2022 alandefreitas ([email protected])
#
# Distributed under the Boost Software License, Version 1.0.
# https://www.boost.org/LICENSE_1_0.txt
#
name: Small
on:
push:
paths:
- '**.c'
- '**.cpp'
- '**.h'
- '**.hpp'
- '**.cmake'
- '**/CMakeLists.txt'
- '.github/workflows/build.yml'
pull_request:
paths:
- '**.c'
- '**.cpp'
- '**.h'
- '**.hpp'
- '**.cmake'
- '**/CMakeLists.txt'
- '.github/workflows/build.yml'
concurrency:
group: ${{format('{0}:{1}', github.repository, github.ref)}}
cancel-in-progress: true
jobs:
Build:
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
# see: https://github.com/actions/virtual-environments
- {
name: "Windows-MSVC/2019/Static/X86/Release",
os: windows-2019,
config: Release,
cmake_extra_args: -G "Visual Studio 16 2019" -A Win32,
sudocmd: "",
artifact_name: "Windows x86",
cores: 2,
install_dir: "C:/Program Files (x86)/small"
}
- {
name: "Windows-MSVC/2019/Static/X64/Release",
os: windows-2019,
config: Release,
cmake_extra_args: -G "Visual Studio 16 2019" -A x64 -DCMAKE_CXX_FLAGS="/O2",
sudocmd: "",
artifact_name: "Windows x64",
cores: 2,
install_dir: "C:/Program Files/small"
}
- {
name: "Ubuntu/20.04/Static/X64/Release",
os: ubuntu-20.04,
config: Release,
cmake_extra_args: "-DCMAKE_C_COMPILER=/usr/bin/gcc-10 -DCMAKE_CXX_COMPILER=/usr/bin/g++-10 -DCMAKE_CXX_FLAGS=\"-O2\"",
sudocmd: "sudo",
artifact_name: "Linux",
cores: 2,
install_dir: "/usr/local/"
}
- {
name: "Ubuntu/22.04/Static/X64/fsanitize",
os: ubuntu-22.04,
config: Debug,
cmake_extra_args: "-DCMAKE_C_COMPILER=/usr/bin/clang-15 -DCMAKE_CXX_COMPILER=/usr/bin/clang++-15 -DCMAKE_C_FLAGS='-fsanitize=address,pointer-compare,pointer-subtract,leak,undefined' -DCMAKE_CXX_FLAGS='-fsanitize=address,pointer-compare,pointer-subtract,leak,undefined'",
sudocmd: "sudo",
artifact_name: "Linux",
cores: 2,
install_dir: "/usr/local/"
}
- {
name: "MacOSX/12/Static/X64/Release",
os: macos-12,
config: Release,
cmake_extra_args: "-DCMAKE_CXX_FLAGS=\"-O2\"",
sudocmd: "sudo",
artifact_name: "MacOSX",
cores: 4,
install_dir: "/usr/local/"
}
steps:
- uses: actions/checkout@v2
- name: Create Work Dir
run: mkdir build
- name: Configure
working-directory: ./build
run: |
cmake .. ${{ matrix.config.cmake_extra_args }} -D CMAKE_BUILD_TYPE=${{ matrix.config.config }} -DSMALL_DEVELOPER_MODE=ON
- name: Build
working-directory: ./build
run: cmake --build . --parallel ${{ matrix.config.cores }} --config ${{ matrix.config.config }}
- name: Test
working-directory: ./build
run: ctest --parallel ${{ matrix.config.cores }} -C ${{ matrix.config.config }} --verbose
- name: Install
working-directory: ./build
run: ${{ matrix.config.sudocmd }} cmake --install . --prefix "${{ matrix.config.install_dir }}"
- name: CMake Subdir Test
working-directory: ./test/cmake
run: |
mkdir build_with_subdir
cd build_with_subdir
cmake .. ${{ matrix.config.cmake_extra_args }} -D CMAKE_BUILD_TYPE=${{ matrix.config.config }}
cmake --build . --parallel ${{ matrix.config.cores }} --config ${{ matrix.config.config }}
ctest -C ${{ matrix.config.config }} --verbose
- name: CMake Find Package Test
working-directory: ./test/cmake
run: |
mkdir build_with_package
cd build_with_package
cmake .. ${{ matrix.config.cmake_extra_args }} -D CMAKE_BUILD_TYPE=${{ matrix.config.config }} -D BOOST_CI_INSTALL_TEST=ON -D Small_DIR="${{ matrix.config.install_dir }}"
cmake --build . --parallel ${{ matrix.config.cores }} --config ${{ matrix.config.config }}
ctest -C ${{ matrix.config.config }} --verbose
- name: Create packages
working-directory: ./build
run: ${{ matrix.config.sudocmd }} cpack
- name: Archive Packages
uses: actions/upload-artifact@v2
with:
name: Binary Packages ${{ matrix.config.artifact_name }}
path: build/small-?.?.?-*.*
- name: Archive Installer Packages as is
uses: kittaakos/upload-artifact-as-is@v0
with:
path: build/small-?.?.?-*.*