Files
Diagon/.github/workflows/continuous-integration.yaml
T
ArthurSonzogni deb4f5f208 Remove MacOS testing.
It is failing installing gcovr
https://github.com/aminya/setup-cpp/issues/246
2024-06-28 08:32:17 +02:00

343 lines
8.9 KiB
YAML
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
name: Build and run tests
on:
create:
tags:
-v*
push:
branches:
- main
pull_request:
branches:
- main
jobs:
test:
name: "Tests"
strategy:
fail-fast: false
matrix:
include:
- name: "Linux GCC"
os: ubuntu-latest
compiler: gcc
test: true
- name: "Linux Clang"
os: ubuntu-latest
compiler: llvm
test: true
#- name: "MacOS clang"
#os: macos-latest
#test: true
#compiler: llvm
- name: "Windows"
os: windows-latest
compiler: cl
- name: "WebAssembly"
os: ubuntu-latest
emscripten: true
runs-on: ${{ matrix.os }}
steps:
- name: "Checkout repository"
uses: actions/checkout@v2
- name: "Setup Cpp"
uses: aminya/setup-cpp@v1
with:
compiler: ${{ matrix.compiler }}
vcvarsall: ${{ contains(matrix.os, 'windows' )}}
cmake: true
ninja: true
clangtidy: false
cppcheck: false
gcovr: "5.0"
opencppcoverage: false
- name: "Setup Java"
uses: actions/setup-java@v3
with:
distribution: "temurin"
java-version: '17'
check-latest: true
- name: "Install Linux Dependencies"
if: ${{ runner.os == 'Linux' }}
run: sudo apt install libboost-graph-dev
- name: "Install boost for windows"
if: ${{ runner.os == 'Windows' }}
uses: MarkusJx/install-boost@v2.4.4
with:
boost_version: 1.81.0
platform_version: 2022
toolset: msvc
- name: "Install dependencies for macOS"
if: ${{ runner.os == 'macOS' }}
run: |
brew install gcc
brew install boost
- name: "Setup Emscripten"
if: ${{ matrix.emscripten }}
uses: mymindstorm/setup-emsdk@v7
- name: "Configure emscripten"
if: ${{ matrix.emscripten }}
run: >
emcmake cmake -S .
-B ./build
-DCMAKE_BUILD_TYPE:STRING=Debug
-DDIAGON_BUILD_TESTS:BOOL=OFF
-DDIAGON_BUILD_TESTS_FUZZER:BOOL=OFF;
- name: "Configure build only"
if: ${{ !matrix.emscripten && !matrix.test}}
run: >
cmake -S .
-B ./build
-DCMAKE_BUILD_TYPE:STRING=Debug
-DDIAGON_BUILD_TESTS:BOOL=OFF
-DDIAGON_BUILD_TESTS_FUZZER:BOOL=OFF;
- name: "Configure buil and tests"
if: ${{ !matrix.emscripten && matrix.test}}
run: >
cmake -S .
-B ./build
-DCMAKE_BUILD_TYPE:STRING=Debug
-DDIAGON_BUILD_TESTS:BOOL=ON
-DDIAGON_BUILD_TESTS_FUZZER:BOOL=OFF;
- name: "Build"
run: >
cmake --build ./build;
- name: "Run tests"
if: ${{ matrix.test}}
run: >
cd build;
./input_output_test;
# Create a release on new v* tags
release:
needs: test
if: ${{ github.event_name == 'create' && startsWith(github.ref, 'refs/tags/v') }}
name: "Create release"
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- name: "Create release"
uses: softprops/action-gh-release@v1
id: create_release
with:
draft: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Build artifact for the release
package:
name: "Build packages"
needs: release
strategy:
matrix:
include:
- name: "Linux Clang"
os: ubuntu-latest
compiler: llvm
asset_path: build/diagon*Linux*
- name: "WebAssembly"
os: ubuntu-latest
emscripten: true
asset_path: build/diagon-Web.zip
- name: "MacOS"
os: macos-latest
compiler: llvm
asset_path: build/diagon*Darwin*
- name: "Windows"
os: windows-latest
compiler: cl
asset_path: build/diagon*Win64*
runs-on: ${{ matrix.os }}
steps:
- name: "Checkout repository"
uses: actions/checkout@v2
- name: "Setup Cpp"
uses: aminya/setup-cpp@v1
with:
compiler: ${{ matrix.compiler }}
vcvarsall: ${{ contains(matrix.os, 'windows' )}}
cmake: true
ninja: true
clangtidy: false
cppcheck: false
gcovr: "5.0"
opencppcoverage: false
- name: "Setup Java"
uses: actions/setup-java@v3
with:
distribution: "temurin"
java-version: '17'
check-latest: true
- name: "Install Linux Dependencies"
if: ${{ runner.os == 'Linux' }}
run: sudo apt install libboost-graph-dev
- name: "Install boost for windows"
if: ${{ runner.os == 'Windows' }}
uses: MarkusJx/install-boost@v2.4.4
with:
boost_version: 1.81.0
platform_version: 2022
toolset: msvc
- name: "Install dependencies for macOS"
if: ${{ runner.os == 'macOS' }}
run: |
brew install gcc
brew install boost
- name: "Setup Emscripten"
if: ${{ matrix.emscripten }}
uses: mymindstorm/setup-emsdk@v7
- name: "Configure cmake with emscripten"
if: ${{ matrix.emscripten }}
run: >
emcmake cmake -S .
-B ./build
-DCMAKE_BUILD_TYPE:STRING=Release
-DDIAGON_BUILD_TESTS:BOOL=OFF
-DDIAGON_BUILD_TESTS_FUZZER:BOOL=OFF;
- name: "Configure CMake"
if: ${{ !matrix.emscripten }}
run: >
cmake -S .
-B ./build
-DCMAKE_BUILD_TYPE:STRING=Release
-DDIAGON_BUILD_TESTS:BOOL=OFF
-DDIAGON_BUILD_TESTS_FUZZER:BOOL=OFF;
- name: "Build"
run: >
cmake
--build ./build
--target package;
- name: "Upload native binaries"
uses: shogo82148/actions-upload-release-asset@v1
if: ${{ !matrix.emscripten }}
with:
upload_url: ${{ needs.release.outputs.upload_url }}
asset_path: ${{ matrix.asset_path }}
overwrite: true
- name: "Make webAssembly distribution"
if: ${{ matrix.emscripten }}
run: >
cd build;
mkdir -p diagon-Web;
cp diagon.js diagon-Web;
cp diagon*wasm diagon-Web;
cp index.html diagon-Web;
cp style.css diagon-Web;
cp run_diagon.sh diagon-Web;
chmod a+x ./diagon-Web/run_diagon.sh;
zip -r diagon-Web.zip diagon-Web;
- name: "Upload WebAssembly distribution"
if: ${{ matrix.emscripten }}
uses: shogo82148/actions-upload-release-asset@v1
with:
upload_url: ${{ needs.release.outputs.upload_url }}
asset_path: ${{ matrix.asset_path }}
overwrite: true
# Create a release on new v* tags
publish:
needs: test
name: "Publish website"
runs-on: ubuntu-latest
steps:
- name: "Checkout repository"
uses: actions/checkout@v2
- name: "Setup Cpp"
uses: aminya/setup-cpp@v1
with:
compiler: ${{ matrix.compiler }}
vcvarsall: ${{ contains(matrix.os, 'windows' )}}
cmake: true
ninja: true
clangtidy: false
cppcheck: false
gcovr: "5.0"
opencppcoverage: false
- name: "Setup Java"
uses: actions/setup-java@v3
with:
distribution: "temurin"
java-version: '17'
check-latest: true
- name: "Install Linux Dependencies"
run: sudo apt install libboost-graph-dev
- name: "Setup Emscripten"
uses: mymindstorm/setup-emsdk@v7
- name: "Configure cmake with emscripten"
run: >
emcmake cmake -S .
-B ./build
-DCMAKE_BUILD_TYPE:STRING=Release
-DDIAGON_BUILD_TESTS:BOOL=OFF
-DDIAGON_BUILD_TESTS_FUZZER:BOOL=OFF;
- name: "Configure CMake"
if: ${{ !matrix.emscripten }}
run: >
cmake -S .
-B ./build
-DCMAKE_BUILD_TYPE:STRING=Release
-DDIAGON_BUILD_TESTS:BOOL=OFF
-DDIAGON_BUILD_TESTS_FUZZER:BOOL=OFF;
- name: "Build"
run: >
cmake
--build ./build
--target package;
- name: "Make webAssembly distribution"
run: >
cd build;
mkdir -p diagon-Web;
cp diagon.js diagon-Web;
cp diagon*wasm diagon-Web;
cp index.html diagon-Web;
cp style.css diagon-Web;
echo "diagon.arthursonzogni.com" > diagon-Web/CNAME;
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./build/diagon-Web
publish_branch: gh-pages
force_orphan: true