Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: split build jobs for platforms & split build-release workflow #66

Merged
merged 5 commits into from
Jan 2, 2025
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
166 changes: 166 additions & 0 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
name: Build release artifacts
on:
workflow_dispatch:
inputs:
upload-artifacts:
type: boolean
default: false
artifacts-retention-days:
type: number
default: 1
workflow_call:
inputs:
upload-artifacts:
type: boolean
default: false
artifacts-retention-days:
type: number
default: 3

jobs:
build-linux-x86_64:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: 'true'
- name: node_modules cache
uses: actions/[email protected]
with:
path: node_modules
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/yarn.lock') }}
- name: externals cache
uses: actions/[email protected]
with:
path: externals
key: ${{ runner.os }}-externals-${{ hashFiles('scripts/prepare-*.sh') }}
- uses: actions/[email protected]
with:
node-version: 20
- name: Install yarn
run: npm install -g yarn
- name: Install dependencies
run: yarn install
- name: Prepare & build
run: |
bash ./scripts/prepare-linux.sh
bash ./scripts/build-linux.sh
- name: Upload build artifacts
if: inputs.upload-artifacts == 'true'
uses: actions/upload-artifact@v4
with:
name: bin-linux-arm64
path: bin
retention-days: ${{ inputs.artifacts-retention-days }}

build-linux-arm64:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: 'true'
- name: node_modules cache
uses: actions/[email protected]
with:
path: node_modules
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/yarn.lock') }}
- name: externals cache
uses: actions/[email protected]
with:
path: externals
key: ${{ runner.os }}-externals-${{ hashFiles('scripts/prepare-*.sh') }}
- uses: actions/[email protected]
with:
node-version: 20
cache: 'yarn'
- name: Install dependencies
run: yarn install
- name: Setup QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: linux/arm64
- name: Prepare & build
run: |
docker run --rm \
-e CMAKE_BUILD_PARALLEL_LEVEL=${{ env.CMAKE_BUILD_PARALLEL_LEVEL }} \
-v $(pwd):/${{ github.workspace }} \
-w /${{ github.workspace }} \
--platform linux/arm64 \
arm64v8/ubuntu:latest \
bash -c "./scripts/prepare-linux.sh && ./scripts/build-linux.sh"
- name: Upload build artifacts
if: inputs.upload-artifacts == 'true'
uses: actions/upload-artifact@v4
with:
name: bin-linux-arm64
path: bin
retention-days: ${{ inputs.artifacts-retention-days }}

build-macos:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-13, macos-14]
steps:
- uses: actions/checkout@v4
with:
submodules: 'true'
- name: node_modules cache
uses: actions/[email protected]
with:
path: node_modules
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/yarn.lock') }}
- name: externals cache
uses: actions/[email protected]
with:
path: externals
key: ${{ runner.os }}-externals-${{ hashFiles('scripts/prepare-*.sh') }}
- uses: actions/[email protected]
with:
node-version: 20
cache: 'yarn'
- name: Install dependencies
run: yarn install
- name: Build (macOS)
run: bash ./scripts/build-macos.sh
- name: Upload build artifacts
if: inputs.upload-artifacts == 'true'
uses: actions/upload-artifact@v4
with:
name: bin-macos
path: bin
retention-days: ${{ inputs.artifacts-retention-days }}

build-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
with:
submodules: 'true'
- name: node_modules cache
uses: actions/[email protected]
with:
path: node_modules
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/yarn.lock') }}
- name: externals cache
uses: actions/[email protected]
with:
path: externals
key: ${{ runner.os }}-externals-${{ hashFiles('scripts/prepare-*.ps1') }}
- uses: actions/[email protected]
with:
node-version: 20
cache: 'yarn'
- name: Install dependencies
run: yarn install
- name: Prepare & build
run: |
powershell ./scripts/prepare-windows.ps1
powershell ./scripts/build-windows.ps1
- name: Upload build artifacts
if: inputs.upload-artifacts == 'true'
uses: actions/upload-artifact@v4
with:
name: bin-windows
path: bin
retention-days: ${{ inputs.artifacts-retention-days }}
68 changes: 4 additions & 64 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,70 +7,10 @@ on:

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-13, macos-14]
steps:
- uses: actions/checkout@v4
with:
submodules: 'true'
- name: Setup QEMU
if: runner.os == 'Linux'
uses: docker/setup-qemu-action@v3
with:
platforms: linux/arm64
- uses: actions/[email protected]
with:
node-version: 20
cache: 'yarn'
- name: node_modules cache
uses: actions/[email protected]
with:
path: node_modules
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/yarn.lock') }}
- name: externals cache
uses: actions/[email protected]
if: runner.os != 'Windows'
with:
path: externals
key: ${{ runner.os }}-externals-${{ hashFiles('scripts/prepare-*.sh') }}
- name: externals cache (Windows)
uses: actions/[email protected]
if: runner.os == 'Windows'
with:
path: externals
key: ${{ runner.os }}-externals-${{ hashFiles('scripts/prepare-*.ps1') }}
- name: Install dependencies
run: yarn install
- name: Prepare & build (Windows)
if: runner.os == 'Windows'
run: |
powershell ./scripts/prepare-windows.ps1
powershell ./scripts/build-windows.ps1
- name: Prepare & build (Linux x86_64)
if: runner.os == 'Linux'
run: |
bash ./scripts/prepare-linux.sh
bash ./scripts/build-linux.sh
- name: Prepare & build (Linux arm64)
if: runner.os == 'Linux'
run: |
docker run --rm \
-v $(pwd):/${{ github.workspace }} \
-w /${{ github.workspace }} \
--platform linux/arm64 \
arm64v8/ubuntu:latest \
bash -c "./scripts/prepare-linux.sh && ./scripts/build-linux.sh"
- name: Build (macOS)
if: runner.os == 'macOS'
run: bash ./scripts/build-macos.sh
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: bin-${{ matrix.os }}
path: bin
retention-days: 3
uses: ./.github/workflows/build-release.yml
with:
upload-artifacts: true
artifacts-retention-days: 3
publish:
permissions:
contents: write
Expand Down
Loading