Skip to content

Commit bf09374

Browse files
authored
Update build_and_test.yml
Added support for automated testing of Windows Cygwin installations.
1 parent ad9a25b commit bf09374

File tree

1 file changed

+101
-24
lines changed

1 file changed

+101
-24
lines changed

.github/workflows/build_and_test.yml

Lines changed: 101 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -34,68 +34,145 @@ jobs:
3434
matrix:
3535
include:
3636

37+
############################################################
38+
# Ubuntu latest is a normal build with nothing special that
39+
# really need be done.
40+
############################################################
3741
- os: ubuntu-latest
38-
flags:
42+
name: Standard
43+
cmake_command: "cmake ../.. -DCMAKE_BUILD_TYPE=Release"
44+
build_command: "cmake --build . --config Release"
3945
vers_command: "./tidy --version"
4046
test_command: "ruby test.rb test"
4147

48+
############################################################
49+
# On macOS, we'll build both architectures.
50+
############################################################
4251
- os: macOS-latest
43-
flags: "'-DCMAKE_OSX_ARCHITECTURES=x86_64;arm64'"
52+
name: X86_64 & Arm64
53+
cmake_command: "cmake ../.. -DCMAKE_BUILD_TYPE=Release '-DCMAKE_OSX_ARCHITECTURES=x86_64;arm64'"
54+
build_command: "cmake --build . --config Release"
4455
vers_command: "./tidy --version"
4556
test_command: "ruby test.rb test"
4657

58+
############################################################
59+
# The standard Windows build is perfectly vanilla, and as
60+
# of now is using MSVC 19.
61+
############################################################
4762
- os: windows-latest
48-
flags:
63+
name: MSVC
64+
cmake_command: "cmake ../.. -DCMAKE_BUILD_TYPE=Release"
65+
build_command: "cmake --build . --config Release"
4966
vers_command: "./tidy.exe --version"
5067
test_command: "ruby test.rb test"
5168

69+
############################################################
70+
# We'll also build using MinGW on Windows, because it's
71+
# always nice to support FOSS toolchains. While we could
72+
# do this another way, we'll use the windows-2016 runner
73+
# to distinguish it from the windows-latest runner.
74+
############################################################
5275
- os: windows-2016
53-
flags: "-G 'MinGW Makefiles'"
76+
name: MinGW
77+
cmake_command: "cmake ../.. -DCMAKE_BUILD_TYPE=Release -G 'MinGW Makefiles'"
78+
build_command: "cmake --build . --config Release"
79+
vers_command: "./tidy --version"
80+
test_command: "ruby test.rb test"
81+
82+
############################################################
83+
# We'll also build using Cygwin on Windows, because even
84+
# Windows people sometimes dislike Windows. While we could
85+
# do this another way, we'll use the windows-2019 runner to
86+
# distinguish it from the windows-latest runner.
87+
# Note: only the `tidy` target will be built (without the
88+
# man page) for this runner, because xltproc has issues
89+
# loading files in the virtual environment. The man page
90+
# is tested and builds perfectly fine on real installs.
91+
############################################################
92+
- os: windows-2019
93+
name: Cygwin
94+
cmake_command: "cmake ../.. -DCMAKE_BUILD_TYPE=Release"
95+
build_command: "cmake --build . --target tidy --config Release"
5496
vers_command: "./tidy --version"
5597
test_command: "ruby test.rb test"
5698

5799
steps:
58-
- uses: actions/checkout@v2
59100

101+
############################################################
102+
# Checkput the repository.
103+
############################################################
104+
- uses: actions/checkout@v2
60105

61-
# We'll use the windows-2016 instance to perform a MinGW build.
62-
# Of course, we only want to install if this is the correct target.
106+
############################################################
107+
# Install MinGW-w64 if needed for the current runner.
108+
############################################################
63109
- name: Install MinGW-w64
64110
if: ${{matrix.os == 'windows-2016'}}
65111
uses: egor-tensin/setup-mingw@v2
66112
with:
67113
platform: x64
68-
114+
115+
############################################################
116+
# Install Cygwin if needed for the current runner.
117+
############################################################
118+
- name: Install Cygwin
119+
if: ${{matrix.os == 'windows-2019'}}
120+
uses: egor-tensin/setup-cygwin@v3
121+
with:
122+
platform: x64
123+
packages: make gcc-core gcc-g++ cmake
124+
125+
############################################################
126+
# Cmake and Make the project.
127+
############################################################
69128
- name: Build
70129
working-directory: ${{github.workspace}}/build/cmake
71-
run: cmake ../.. -DCMAKE_BUILD_TYPE=Release ${{matrix.flags}}
72-
73-
- name: Make
74-
working-directory: ${{github.workspace}}/build/cmake
75-
run: cmake --build . --config Release
76-
77-
# Windows MSVC is the only oddball here; why does it install the
78-
# binary into a subfolder, unlike all of the other builds? Let's
79-
# make everything else easier by relocating it to the same spot
80-
# as all the other build locations.
81-
- name: Move the exe to someplace sensible
130+
run: |
131+
${{matrix.cmake_command}}
132+
${{matrix.build_command}}
133+
134+
############################################################
135+
# Windows MSVC is the only oddball here; why does it
136+
# install the binary into a subfolder, unlike all of the
137+
# other builds? Let's make everything else easier by
138+
# relocating it to the same spot as all the other build
139+
# locations.
140+
############################################################
141+
- name: Move the MSVC exe to someplace sensible
82142
if: ${{matrix.os == 'windows-latest'}}
83-
run: move-item -path "${{github.workspace}}/build/cmake/Release/tidy.exe" -destination "${{github.workspace}}/build/cmake/"
143+
run: |
144+
move-item -path "${{github.workspace}}/build/cmake/Release/tidy.exe" -destination "${{github.workspace}}/build/cmake/"
84145
146+
############################################################
147+
# Just so that a human can make a quick sanity check.
148+
############################################################
85149
- name: Show Version
86150
working-directory: ${{github.workspace}}/build/cmake
87-
run: ${{matrix.vers_command}}
151+
run: |
152+
${{matrix.vers_command}}
88153
154+
############################################################
155+
# Install Ruby for running our regression tests. It's quite
156+
# nice that this package is generic enough to work on all
157+
# of the different runners.
158+
############################################################
89159
- uses: ruby/setup-ruby@v1
90160
with:
91161
ruby-version: 2.7
92162
bundler-cache: true
93163

164+
############################################################
165+
# Ensure that dependencies are met.
166+
############################################################
94167
- name: Bundle Install
95168
working-directory: ${{github.workspace}}/regression_testing
96-
run: bundle install
169+
run: |
170+
bundle install
97171
172+
############################################################
173+
# Finally, check for regressions.
174+
############################################################
98175
- name: Run Regression Test
99176
working-directory: ${{github.workspace}}/regression_testing
100-
run: ${{matrix.test_command}}
101-
177+
run: |
178+
${{matrix.test_command}}

0 commit comments

Comments
 (0)