ci: merge workflows & add arm64-linux build. (#8)

This commit is contained in:
2025-05-11 01:09:43 +08:00
committed by GitHub
parent bac5a060d2
commit f2534d54a5
4 changed files with 88 additions and 165 deletions

88
.github/workflows/build.yml vendored Normal file
View File

@@ -0,0 +1,88 @@
name: Build
on:
push:
paths:
- .github/workflows/build.yml
- src/**
- xmake.lua
workflow_dispatch:
env:
XMAKE_VERSION: "2.9.9"
jobs:
build:
strategy:
fail-fast: false
matrix:
mode: [debug, release]
plat:
- os: linux
toolchain: gcc-14 # c++23 <print> requires gcc 14.
arch: x86_64
runner: ubuntu-latest
- os: linux
toolchain: gcc-14
arch: arm64
runner: ubuntu-24.04-arm
- os: macosx
toolchain: xcode
arch: arm64
runner: macos-latest
- os: windows
toolchain: clang
arch: x64
runner: windows-latest
runs-on: ${{ matrix.plat.runner }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Restore xmake cache
if: matrix.plat.os != 'windows'
uses: actions/cache@v4
with:
path: |
~/.xmake
./.xmake-dest
key: xmake-${{ matrix.plat.os }}-${{ matrix.plat.arch }}-${{ hashFiles('xmake.lua') }}
restore-keys: |
xmake-${{ matrix.plat.os }}-${{ matrix.plat.arch }}-
- name: Restore xmake cache (Windows)
if: matrix.plat.os == 'windows'
uses: actions/cache@v4
with:
path: |
~/AppData/Local/.xmake
./.xmake-dest
key: xmake-${{ matrix.plat.os }}-${{ matrix.plat.arch }}-${{ hashFiles('xmake.lua') }}
restore-keys: |
xmake-${{ matrix.plat.os }}-${{ matrix.plat.arch }}-
- name: Setup xmake
uses: xmake-io/github-action-setup-xmake@v1
with:
xmake-version: ${{ env.XMAKE_VERSION }}
actions-cache-folder: "./.xmake-dest"
- name: Configure
run: |
xmake f -a ${{ matrix.plat.arch }} -m ${{ matrix.mode }} -p ${{ matrix.plat.os }} --toolchain=${{ matrix.plat.toolchain }} -vD -y
- name: Build
run: |
xmake -vD -y
- name: Cleanup
run: |
xrepo clean
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: debuginfo-${{ matrix.mode }}-${{ matrix.plat.os }}-${{ matrix.plat.arch }}-${{ github.sha }}
path: |
build/${{ matrix.plat.os }}/${{ matrix.plat.arch }}/${{ matrix.mode }}

View File

@@ -1,55 +0,0 @@
name: Build (Linux)
on:
push:
paths:
- .github/workflows/build_linux.yml
- src/**
- xmake.lua
workflow_dispatch:
jobs:
build:
strategy:
matrix:
mode: [debug, release]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Restore xmake cache
uses: actions/cache@v4
with:
path: |
~/.xmake
./.xmake-dest
key: xmake-linux-${{ hashFiles('xmake.lua') }}
restore-keys: |
xmake-linux-
- name: Setup xmake
uses: xmake-io/github-action-setup-xmake@v1
with:
xmake-version: "2.9.9"
actions-cache-folder: "./.xmake-dest"
- name: Configure
run: |
# c++23 <print> requires gcc 14.
xmake f -a x64 -m ${{ matrix.mode }} -p linux --toolchain=gcc-14 -vD -y
- name: Build
run: |
xmake -vD -y
- name: Cleanup
run: |
xrepo clean
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: debuginfo-${{ matrix.mode }}-linux-x64-${{ github.sha }}
path: |
build/linux/x64/${{ matrix.mode }}

View File

@@ -1,55 +0,0 @@
name: Build (MacOS)
on:
push:
paths:
- .github/workflows/build_macos.yml
- src/**
- xmake.lua
workflow_dispatch:
jobs:
build:
strategy:
matrix:
mode: [release, debug]
arch: [arm64]
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Restore xmake cache
uses: actions/cache@v4
with:
path: |
~/.xmake
./.xmake-dest
key: xmake-macos-${{ hashFiles('xmake.lua') }}
restore-keys: |
xmake-macos-
- name: Setup xmake
uses: xmake-io/github-action-setup-xmake@v1
with:
xmake-version: "2.9.9"
actions-cache-folder: "./.xmake-dest"
- name: Configure
run: |
xmake f -a ${{ matrix.arch }} -m ${{ matrix.mode }} -p macosx -vD -y
- name: Build
run: |
xmake -vD -y
- name: Cleanup
run: |
xrepo clean
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: debuginfo-macosx-${{ matrix.arch }}-${{ matrix.mode }}
path: |
build/macosx/${{ matrix.arch }}/${{ matrix.mode }}

View File

@@ -1,55 +0,0 @@
name: Build (Windows)
on:
push:
paths:
- .github/workflows/build_windows.yml
- src/**
- xmake.lua
workflow_dispatch:
jobs:
build:
strategy:
matrix:
mode: [release, debug]
arch: [x64]
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup xmake
uses: xmake-io/github-action-setup-xmake@v1
with:
xmake-version: "2.9.9"
actions-cache-folder: "./.xmake-dest"
- name: Restore xmake cache
uses: actions/cache@v4
with:
path: |
~/AppData/Local/.xmake
./.xmake-dest
key: xmake-windows-${{ matrix.arch }}-${{ hashFiles('xmake.lua') }}
restore-keys: |
xmake-windows-${{ matrix.arch }}-
- name: Configure
run: |
xmake f -a ${{ matrix.arch }} -m ${{ matrix.mode }} -p windows -vD -y --toolchain=clang
- name: Build
run: |
xmake -vD -y
- name: Cleanup
run: |
xrepo clean
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: debuginfo-windows-${{ matrix.arch }}-${{ matrix.mode }}
path: |
build/windows/${{ matrix.arch }}/${{ matrix.mode }}