Add clang and latest gcc to CI system #115
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | ||
on: | ||
push: | ||
branches: [main] | ||
release: | ||
types: [published] | ||
branches: [main] | ||
pull_request: | ||
workflow_dispatch: | ||
env: | ||
VCPKG_ROOT: "vcpkg" | ||
VCPKG_BINARY_SOURCES: "clear;nuget,GitHub,readwrite" | ||
LINUX_RUNNER: ubuntu-22.04 | ||
DEFAULT_UBUNTU_GCC_VERSION: 11 # update this if you change LINUX_RUNNER | ||
WINDOWS_RUNNER: windows-2022 | ||
jobs: | ||
qa: | ||
name: Run pre-commit hooks | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: pre-commit/action@v3.0.0 | ||
build: | ||
name: Build and test | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- platform: linux | ||
os: ${{env.LINUX_RUNNER}} | ||
Check failure on line 35 in .github/workflows/ci.yml GitHub Actions / CIInvalid workflow file
|
||
compiler: gcc | ||
- platform: linux | ||
os: ${{env.LINUX_RUNNER}} | ||
compiler: clang | ||
- platform: windows | ||
os: ${{env.WINDOWS_RUNNER}} | ||
compiler: msvc | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up MSVC (Windows) | ||
if: matrix.platform == 'windows' | ||
uses: ilammy/msvc-dev-cmd@v1 | ||
with: | ||
arch: x64 | ||
- name: Install dependencies (Linux) | ||
if: matrix.platform == 'linux' | ||
run: | | ||
sudo apt update | ||
sudo apt upgrade -y | ||
sudo apt install --no-install-recommends build-essential libtbb-dev ninja-build doxygen graphviz | ||
# Double check that the default version is what we think it is | ||
GCC_MAJOR_VER=`gcc -dumpversion|sed -E 's/^([0-9]+)\./.*$\1/'` | ||
test $GCC_MAJOR_VER -eq $DEFAULT_UBUNTU_GCC_VERSION | ||
- name: Install clang (Linux) | ||
if: matrix.platform == 'linux' && matrix.compiler == 'clang' | ||
run: | | ||
sudo apt install --no-install-recommends clang | ||
# Use environment variable to tell CMake to compile with clang | ||
echo "CXX=clang++" >> "$GITHUB_ENV" | ||
- name: Install VCPKG | ||
run: | | ||
git clone https://github.com/Microsoft/vcpkg.git | ||
cd vcpkg | ||
./bootstrap-vcpkg.sh -disableMetrics | ||
- uses: ammaraskar/gcc-problem-matcher@master | ||
- name: Build HealthGPS (debug) | ||
run: | | ||
cmake --preset=${{ matrix.platform }}-debug -DWARNINGS_AS_ERRORS=ON | ||
cmake --build --preset=debug-build-${{ matrix.platform }} --target=install | ||
- name: Build HealthGPS (release) | ||
if: "!cancelled()" # Run this step, even if the previous one fails | ||
run: | | ||
cmake --preset=${{ matrix.platform }}-release -DWARNINGS_AS_ERRORS=ON | ||
cmake --build --preset=release-build-${{ matrix.platform }} --target=install | ||
- name: Upload artifacts | ||
if: matrix.compiler != 'clang' | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: health-gps-${{ matrix.platform }} | ||
path: | | ||
${{ github.workspace }}/out/install/${{ matrix.platform }}-*/* | ||
- name: Run tests | ||
run: ctest --preset=core-test-${{ matrix.platform }} | ||
- name: Zip output folder | ||
if: startsWith(github.ref, 'refs/tags/') && matrix.compiler != 'clang' | ||
working-directory: ${{github.workspace}}/out/install/${{ matrix.platform }}-release/bin/ | ||
run: | | ||
mkdir ${{github.workspace}}/artifact | ||
7z a -tzip ${{github.workspace}}/artifact/health_gps_${{ matrix.platform }}.zip *.dll *.Console* | ||
- name: Upload release artifacts | ||
if: startsWith(github.ref, 'refs/tags/') && matrix.compiler != 'clang' | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
files: artifact/health_gps_${{ matrix.platform }}.zip | ||
- name: Doxygen release API deploy | ||
if: matrix.platform == 'linux' && matrix.compiler != 'clang' && startsWith(github.ref, 'refs/tags/') | ||
uses: peaceiris/actions-gh-pages@v3 | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
publish_dir: ${{github.workspace}}/out/build/linux-release/src/html | ||
destination_dir: html | ||
enable_jekyll: true | ||
commit_message: ${{ github.ref_name }} - ${{ github.event.head_commit.message }} |