ci: setup linux build. (#4)

This commit is contained in:
2025-03-11 18:20:04 +08:00
committed by GitHub
parent 1a28a84635
commit fbf2cb43ad
2 changed files with 73 additions and 11 deletions

68
.github/workflows/build-linux.yml vendored Normal file
View File

@@ -0,0 +1,68 @@
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: Prepare works
# run: |
# mkdir ./.xmake-dest
- name: Restore build 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.8'
actions-cache-folder: './.xmake-dest'
- name: Install build dependencies
run: |
sudo apt install -y build-essential llvm-19-dev libclang-19-dev
# workaround to switch llvm version.
sudo mv /usr/include/clang /usr/include/clang-compiler
sudo ln -s /usr/lib/llvm-19/bin/llvm-config /usr/bin/llvm-config
sudo ln -s /usr/include/llvm-19/llvm /usr/include/llvm
sudo ln -s /usr/include/llvm-c-19/llvm-c /usr/include/llvm-c
sudo ln -s /usr/lib/llvm-19/include/clang /usr/include/clang
sudo ln -s /usr/lib/llvm-19/include/clang-c /usr/include/clang-c
- name: Configure
run: |
# c++23 <print> requires gcc 14.
xmake f -a x64 -m ${{ matrix.mode }} -p linux --toolchain=gcc-14 -v -y
- name: Build
run: |
xmake -v -y
- 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

@@ -63,8 +63,12 @@ target('libdi')
remove_files('src/tools/**')
set_basename('di')
add_ldflags('$(shell llvm-config --libs)') -- xrepo llvm bug?
add_packages(
'nlohmann_json'
'xxhash',
'nlohmann_json',
'llvm'
)
target('askrva')
@@ -111,15 +115,10 @@ target('extractsym')
set_pcxxheader('src/pch.h')
add_packages(
'llvm',
'nlohmann_json',
'argparse'
)
if is_plat('linux') then -- workaround to fix link problem.
add_links('LLVM')
end
target('makepdb')
set_kind('binary')
add_deps('libdi')
@@ -127,11 +126,6 @@ target('makepdb')
set_pcxxheader('src/pch.h')
add_packages(
'llvm',
'nlohmann_json',
'argparse'
)
if is_plat('linux') then
add_links('LLVM')
end