From f2534d54a54f75a2af678e437ed804fa019e438e Mon Sep 17 00:00:00 2001 From: RedbeanW Date: Sun, 11 May 2025 01:09:43 +0800 Subject: [PATCH] ci: merge workflows & add arm64-linux build. (#8) --- .github/workflows/build.yml | 88 +++++++++++++++++++++++++++++ .github/workflows/build_linux.yml | 55 ------------------ .github/workflows/build_macos.yml | 55 ------------------ .github/workflows/build_windows.yml | 55 ------------------ 4 files changed, 88 insertions(+), 165 deletions(-) create mode 100644 .github/workflows/build.yml delete mode 100644 .github/workflows/build_linux.yml delete mode 100644 .github/workflows/build_macos.yml delete mode 100644 .github/workflows/build_windows.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..6afbf76 --- /dev/null +++ b/.github/workflows/build.yml @@ -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 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 }} diff --git a/.github/workflows/build_linux.yml b/.github/workflows/build_linux.yml deleted file mode 100644 index d0b8ef4..0000000 --- a/.github/workflows/build_linux.yml +++ /dev/null @@ -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 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 }} diff --git a/.github/workflows/build_macos.yml b/.github/workflows/build_macos.yml deleted file mode 100644 index 613a08d..0000000 --- a/.github/workflows/build_macos.yml +++ /dev/null @@ -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 }} diff --git a/.github/workflows/build_windows.yml b/.github/workflows/build_windows.yml deleted file mode 100644 index 9474dae..0000000 --- a/.github/workflows/build_windows.yml +++ /dev/null @@ -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 }}