2021-05-21 13:08:51 +00:00
|
|
|
################################################################################
|
2021-08-17 15:52:52 +00:00
|
|
|
# Build and Test tidy on the latest versions of all of the major platforms.
|
2021-05-21 13:08:51 +00:00
|
|
|
#
|
|
|
|
# - Build on multiple operating systems, and where possible, multiple
|
2021-07-21 20:56:54 +00:00
|
|
|
# architectures. On Windows, we will also build and test mingw in
|
2021-05-21 13:08:51 +00:00
|
|
|
# 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/**'
|
2021-07-28 22:13:18 +00:00
|
|
|
- 'CMakeLists.txt'
|
2021-08-17 15:52:52 +00:00
|
|
|
branches:
|
|
|
|
- 'master'
|
|
|
|
- 'next'
|
2021-05-21 13:08:51 +00:00
|
|
|
pull_request:
|
|
|
|
paths:
|
|
|
|
- 'src/**'
|
|
|
|
- 'include/**'
|
|
|
|
- '.github/workflows/**'
|
2021-07-28 22:13:18 +00:00
|
|
|
- 'CMakeLists.txt'
|
2021-05-21 13:08:51 +00:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
|
|
|
|
build_and_test:
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
include:
|
|
|
|
|
2021-07-12 17:47:02 +00:00
|
|
|
############################################################
|
|
|
|
# Ubuntu latest is a normal build with nothing special that
|
|
|
|
# really need be done.
|
|
|
|
############################################################
|
2021-05-21 13:08:51 +00:00
|
|
|
- os: ubuntu-latest
|
2021-07-12 17:47:02 +00:00
|
|
|
name: Standard
|
|
|
|
cmake_command: "cmake ../.. -DCMAKE_BUILD_TYPE=Release"
|
|
|
|
build_command: "cmake --build . --config Release"
|
2021-05-21 13:08:51 +00:00
|
|
|
vers_command: "./tidy --version"
|
|
|
|
test_command: "ruby test.rb test"
|
|
|
|
|
2021-07-12 17:47:02 +00:00
|
|
|
############################################################
|
|
|
|
# On macOS, we'll build both architectures.
|
|
|
|
############################################################
|
2021-05-21 13:08:51 +00:00
|
|
|
- os: macOS-latest
|
2021-07-12 17:47:02 +00:00
|
|
|
name: X86_64 & Arm64
|
|
|
|
cmake_command: "cmake ../.. -DCMAKE_BUILD_TYPE=Release '-DCMAKE_OSX_ARCHITECTURES=x86_64;arm64'"
|
|
|
|
build_command: "cmake --build . --config Release"
|
2021-05-21 13:08:51 +00:00
|
|
|
vers_command: "./tidy --version"
|
|
|
|
test_command: "ruby test.rb test"
|
|
|
|
|
2021-07-12 17:47:02 +00:00
|
|
|
############################################################
|
|
|
|
# The standard Windows build is perfectly vanilla, and as
|
|
|
|
# of now is using MSVC 19.
|
|
|
|
############################################################
|
2021-05-21 13:08:51 +00:00
|
|
|
- os: windows-latest
|
2021-07-12 17:47:02 +00:00
|
|
|
name: MSVC
|
|
|
|
cmake_command: "cmake ../.. -DCMAKE_BUILD_TYPE=Release"
|
|
|
|
build_command: "cmake --build . --config Release"
|
2021-05-21 13:08:51 +00:00
|
|
|
vers_command: "./tidy.exe --version"
|
|
|
|
test_command: "ruby test.rb test"
|
2021-08-17 15:52:52 +00:00
|
|
|
|
2021-07-12 17:47:02 +00:00
|
|
|
############################################################
|
|
|
|
# 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.
|
|
|
|
############################################################
|
2021-05-21 13:08:51 +00:00
|
|
|
- os: windows-2016
|
2021-07-12 17:47:02 +00:00
|
|
|
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"
|
2021-08-17 15:52:52 +00:00
|
|
|
|
2021-07-12 17:47:02 +00:00
|
|
|
############################################################
|
|
|
|
# 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"
|
2021-05-21 13:08:51 +00:00
|
|
|
vers_command: "./tidy --version"
|
|
|
|
test_command: "ruby test.rb test"
|
|
|
|
|
|
|
|
steps:
|
|
|
|
|
2021-07-12 17:47:02 +00:00
|
|
|
############################################################
|
|
|
|
# Checkput the repository.
|
|
|
|
############################################################
|
|
|
|
- uses: actions/checkout@v2
|
2021-05-21 13:08:51 +00:00
|
|
|
|
2021-07-12 17:47:02 +00:00
|
|
|
############################################################
|
|
|
|
# Install MinGW-w64 if needed for the current runner.
|
|
|
|
############################################################
|
2021-05-21 13:08:51 +00:00
|
|
|
- name: Install MinGW-w64
|
|
|
|
if: ${{matrix.os == 'windows-2016'}}
|
|
|
|
uses: egor-tensin/setup-mingw@v2
|
|
|
|
with:
|
|
|
|
platform: x64
|
2021-08-17 15:52:52 +00:00
|
|
|
|
2021-07-12 17:47:02 +00:00
|
|
|
############################################################
|
|
|
|
# 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
|
2021-08-17 15:52:52 +00:00
|
|
|
|
2021-07-12 17:47:02 +00:00
|
|
|
############################################################
|
|
|
|
# Cmake and Make the project.
|
|
|
|
############################################################
|
2021-05-21 13:08:51 +00:00
|
|
|
- name: Build
|
|
|
|
working-directory: ${{github.workspace}}/build/cmake
|
2021-07-12 17:47:02 +00:00
|
|
|
run: |
|
|
|
|
${{matrix.cmake_command}}
|
|
|
|
${{matrix.build_command}}
|
2021-08-17 15:52:52 +00:00
|
|
|
|
2021-07-12 17:47:02 +00:00
|
|
|
############################################################
|
2021-08-17 15:52:52 +00:00
|
|
|
# Windows MSVC is the only oddball here; why does it
|
2021-07-12 17:47:02 +00:00
|
|
|
# install the binary into a subfolder, unlike all of the
|
2021-08-17 15:52:52 +00:00
|
|
|
# other builds? Let's make everything else easier by
|
2021-07-12 17:47:02 +00:00
|
|
|
# relocating it to the same spot as all the other build
|
|
|
|
# locations.
|
|
|
|
############################################################
|
|
|
|
- name: Move the MSVC exe to someplace sensible
|
2021-05-21 13:08:51 +00:00
|
|
|
if: ${{matrix.os == 'windows-latest'}}
|
2021-07-12 17:47:02 +00:00
|
|
|
run: |
|
|
|
|
move-item -path "${{github.workspace}}/build/cmake/Release/tidy.exe" -destination "${{github.workspace}}/build/cmake/"
|
2021-05-21 13:08:51 +00:00
|
|
|
|
2021-07-12 17:47:02 +00:00
|
|
|
############################################################
|
|
|
|
# Just so that a human can make a quick sanity check.
|
|
|
|
############################################################
|
2021-05-21 13:08:51 +00:00
|
|
|
- name: Show Version
|
|
|
|
working-directory: ${{github.workspace}}/build/cmake
|
2021-07-12 17:47:02 +00:00
|
|
|
run: |
|
|
|
|
${{matrix.vers_command}}
|
2021-05-21 13:08:51 +00:00
|
|
|
|
2021-07-12 17:47:02 +00:00
|
|
|
############################################################
|
|
|
|
# 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.
|
|
|
|
############################################################
|
2021-05-21 13:08:51 +00:00
|
|
|
- uses: ruby/setup-ruby@v1
|
|
|
|
with:
|
|
|
|
ruby-version: 2.7
|
|
|
|
bundler-cache: true
|
2021-08-17 15:52:52 +00:00
|
|
|
|
2021-07-12 17:47:02 +00:00
|
|
|
############################################################
|
|
|
|
# Ensure that dependencies are met.
|
|
|
|
############################################################
|
2021-08-17 15:52:52 +00:00
|
|
|
- name: Bundle Install
|
2021-05-21 13:08:51 +00:00
|
|
|
working-directory: ${{github.workspace}}/regression_testing
|
2021-07-12 17:47:02 +00:00
|
|
|
run: |
|
2021-08-17 15:52:52 +00:00
|
|
|
bundle install
|
2021-05-21 13:08:51 +00:00
|
|
|
|
2021-07-12 17:47:02 +00:00
|
|
|
############################################################
|
|
|
|
# Finally, check for regressions.
|
|
|
|
############################################################
|
2021-05-21 13:08:51 +00:00
|
|
|
- name: Run Regression Test
|
|
|
|
working-directory: ${{github.workspace}}/regression_testing
|
2021-07-12 17:47:02 +00:00
|
|
|
run: |
|
|
|
|
${{matrix.test_command}}
|