Add basic CI

This commit is contained in:
captainurist 2023-03-08 20:50:20 +08:00
parent 8b6b7d878c
commit 3606e7f970
3 changed files with 114 additions and 0 deletions

39
.github/workflows/linux.yml vendored Normal file
View File

@ -0,0 +1,39 @@
name: Linux
on:
pull_request:
push:
release:
types: [published]
jobs:
build_linux:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
configuration: [Debug, Release]
architecture: [x64]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y gcc-12 g++-12
- name: Configure
run: |
export CC=gcc-12 && export CXX=g++-12
cmake -B build -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=${{ matrix.configuration }}
- name: Build
working-directory: build
run: |
make -j$(nproc)
- name: Test
working-directory: build
run: |
ctest

33
.github/workflows/macos.yml vendored Normal file
View File

@ -0,0 +1,33 @@
name: MacOS
on:
pull_request:
push:
release:
types: [published]
jobs:
build_macos:
runs-on: macos-12
strategy:
fail-fast: false
matrix:
configuration: [Debug, Release]
architecture: [x64]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Configure
run: |
cmake -B build -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=${{ matrix.configuration }}
- name: Build
working-directory: build
run: |
make -j$(sysctl -n hw.logicalcpu)
- name: Test
working-directory: build
run: |
ctest

42
.github/workflows/windows.yml vendored Normal file
View File

@ -0,0 +1,42 @@
name: Windows
on:
pull_request:
push:
release:
types: [published]
jobs:
build_windows:
runs-on: windows-2022
strategy:
fail-fast: false
matrix:
configuration: [Debug, Release]
architecture: [x64]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup environment
uses: ilammy/msvc-dev-cmd@v1
with:
arch: ${{ matrix.architecture }}
- name: Setup ninja
uses: seanmiddleditch/gha-setup-ninja@v3
- name: Configure
run: |
cmake -B build -G "Ninja" -DCMAKE_BUILD_TYPE=${{ matrix.configuration }}
- name: Build
working-directory: build
shell: cmd
run: |
ninja
- name: Test
working-directory: build
run: |
ctest