From c3c991a24a95dd355c79518f1412e9bbe6728665 Mon Sep 17 00:00:00 2001 From: syby119 Date: Sun, 19 Feb 2023 06:57:21 +0800 Subject: [PATCH] Use github actions for CI/CD --- .github/workflows/build.yml | 97 +++++++++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..67b5cad --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,97 @@ +name: Build + +on: + push: + branches: [ "main", "web" ] + pull_request: + branches: [ "main", "web" ] + workflow_dispatch: + +env: + BUILD_TYPE: Release + +jobs: + build-linux: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + with: + submodules: recursive + + - name: Install dependencies + run: | + sudo apt update + sudo apt install libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libxext-dev + sudo apt install libgl-dev + + - name: Configure CMake + run: cmake -Bbuild . -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} + + - name: Build + run: cmake --build build --config ${{env.BUILD_TYPE}} --parallel + + build-mac: + runs-on: macos-latest + + steps: + - uses: actions/checkout@v3 + with: + submodules: recursive + + - name: Config CMake + run: cmake -Bbuild . -G Xcode -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} + + - name: Build + run: cmake --build build --config ${{env.BUILD_TYPE}} --parallel + + build-windows-vs: + runs-on: windows-latest + + steps: + - uses: actions/checkout@v3 + with: + submodules: recursive + + - name: Configure CMake with Visual Studio + run: cmake -Bbuild . -G "Visual Studio 17 2022" -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} + + - name: Build with Visual Studio + run: cmake --build build --config ${{env.BUILD_TYPE}} --parallel + + build-windows-mingw: + runs-on: windows-latest + + steps: + - uses: actions/checkout@v3 + with: + submodules: recursive + + - name: Configure CMake + run: cmake -Bbuild . -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} + + - name: Build + run: cmake --build build --config ${{env.BUILD_TYPE}} + + build-web: + if: ${{ github.ref == 'refs/heads/web' }} + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + with: + submodules: recursive + + - name: Install and activate emsdk + run: | + git clone --depth=1 https://github.com/emscripten-core/emsdk.git + cd emsdk + ./emsdk install latest + ./emsdk activate latest + source ./emsdk_env.sh + echo "$PATH" >> $GITHUB_PATH + cd .. + + - name: Build + run: | + python3 build_webassembly.py \ No newline at end of file