Files
Diagon/.github/workflows/continuous-integration.yaml
T
2021-12-23 01:43:48 +01:00

220 lines
5.6 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:
- master
pull_request:
branches:
- master
jobs:
test:
name: "Tests"
strategy:
matrix:
include:
- name: "Linux GCC"
os: ubuntu-latest
cc: gcc
cxx: g++
test: true
cmake: cmake
- name: "Linux Clang"
os: ubuntu-latest
cc: clang
cxx: clang++
test: true
cmake: cmake
- name: "Linux emscripten"
os: ubuntu-latest
cc: emcc
cxx: "em++"
test: false
cmake: "emcmake cmake"
#- name: "MacOS clang"
#os: macos-latest
#cc: clang
#cxx: clang++
#test: true
#cmake: cmake
#- name: "Windows MSVC"
#os: windows-latest
#cc: cl
#cxx: cl
#test: false
#cmake: cmake
runs-on: ${{ matrix.os }}
steps:
- name: "Checkout repository"
uses: actions/checkout@v2
- name: "Enable MSVC command prompt"
if: matrix.os == 'windows-latest'
uses: ilammy/msvc-dev-cmd@v1
- name: "Install cmake"
uses: lukka/get-cmake@latest
- name: "Install Linux Dependencies"
if: runner.os == 'Linux'
run: sudo apt install libboost-graph-dev uuid-dev
- name: "Install boost for windows"
if: runner.os == 'Windows'
uses: MarkusJx/install-boost@v1.0.1
with:
boost_version: 1.73.0
- name: "Install boost for macOS"
if: runner.os == 'macOS'
run: brew install boost
- name: "Setup Emscripten"
if: ${{ matrix.cc == 'emcc' }}
uses: mymindstorm/setup-emsdk@v7
- name: "Build debug mode"
run: >
mkdir build;
cd build;
${{ matrix.cmake }} ..
-DCMAKE_BUILD_TYPE=Debug
-DCMAKE_C_COMPILER=${{ matrix.cc }}
-DCMAKE_CXX_COMPILER=${{ matrix.cxx }};
cmake --build . --config Release
- 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
cc: clang
cxx: clang++
cmake: cmake
asset_path: build/diagon*Linux*
- name: "Linux emscripten"
os: ubuntu-latest
cc: emcc
cxx: em++
cmake: "emcmake cmake"
asset_path: build/diagon-Web.zip
#- name: "MacOS clang"
#os: macos-latest
#cc: clang
#cxx: clang++
#test: true
#cmake: cmake
#asset_path: build/diagon*Darwin*
#- name: "Windows MSVC"
#os: windows-latest
#cc: cl
#cxx: cl
#test: false
#cmake: cmake
#asset_path: build/diagon*Win64*
runs-on: ${{ matrix.os }}
steps:
- name: "Checkout repository"
uses: actions/checkout@v2
- name: "Enable MSVC command prompt"
if: matrix.os == 'windows-latest'
uses: ilammy/msvc-dev-cmd@v1
- name: "Install cmake"
uses: lukka/get-cmake@latest
- name: "Install Linux Dependencies"
if: runner.os == 'Linux'
run: sudo apt install libboost-graph-dev uuid-dev zip
- name: "Install boost for windows"
if: runner.os == 'Windows'
uses: MarkusJx/install-boost@v1.0.1
with:
boost_version: 1.73.0
- name: "Setup Emscripten"
if: ${{ matrix.cc == 'emcc' }}
uses: mymindstorm/setup-emsdk@v7
- name: "Build release mode"
run: >
mkdir build;
cd build;
${{ matrix.cmake }} ..
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_C_COMPILER=${{ matrix.cc }}
-DCMAKE_CXX_COMPILER=${{ matrix.cxx }};
cmake --build . --config Release;
make package;
- name: "Upload native binaries"
uses: shogo82148/actions-upload-release-asset@v1
if: ${{ matrix.cc != 'emcc'}}
with:
upload_url: ${{ needs.release.outputs.upload_url }}
asset_path: ${{ matrix.asset_path }}
overwrite: true
- name: "Make webAssembly distribution"
if: ${{ matrix.cc == 'emcc' }}
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.cc == 'emcc' }}
uses: shogo82148/actions-upload-release-asset@v1
with:
upload_url: ${{ needs.release.outputs.upload_url }}
asset_path: ${{ matrix.asset_path }}
overwrite: true