Skip to content

Commit

Permalink
[CI] Improve Linux CI
Browse files Browse the repository at this point in the history
  • Loading branch information
Arthapz committed Nov 3, 2024
1 parent a4be5aa commit 8763c54
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 24 deletions.
69 changes: 49 additions & 20 deletions .github/workflows/Linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ jobs:
runs-on: ${{ matrix.os }}

concurrency:
group: ${{ github.ref }}-${{ github.base_ref }}-${{ github.head_ref }}-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.kind }}-${{ matrix.mode }}
group: ${{ github.ref }}-${{ github.base_ref }}-${{ github.head_ref }}-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.kind
}}-${{ matrix.mode }}

steps:
- name: Get current date as package key
Expand All @@ -55,41 +56,69 @@ jobs:
with:
fetch-depth: 0

- name: Install XMake
- name: Add LLVM apt repository
uses: myci-actions/add-deb-repo@11
with:
repo: deb http://apt.llvm.org/noble/ llvm-toolchain-noble main
repo-name: llvm
keys-asc: https://apt.llvm.org/llvm-snapshot.gpg.key

- name: Update apt repositories
run: sudo apt update

- name: Install system dependencies
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: build-essential cmake meson pkg-config clang libc++-dev libc++1 libc++abi-dev libc++abi1 mold llvm-runtime
llvm libxkbcommon-x11-dev xutils-dev x11proto-dev libxcb1-dev libxcb-randr0-dev libxcb-xinput-dev libxcb-xf86dri0-dev
libxcb-dri3-dev libxcb-xkb-dev libxcb-xfixes0-dev libxau-dev libzstd-dev ninja-build libjpeg-turbo8-dev libpng-dev
zlib1g-dev
version: 1.0

- name: Set xmake env
run: echo "XMAKE_GLOBALDIR=${{ runner.workspace }}/xmake-global" >> $GITHUB_ENV
shell: bash

- name: Setup XMake
uses: xmake-io/github-action-setup-xmake@v1
with:
xmake-version: Arthapz/xmake#branch@fix-xlinker-rpath-deduplication
actions-cache-folder: .xmake-cache
actions-cache-key: linux-${{ matrix.arch }}-ci
xmake-version: latest
actions-cache-folder: .xmake-cache${{ steps.cache_key.outputs.key }}

- name: Update xmake repository
run: xmake repo --update -v

- name: Retrieve dependencies hash
id: dep_hash
run: echo "hash=$(xmake l utils.ci.packageskey)" >> $GITHUB_OUTPUT
shell: bash

# - name: Retrieve cached xmake dependencies
# uses: actions/cache@v4
# with:
# path: ${{ env.XMAKE_GLOBALDIR }}/.xmake/packages
# key: ${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.mode }}-${{ steps.dep_hash.outputs.hash }}-${{ steps.cache_key.outputs.key }}

- name: Add LLVM apt repository
uses: myci-actions/add-deb-repo@11
- name: Retrieve cached xmake dependencies
id: restore-depcache
uses: actions/cache/restore@v4
with:
repo: deb http://apt.llvm.org/noble/ llvm-toolchain-noble main
repo-name: llvm
keys-asc: https://apt.llvm.org/llvm-snapshot.gpg.key
path: ${{ env.XMAKE_GLOBALDIR }}/.xmake/packages
key: ${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.mode }}-${{ steps.dep_hash.outputs.hash }}-${{ steps.cache_key.outputs.key
}}

- name: Configure & Build
id: build
- name: Configure & Install dependencies
id: configure
run: |
sudo apt install pkg-config clang libc++-dev libc++1 libc++abi-dev libc++abi1 mold llvm-runtime llvm libxkbcommon-x11-dev xutils-dev x11proto-dev libxcb1-dev libxcb-randr0-dev libxcb-xinput-dev libxcb-xf86dri0-dev libxcb-dri3-dev libxcb-xkb-dev libxcb-xfixes0-dev libxau-dev build-essential cmake libzstd-dev ninja-build doxygen graphviz opencl-c-headers mesa-opencl-icd libjpeg-turbo8-dev libpng-dev zlib1g-dev
xmake f -vD -a ${{ (matrix.arch == 'x64') && 'x86_64' || (matrix.arch == 'arm64') && 'aarch64' || matrix.arch }} --yes -m ${{ (matrix.mode == 'release' || matrix.mode == 'debug') && matrix.mode || 'releasedbg' }} -k ${{ matrix.kind }} --sanitizers=${{ matrix.mode == 'debug' && 'y' || 'n' }} --examples=y --tests=y --toolchain=llvm --mold=y --runtimes="c++_shared"
- name: Save cached xmake dependencies
if: ${{ !steps.restore-depcache.outputs.cache-hit }}
uses: actions/cache/save@v4
with:
path: ${{ env.XMAKE_GLOBALDIR }}/.xmake/packages
key: ${{ steps.restore-depcache.outputs.cache-primary-key }}

- name: Build
id: build
run: |
xmake b -v
- name: Tests
- name: Run unit tests
run: xmake test -v

- name: Installation
Expand Down
10 changes: 6 additions & 4 deletions .github/workflows/macOS.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ jobs:
runs-on: ${{ matrix.os }}${{ (matrix.arch == 'x64') && '-large' || '' }}

concurrency:
group: ${{ github.ref }}-${{ github.base_ref }}-${{ github.head_ref }}-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.kind }}-${{ matrix.mode }}
group: ${{ github.ref }}-${{ github.base_ref }}-${{ github.head_ref }}-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.kind
}}-${{ matrix.mode }}

steps:
- name: Get current date as package key
Expand Down Expand Up @@ -81,7 +82,8 @@ jobs:
uses: actions/cache/restore@v4
with:
path: ${{ env.XMAKE_GLOBALDIR }}/.xmake/packages
key: ${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.mode }}-${{ steps.dep_hash.outputs.hash }}-${{ steps.cache_key.outputs.key }}
key: ${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.mode }}-${{ steps.dep_hash.outputs.hash }}-${{ steps.cache_key.outputs.key
}}

- name: Configure and install dependencies
id: configure
Expand All @@ -92,8 +94,8 @@ jobs:
if: ${{ !steps.restore-depcache.outputs.cache-hit }}
uses: actions/cache/save@v4
with:
path: ${{ env.XMAKE_GLOBALDIR }}/.xmake/packages
key: ${{ steps.restore-depcache.outputs.cache-primary-key }}
path: ${{ env.XMAKE_GLOBALDIR }}/.xmake/packages
key: ${{ steps.restore-depcache.outputs.cache-primary-key }}

- name: Build
id: build
Expand Down

0 comments on commit 8763c54

Please sign in to comment.