Skip to content

Commit

Permalink
Merging changes from Next. These do not affect the binary, so no vers…
Browse files Browse the repository at this point in the history
…ion bump.
  • Loading branch information
balthisar committed Jul 16, 2021
1 parent 228d8e9 commit 81b7fe3
Show file tree
Hide file tree
Showing 8 changed files with 510 additions and 49 deletions.
95 changes: 95 additions & 0 deletions .github/workflows/api_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
################################################################################
# Test LibTidy Public API (via Swift SwLibTidy).
#
# Because SwLibTidy wraps nearly 100% of LibTidy's API, it's a great candidate
# for testing LibTidy via a high-level, easy to write and understand tests.
#
# - This is a Public API test of LibTidy. It does not test the console
# application, is not a unit test, and is not an output regression test.
#
# - Build on multiple operating systems, once the runners are equipped with
# Swift.
#
################################################################################

name: API Test via SwLibTidy

on:
push:
paths:
- 'src/**'
- 'include/**'
- '.github/workflows/**'
pull_request:
paths:
- 'src/**'
- 'include/**'
- '.github/workflows/**'

jobs:

test_library_api:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:

############################################################
# Ubuntu latest is a normal build with nothing special that
# really need be done.
# Note: currently disabled because some tests need to be
# refactored to avoid using macOS specific library calls.
############################################################
# - os: ubuntu-latest
# name: Ubuntu

############################################################
# On macOS, we'll build both architectures.
# Note: this is the currently only enabled runner, and I'm
# comfortable with it. This excercises nearly all of
# HTML Tidy's library API, which should be platform
# agnostic.
############################################################
- os: macOS-latest
name: macOS

############################################################
# The standard Windows build is perfectly vanilla, and as
# of now is using MSVC 19.
# Note: currently disabled because some tests need to be
# refactored to avoid using macOS specific library calls,
# but mostly because the Windows runners aren't set up
# yet for running Swift code.
############################################################
# - os: windows-latest
# name: MSVC

steps:

############################################################
# Checkout the Swift testing repository.
############################################################
- name: Checkout SwLibTidy
uses: actions/checkout@v2
with:
repository: htacg/SwLibTidy


############################################################
# Checkout the Tidy repository as Source/CLibTidy
############################################################
- name: Checkout this repository
uses: actions/checkout@v2
with:
path: ${{github.workspace}}/Sources/CLibTidy


############################################################
# Perform swift test
# Note: Github truncates the in-browser log. If you want
# to see everything, look for the Raw Logs button.
############################################################
- name: Swift Test
run: |
swift test
125 changes: 101 additions & 24 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,68 +34,145 @@ jobs:
matrix:
include:

############################################################
# Ubuntu latest is a normal build with nothing special that
# really need be done.
############################################################
- os: ubuntu-latest
flags:
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
flags: "'-DCMAKE_OSX_ARCHITECTURES=x86_64;arm64'"
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
flags:
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
flags: "-G 'MinGW Makefiles'"
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:
- uses: actions/checkout@v2

############################################################
# Checkput the repository.
############################################################
- uses: actions/checkout@v2

# We'll use the windows-2016 instance to perform a MinGW build.
# Of course, we only want to install if this is the correct target.
############################################################
# 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: cmake ../.. -DCMAKE_BUILD_TYPE=Release ${{matrix.flags}}

- name: Make
working-directory: ${{github.workspace}}/build/cmake
run: cmake --build . --config Release

# 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 exe to someplace sensible
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/"
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}}
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
run: |
bundle install
############################################################
# Finally, check for regressions.
############################################################
- name: Run Regression Test
working-directory: ${{github.workspace}}/regression_testing
run: ${{matrix.test_command}}

run: |
${{matrix.test_command}}
Loading

0 comments on commit 81b7fe3

Please sign in to comment.