130 lines
3.3 KiB
YAML
130 lines
3.3 KiB
YAML
name: Build
|
|
|
|
on:
|
|
push:
|
|
branches: [main, master]
|
|
pull_request:
|
|
branches: [main, master]
|
|
|
|
permissions:
|
|
contents: read
|
|
pages: write
|
|
id-token: write
|
|
|
|
jobs:
|
|
linux:
|
|
name: Linux (static)
|
|
runs-on: ubuntu-24.04
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y \
|
|
build-essential cmake pkg-config \
|
|
libsdl2-dev libfftw3-dev libsndfile1-dev \
|
|
libgl-dev
|
|
|
|
- name: Configure
|
|
run: cmake -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS_RELEASE="-O3 -march=haswell -DNDEBUG"
|
|
|
|
- name: Build
|
|
run: cmake --build build -j$(nproc)
|
|
|
|
- name: Upload artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: baudmine-linux
|
|
path: build/baudmine
|
|
|
|
windows:
|
|
name: Windows
|
|
runs-on: windows-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Cache vcpkg packages
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: ${{ env.VCPKG_INSTALLATION_ROOT }}/installed
|
|
key: vcpkg-x64-windows-${{ hashFiles('.github/workflows/build.yml') }}
|
|
restore-keys: vcpkg-x64-windows-
|
|
|
|
- name: Install vcpkg dependencies
|
|
run: |
|
|
vcpkg install sdl2 fftw3 "libsndfile[core]" --triplet x64-windows
|
|
|
|
- name: Configure
|
|
run: >
|
|
cmake -B build
|
|
-DCMAKE_BUILD_TYPE=Release
|
|
-DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake"
|
|
-DVCPKG_TARGET_TRIPLET=x64-windows
|
|
-DCMAKE_CXX_FLAGS="/O2 /arch:AVX2 /DNDEBUG"
|
|
-DCMAKE_C_FLAGS="/O2 /arch:AVX2 /DNDEBUG"
|
|
|
|
- name: Build
|
|
run: cmake --build build --config Release -j $env:NUMBER_OF_PROCESSORS
|
|
|
|
- name: Upload artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: baudmine-windows
|
|
path: |
|
|
build/Release/baudmine.exe
|
|
build/Release/*.dll
|
|
|
|
wasm:
|
|
name: Web (WASM)
|
|
runs-on: ubuntu-24.04
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Setup Emscripten
|
|
uses: mymindstorm/setup-emsdk@v14
|
|
with:
|
|
version: 5.0.4
|
|
|
|
- name: Configure
|
|
run: emcmake cmake -B build_wasm -C CMakeLists_wasm.cmake -Wno-dev
|
|
|
|
- name: Build
|
|
run: cmake --build build_wasm -j$(nproc)
|
|
|
|
- name: Upload artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: baudmine-web
|
|
path: |
|
|
build_wasm/web/baudmine.html
|
|
build_wasm/web/baudmine.js
|
|
build_wasm/web/baudmine.wasm
|
|
|
|
- name: Prepare Pages
|
|
if: github.event_name == 'push'
|
|
run: |
|
|
mkdir -p _site
|
|
cp build_wasm/web/baudmine.html _site/index.html
|
|
cp build_wasm/web/baudmine.js _site/
|
|
cp build_wasm/web/baudmine.wasm _site/
|
|
|
|
- name: Upload Pages artifact
|
|
if: github.event_name == 'push'
|
|
uses: actions/upload-pages-artifact@v3
|
|
with:
|
|
path: _site
|
|
|
|
deploy:
|
|
name: Deploy to GitHub Pages
|
|
needs: wasm
|
|
if: github.event_name == 'push'
|
|
runs-on: ubuntu-24.04
|
|
environment:
|
|
name: github-pages
|
|
url: ${{ steps.deployment.outputs.page_url }}
|
|
steps:
|
|
- name: Deploy
|
|
id: deployment
|
|
uses: actions/deploy-pages@v4
|