Skip to content

build: use a single Makefile #206

build: use a single Makefile

build: use a single Makefile #206

Workflow file for this run

name: Build
on:
push:
paths-ignore: ['**/*.md']
pull_request:
branches: [main]
paths-ignore: ['**/*.md']
jobs:
setup:
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Bundle WebUI Bridge
if: runner.os != 'Windows'
run: |
npm i -g esbuild
bridge/build.sh
- name: Bundle WebUI Bridge on Windows
if: runner.os == 'Windows'
run: bridge/build.ps1
- uses: actions/cache@v3
with:
path: bridge/webui_bridge.h
key: ${{ runner.os }}-${{ github.sha }}-client
windows:
needs: setup
runs-on: windows-latest
permissions:
contents: write
strategy:
matrix:
compiler: [GCC, MSVC]
fail-fast: false
steps:
- uses: actions/checkout@v3
- uses: actions/cache/restore@v3
with:
path: bridge/webui_bridge.h
key: ${{ runner.os }}-${{ github.sha }}-client
fail-on-cache-miss: true
- uses: microsoft/[email protected]
- if: ${{ matrix.compiler == 'MSVC' }}
uses: ilammy/msvc-dev-cmd@v1
- name: Build
run: |
mkdir dist
if ('${{ matrix.compiler }}' -eq 'MSVC') {
nmake -f Makefile.nmake
} else {
mingw32-make
}
- name: Prepare Artifact
shell: bash
run: |
cp -r include dist
artifact=${{ runner.os }}-${{ matrix.compiler }}-x64
# Add the ARTIFACT name(`,,` ^= lowercase shell param) as GitHub environment variable.
echo "ARTIFACT=${artifact,,}" >> $GITHUB_ENV
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: ${{ env.ARTIFACT }}
path: dist
- name: Release Artifact
if: github.ref_type == 'tag'
uses: softprops/action-gh-release@v1
with:
files: ${{ env.ARTIFACT }}
linux:
needs: setup
runs-on: ubuntu-latest
permissions:
contents: write
strategy:
matrix:
compiler: [GCC, Clang]
fail-fast: false
steps:
- uses: actions/checkout@v3
- uses: actions/cache/restore@v3
with:
path: bridge/webui_bridge.h
key: ${{ runner.os }}-${{ github.sha }}-client
fail-on-cache-miss: true
- name: Build
run: |
if [ "${{ matrix.compiler }}" == "Clang" ]; then
sudo ln -s llvm-ar-13 /usr/bin/llvm-ar
sudo ln -s llvm-ranlib-13 /usr/bin/llvm-ranlib
fi
make
- name: Prepare Artifact
run: |
cp -r include dist
artifact=${{ runner.os }}-${{ matrix.compiler }}-x64
# Add the ARTIFACT name(`,,` ^= lowercase shell param) as GitHub environment variable.
echo "ARTIFACT=${artifact,,}" >> $GITHUB_ENV
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: ${{ env.ARTIFACT }}
path: dist
- name: Release Artifact
if: github.ref_type == 'tag'
uses: softprops/action-gh-release@v1
with:
files: ${{ env.ARTIFACT }}
macOS:
needs: setup
runs-on: macos-latest
name: macOS
permissions:
contents: write
strategy:
matrix:
compiler: [Clang]
steps:
- uses: actions/checkout@v3
- uses: actions/cache/restore@v3
with:
path: bridge/webui_bridge.h
key: ${{ runner.os }}-${{ github.sha }}-client
fail-on-cache-miss: true
- name: Build
run: |
make
- name: Prepare Artifacts
run: |
cp -r include dist
# Add the ARTIFACT name(lowercased) as GitHub environment variable.
artifact=$(echo ${{ runner.os }}-${{ matrix.compiler }}-x64 | tr '[:upper:]' '[:lower:]')
echo "ARTIFACT=$artifact" >> $GITHUB_ENV
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: ${{ env.ARTIFACT }}
path: dist
- name: Release Artifact
if: github.ref_type == 'tag'
uses: softprops/action-gh-release@v1
with:
files: ${{ env.ARTIFACT }}