From 847d2bbdaa1313ae1424cd05df519f34d8af6c09 Mon Sep 17 00:00:00 2001 From: linhsu0723 Date: Wed, 1 Nov 2023 18:34:28 +0800 Subject: [PATCH] A seperate workflow per OS --- .../workflows/{build.yml => build.Linux.yml} | 4 +- .github/workflows/build.Windows.yml | 42 +++++++++++++++++++ .github/workflows/build.macOS.yml | 42 +++++++++++++++++++ README.md | 11 ++++- 4 files changed, 96 insertions(+), 3 deletions(-) rename .github/workflows/{build.yml => build.Linux.yml} (94%) create mode 100644 .github/workflows/build.Windows.yml create mode 100644 .github/workflows/build.macOS.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.Linux.yml similarity index 94% rename from .github/workflows/build.yml rename to .github/workflows/build.Linux.yml index da0aa4a..67f5227 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.Linux.yml @@ -1,4 +1,4 @@ -name: Build +name: Build on Linux on: [push, pull_request] @@ -9,7 +9,7 @@ jobs: strategy: fail-fast: false matrix: - os: [windows-latest, macos-latest, ubuntu-latest] + os: [ubuntu-latest] build_type: [Debug, Release] env: build_dir: "build" diff --git a/.github/workflows/build.Windows.yml b/.github/workflows/build.Windows.yml new file mode 100644 index 0000000..f3286f8 --- /dev/null +++ b/.github/workflows/build.Windows.yml @@ -0,0 +1,42 @@ +name: Build on Windows + +on: [push, pull_request] + +jobs: + build: + name: Build ${{ matrix.os }} ${{ matrix.build_type }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [windows-latest] + build_type: [Debug, Release] + env: + build_dir: "build" + steps: + - name: Install dependencies + shell: bash + run: | + if [[ "${{ runner.os }}" == "Linux" ]] ; then + sudo apt-get update && sudo apt-get install libglu1-mesa-dev xorg-dev + fi + - uses: actions/checkout@v3 + with: + submodules: recursive + - name: CMake + shell: bash + run: | + if [[ "${{ runner.os }}" == "Windows" ]] ; then + cmake . -B ${{ env.build_dir }} + else + cmake . -B ${{ env.build_dir }} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} + fi + - name: Build + working-directory: ${{ env.build_dir }} + shell: bash + run: | + if [[ "${{ runner.os }}" == "Windows" ]] ; then + cmake --build . --config ${{ matrix.build_type }} --target ALL_BUILD --verbose -j + else + cmake --build . --target all --verbose -j + fi diff --git a/.github/workflows/build.macOS.yml b/.github/workflows/build.macOS.yml new file mode 100644 index 0000000..8ab6cdd --- /dev/null +++ b/.github/workflows/build.macOS.yml @@ -0,0 +1,42 @@ +name: Build on macOS + +on: [push, pull_request] + +jobs: + build: + name: Build ${{ matrix.os }} ${{ matrix.build_type }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [macos-latest] + build_type: [Debug, Release] + env: + build_dir: "build" + steps: + - name: Install dependencies + shell: bash + run: | + if [[ "${{ runner.os }}" == "Linux" ]] ; then + sudo apt-get update && sudo apt-get install libglu1-mesa-dev xorg-dev + fi + - uses: actions/checkout@v3 + with: + submodules: recursive + - name: CMake + shell: bash + run: | + if [[ "${{ runner.os }}" == "Windows" ]] ; then + cmake . -B ${{ env.build_dir }} + else + cmake . -B ${{ env.build_dir }} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} + fi + - name: Build + working-directory: ${{ env.build_dir }} + shell: bash + run: | + if [[ "${{ runner.os }}" == "Windows" ]] ; then + cmake --build . --config ${{ matrix.build_type }} --target ALL_BUILD --verbose -j + else + cmake --build . --target all --verbose -j + fi diff --git a/README.md b/README.md index 9a5b381..c364d34 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,15 @@ # subface -[![build](https://github.com/chaosink/subface/workflows/build/badge.svg)](https://github.com/chaosink/subface/actions/workflows/build.yml) +[![build][1]][2] +[![build][3]][4] +[![build][5]][6] + +[1]: https://github.com/chaosink/subface/actions/workflows/build.Linux.yml/badge.svg +[2]: https://github.com/chaosink/subface/actions/workflows/build.Linux.yml +[3]: https://github.com/chaosink/subface/actions/workflows/build.macOS.yml/badge.svg +[4]: https://github.com/chaosink/subface/actions/workflows/build.macOS.yml +[5]: https://github.com/chaosink/subface/actions/workflows/build.Windows.yml/badge.svg +[6]: https://github.com/chaosink/subface/actions/workflows/build.Windows.yml A collection of triangle mesh subdivision/tessellation/decimation implementations.