Improve CI (#46)

This commit is contained in:
star9029
2025-01-19 19:54:25 +08:00
committed by GitHub
parent bd1c2037cf
commit f475800f7b
4 changed files with 46 additions and 25 deletions

View File

@@ -11,6 +11,7 @@ on:
- '.gitignore'
- 'LICENSE'
- 'README.md'
- '.github/workflows/xmake.yml'
jobs:
build:
@@ -41,10 +42,9 @@ jobs:
sudo update-alternatives --set gcc /usr/bin/gcc-14
sudo update-alternatives --set g++ /usr/bin/g++-14
wget -O - https://apt.llvm.org/llvm.sh | sudo bash
sudo apt install -y llvm-18 llvm-18-tools clang-18 libclang-rt-18-dev lld-18
sudo ln -s /usr/bin/llvm-ar-18 /usr/bin/llvm-ar
sudo ln -s /usr/bin/llvm-ranlib-18 /usr/bin/llvm-ranlib
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 20 all
sudo apt install -y cmake ninja-build
@@ -67,13 +67,13 @@ jobs:
if: matrix.os == 'windows-2022'
uses: ilammy/msvc-dev-cmd@v1
- name: Build clice
- name: Build clice (debug)
if: matrix.os == 'ubuntu-24.04'
run: |
cmake --preset debug
cmake --build --preset debug
- name: Build clice
- name: Build clice (release)
if: matrix.os == 'windows-2022'
run: |
cmake --preset release

View File

@@ -11,12 +11,14 @@ on:
- '.gitignore'
- 'LICENSE'
- 'README.md'
- '.github/workflows/cmake.yml'
jobs:
build:
strategy:
matrix:
os: [ubuntu-24.04, windows-2022]
build_type: [release, debug]
runs-on: ${{ matrix.os }}
@@ -41,24 +43,39 @@ jobs:
sudo update-alternatives --set gcc /usr/bin/gcc-14
sudo update-alternatives --set g++ /usr/bin/g++-14
wget -O - https://apt.llvm.org/llvm.sh | sudo bash
sudo apt install -y llvm-18 llvm-18-tools clang-18 libclang-rt-18-dev lld-18
sudo ln -s /usr/bin/llvm-ar-18 /usr/bin/llvm-ar
sudo ln -s /usr/bin/llvm-ranlib-18 /usr/bin/llvm-ranlib
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 20 all
sudo apt install -y cmake ninja-build
- name: Setup xmake
uses: xmake-io/github-action-setup-xmake@v1
with:
xmake-version: '2.9.7'
sudo apt install -y cmake ninja-build
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup xmake
uses: xmake-io/github-action-setup-xmake@v1
with:
xmake-version: branch@master
actions-cache-folder: '.xmake-cache'
actions-cache-key: ${{ matrix.os }}
package-cache: true
package-cache-key: ${{ matrix.os }}
build-cache: true
build-cache-key: ${{ matrix.os }}-${{ matrix.build_type }}
- name: Xmake configure
if: matrix.os == 'ubuntu-24.04'
run: |
xmake config --yes --mode=${{ matrix.build_type }} --toolchain=clang-20
- name: Xmake configure
if: matrix.os == 'windows-2022'
run: |
xmake config --yes --toolchain=clang
- name: Build clice
run: |
xmake --yes --diagnosis
xmake --verbose --diagnosis
- name: Run tests
run: xmake test --verbose