-
Notifications
You must be signed in to change notification settings - Fork 410
183 lines (164 loc) · 7.15 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
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
################################################################################
# Build and Test tidy on the latest versions of all of the major platforms.
#
# - Build on multiple operating systems, and where possible, multiple
# architectures. On Windows, we will also build and test mingw in
# addition to MSVC.
#
# - Report the version number for each binary that is built.
#
# - Run each binary against the regression test suite.
#
################################################################################
name: Build and Test
on:
push:
paths:
- 'src/**'
- 'include/**'
- '.github/workflows/**'
- 'CMakeLists.txt'
branches:
- 'master'
- 'next'
pull_request:
paths:
- 'src/**'
- 'include/**'
- '.github/workflows/**'
- 'CMakeLists.txt'
jobs:
build_and_test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
############################################################
# Ubuntu latest is a normal build with nothing special that
# really need be done.
############################################################
- os: ubuntu-latest
name: Standard
cmake_command: "cmake ../.. -DCMAKE_BUILD_TYPE=Release"
build_command: "cmake --build . --config Release"
vers_command: "./tidy --version"
test_command: "ruby test.rb test"
############################################################
# On macOS, we'll build both architectures.
############################################################
- os: macOS-latest
name: X86_64 & Arm64
cmake_command: "cmake ../.. -DCMAKE_BUILD_TYPE=Release '-DCMAKE_OSX_ARCHITECTURES=x86_64;arm64'"
build_command: "cmake --build . --config Release"
vers_command: "./tidy --version"
test_command: "ruby test.rb test"
############################################################
# The standard Windows build is perfectly vanilla, and as
# of now is using MSVC 19.
############################################################
- os: windows-latest
name: MSVC
cmake_command: "cmake ../.. -DCMAKE_BUILD_TYPE=Release"
build_command: "cmake --build . --config Release"
vers_command: "./tidy.exe --version"
test_command: "ruby test.rb test"
############################################################
# We'll also build using MinGW on Windows, because it's
# always nice to support FOSS toolchains. While we could
# do this another way, we'll use the windows-2016 runner
# to distinguish it from the windows-latest runner.
############################################################
- os: windows-2016
name: MinGW
cmake_command: "cmake ../.. -DCMAKE_BUILD_TYPE=Release -G 'MinGW Makefiles'"
build_command: "cmake --build . --config Release"
vers_command: "./tidy --version"
test_command: "ruby test.rb test"
############################################################
# We'll also build using Cygwin on Windows, because even
# Windows people sometimes dislike Windows. While we could
# do this another way, we'll use the windows-2019 runner to
# distinguish it from the windows-latest runner.
# Note: only the `tidy` target will be built (without the
# man page) for this runner, because xltproc has issues
# loading files in the virtual environment. The man page
# is tested and builds perfectly fine on real installs.
############################################################
- os: windows-2019
name: Cygwin
cmake_command: "cmake ../.. -DCMAKE_BUILD_TYPE=Release"
build_command: "cmake --build . --target tidy --config Release"
vers_command: "./tidy --version"
test_command: "ruby test.rb test"
steps:
############################################################
# Checkput the repository.
############################################################
- uses: actions/checkout@v2
############################################################
# Install MinGW-w64 if needed for the current runner.
############################################################
- name: Install MinGW-w64
if: ${{matrix.os == 'windows-2016'}}
uses: egor-tensin/setup-mingw@v2
with:
platform: x64
############################################################
# Install Cygwin if needed for the current runner.
############################################################
- name: Install Cygwin
if: ${{matrix.os == 'windows-2019'}}
uses: egor-tensin/setup-cygwin@v3
with:
platform: x64
packages: make gcc-core gcc-g++ cmake
############################################################
# Cmake and Make the project.
############################################################
- name: Build
working-directory: ${{github.workspace}}/build/cmake
run: |
${{matrix.cmake_command}}
${{matrix.build_command}}
############################################################
# Windows MSVC is the only oddball here; why does it
# install the binary into a subfolder, unlike all of the
# other builds? Let's make everything else easier by
# relocating it to the same spot as all the other build
# locations.
############################################################
- name: Move the MSVC exe to someplace sensible
if: ${{matrix.os == 'windows-latest'}}
run: |
move-item -path "${{github.workspace}}/build/cmake/Release/tidy.exe" -destination "${{github.workspace}}/build/cmake/"
############################################################
# Just so that a human can make a quick sanity check.
############################################################
- name: Show Version
working-directory: ${{github.workspace}}/build/cmake
run: |
${{matrix.vers_command}}
############################################################
# Install Ruby for running our regression tests. It's quite
# nice that this package is generic enough to work on all
# of the different runners.
############################################################
- uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
bundler-cache: true
############################################################
# Ensure that dependencies are met.
############################################################
- name: Bundle Install
working-directory: ${{github.workspace}}/regression_testing
run: |
bundle install
############################################################
# Finally, check for regressions.
############################################################
- name: Run Regression Test
working-directory: ${{github.workspace}}/regression_testing
run: |
${{matrix.test_command}}