GitHub Actions, fuck you and your Node.js crap. #22
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: MeshOptimizer | |
on: [push, pull_request] | |
# Cancel in-progress builds on push to same branch / PR | |
# https://stackoverflow.com/a/72408109 | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
env: | |
# FFS, BEWARE, 0.20 etc without quotes gets interpreted as 0.2. Who asked for | |
# numeric support in a config language?! | |
MESHOPTIMIZER_VERSION: "0.21" | |
jobs: | |
windows: | |
name: ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [windows-2019] | |
steps: | |
- name: Install Ninja | |
uses: seanmiddleditch/gha-setup-ninja@v5 | |
- name: Set up Visual Studio environment | |
uses: compnerd/gha-setup-vsdevenv@v6 | |
- name: Clone MeshOptimizer | |
uses: actions/checkout@v4.1.7 | |
with: | |
repository: zeux/meshoptimizer | |
ref: v${{ env.MESHOPTIMIZER_VERSION }} | |
path: meshoptimizer | |
- name: Build & install Debug | |
shell: cmd | |
run: | | |
cmake ^ | |
-DCMAKE_C_COMPILER=cl.exe ^ | |
-DCMAKE_BUILD_TYPE=Debug ^ | |
-DCMAKE_INSTALL_PREFIX=%CD:\=/%/install-debug ^ | |
-G Ninja -S meshoptimizer -B meshoptimizer-build-debug | |
ninja -C meshoptimizer-build-debug install | |
- name: Build & install Release | |
shell: cmd | |
run: | | |
cmake ^ | |
-DCMAKE_C_COMPILER=cl.exe ^ | |
-DCMAKE_BUILD_TYPE=Release ^ | |
-DCMAKE_INSTALL_PREFIX=%CD:\=/%/install ^ | |
-G Ninja -S meshoptimizer -B meshoptimizer-build | |
ninja -C meshoptimizer-build install | |
- name: Upload Debug artifacts | |
uses: actions/upload-artifact@v4.3.3 | |
with: | |
name: meshoptimizer-${{ env.MESHOPTIMIZER_VERSION }}-${{ matrix.os }}-debug | |
path: install-debug | |
- name: Upload Release artifacts | |
uses: actions/upload-artifact@v4.3.3 | |
with: | |
name: meshoptimizer-${{ env.MESHOPTIMIZER_VERSION }}-${{ matrix.os }} | |
path: install | |
windows-mingw: | |
name: windows-mingw | |
runs-on: windows-2019 | |
steps: | |
- name: Install Ninja | |
uses: seanmiddleditch/gha-setup-ninja@v5 | |
- name: Set up MinGW environment | |
uses: msys2/setup-msys2@v2 | |
- name: Clone MeshOptimizer | |
uses: actions/checkout@v4.1.7 | |
with: | |
repository: zeux/meshoptimizer | |
ref: v${{ env.MESHOPTIMIZER_VERSION }} | |
path: meshoptimizer | |
- name: Build & install | |
shell: cmd | |
run: | | |
cmake ^ | |
-DCMAKE_C_COMPILER=gcc.exe ^ | |
-DCMAKE_BUILD_TYPE=Release ^ | |
-DCMAKE_INSTALL_PREFIX=%CD:\=/%/install ^ | |
-G Ninja -S meshoptimizer -B meshoptimizer-build | |
ninja -C meshoptimizer-build install/strip | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4.3.3 | |
with: | |
name: meshoptimizer-${{ env.MESHOPTIMIZER_VERSION }}-windows-mingw | |
path: install | |
ubuntu: | |
name: ${{ matrix.os }} | |
runs-on: ${{ matrix.runs-on }} | |
container: ${{ matrix.container }} | |
strategy: | |
matrix: | |
include: | |
- os: ubuntu-18.04 | |
runs-on: ubuntu-latest | |
container: ubuntu:bionic-20220427 | |
steps: | |
- name: Install base build tools | |
# apt update is needed to fetch package lists | |
run: | | |
apt update | |
apt install -y ninja-build cmake g++ git | |
- name: Clone MeshOptimizer | |
# actions/checkout@v2 and any newer uses a Node version that doesn't work | |
# on Ubuntu 18.04, v1 on the other hand clones to some completely insane | |
# location. Let's just ditch that crap. | |
run: | | |
git clone https://github.com/zeux/meshoptimizer | |
cd meshoptimizer && git checkout v${{ env.MESHOPTIMIZER_VERSION }} | |
- name: Build & install | |
run: | | |
mkdir meshoptimizer-build && cd meshoptimizer-build | |
cmake ../meshoptimizer \ | |
-DCMAKE_BUILD_TYPE=Release \ | |
-DCMAKE_INSTALL_PREFIX=$(pwd)/../install \ | |
-G Ninja | |
ninja install/strip | |
- name: Upload artifacts | |
# upload-artifact v4 uses Node 20 which doesn't work on Ubuntu 18.04, v3 | |
# silently switched to a newer Node as well, FFS | |
uses: actions/upload-artifact@v1 | |
with: | |
name: meshoptimizer-${{ env.MESHOPTIMIZER_VERSION }}-${{ matrix.os }} | |
path: install | |
mac: | |
name: ${{ matrix.os }} | |
runs-on: ${{ matrix.runs-on }} | |
strategy: | |
matrix: | |
include: | |
- os: macos12-x64-arm64 | |
runs-on: macos-12 | |
steps: | |
- name: Install base build tools | |
run: | | |
brew install ninja | |
- name: Clone MeshOptimizer | |
uses: actions/checkout@v4.1.7 | |
with: | |
repository: zeux/meshoptimizer | |
ref: v${{ env.MESHOPTIMIZER_VERSION }} | |
path: meshoptimizer | |
- name: Build & install | |
run: | | |
mkdir meshoptimizer-build && cd meshoptimizer-build | |
cmake ../meshoptimizer \ | |
-DCMAKE_BUILD_TYPE=Release \ | |
-DCMAKE_INSTALL_PREFIX=$(pwd)/../install \ | |
-DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" \ | |
-DCMAKE_OSX_DEPLOYMENT_TARGET="11.0" \ | |
-DCMAKE_CXX_FLAGS="-fvisibility=hidden -fvisibility-inlines-hidden" \ | |
-G Ninja | |
ninja install/strip | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4.3.3 | |
with: | |
name: meshoptimizer-${{ env.MESHOPTIMIZER_VERSION }}-${{ matrix.os }} | |
path: install |