Skip to content

Commit 81b7fe3

Browse files
committed
Merging changes from Next. These do not affect the binary, so no version bump.
1 parent 228d8e9 commit 81b7fe3

File tree

8 files changed

+510
-49
lines changed

8 files changed

+510
-49
lines changed

.github/workflows/api_test.yml

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
################################################################################
2+
# Test LibTidy Public API (via Swift SwLibTidy).
3+
#
4+
# Because SwLibTidy wraps nearly 100% of LibTidy's API, it's a great candidate
5+
# for testing LibTidy via a high-level, easy to write and understand tests.
6+
#
7+
# - This is a Public API test of LibTidy. It does not test the console
8+
# application, is not a unit test, and is not an output regression test.
9+
#
10+
# - Build on multiple operating systems, once the runners are equipped with
11+
# Swift.
12+
#
13+
################################################################################
14+
15+
name: API Test via SwLibTidy
16+
17+
on:
18+
push:
19+
paths:
20+
- 'src/**'
21+
- 'include/**'
22+
- '.github/workflows/**'
23+
pull_request:
24+
paths:
25+
- 'src/**'
26+
- 'include/**'
27+
- '.github/workflows/**'
28+
29+
jobs:
30+
31+
test_library_api:
32+
runs-on: ${{ matrix.os }}
33+
strategy:
34+
fail-fast: false
35+
matrix:
36+
include:
37+
38+
############################################################
39+
# Ubuntu latest is a normal build with nothing special that
40+
# really need be done.
41+
# Note: currently disabled because some tests need to be
42+
# refactored to avoid using macOS specific library calls.
43+
############################################################
44+
# - os: ubuntu-latest
45+
# name: Ubuntu
46+
47+
############################################################
48+
# On macOS, we'll build both architectures.
49+
# Note: this is the currently only enabled runner, and I'm
50+
# comfortable with it. This excercises nearly all of
51+
# HTML Tidy's library API, which should be platform
52+
# agnostic.
53+
############################################################
54+
- os: macOS-latest
55+
name: macOS
56+
57+
############################################################
58+
# The standard Windows build is perfectly vanilla, and as
59+
# of now is using MSVC 19.
60+
# Note: currently disabled because some tests need to be
61+
# refactored to avoid using macOS specific library calls,
62+
# but mostly because the Windows runners aren't set up
63+
# yet for running Swift code.
64+
############################################################
65+
# - os: windows-latest
66+
# name: MSVC
67+
68+
steps:
69+
70+
############################################################
71+
# Checkout the Swift testing repository.
72+
############################################################
73+
- name: Checkout SwLibTidy
74+
uses: actions/checkout@v2
75+
with:
76+
repository: htacg/SwLibTidy
77+
78+
79+
############################################################
80+
# Checkout the Tidy repository as Source/CLibTidy
81+
############################################################
82+
- name: Checkout this repository
83+
uses: actions/checkout@v2
84+
with:
85+
path: ${{github.workspace}}/Sources/CLibTidy
86+
87+
88+
############################################################
89+
# Perform swift test
90+
# Note: Github truncates the in-browser log. If you want
91+
# to see everything, look for the Raw Logs button.
92+
############################################################
93+
- name: Swift Test
94+
run: |
95+
swift test

.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)