Files
cpu-check/.github/workflows/build.yml
Eric Liu d8fcced921
Some checks failed
Build / build (push) Failing after 2m4s
Update build workflow to statically build Abseil and project dependencies
Modify GitHub Actions workflow to:
- Build Abseil from source statically
- Configure CMake for static linking
- Remove external Abseil library dependency
- Update build flags to support static compilation
2025-01-28 07:23:54 +00:00

88 lines
2.7 KiB
YAML

name: Build
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
env:
PKG_VERSION: "2.1.0"
PKG_RELEASE: "1"
ABSEIL_VERSION: "20230125.3"
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
submodules: recursive
- name: Install Dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential cmake clang checkinstall zlib1g-dev musl-tools
- name: Build Static Abseil
run: |
git clone https://github.com/abseil/abseil-cpp.git
cd abseil-cpp
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
-DABSL_BUILD_TESTING=OFF \
-DABSL_USE_GOOGLETEST_HEAD=OFF \
-DCMAKE_CXX_STANDARD=17 \
-DBUILD_SHARED_LIBS=OFF \
..
make -j$(nproc)
make install
ldconfig
- name: Configure the project
run: |
mkdir build; cd build
CC=clang CXX=clang++ cmake -DCMAKE_BUILD_TYPE=Release \
-DUSE_CLANG=ON \
-DBUILD_STATIC=ON \
-DCMAKE_EXE_LINKER_FLAGS="-static -static-libgcc -static-libstdc++" \
-DCMAKE_FIND_LIBRARY_SUFFIXES=".a" \
-DCMAKE_EXE_LINKER_FLAGS_INIT="-static" \
..
- name: Build the project
run: |
cd build
make
- name: Create Debian Package
run: |
cd build
sudo checkinstall --pkgname=cpu-check \
--pkgversion=${{ env.PKG_VERSION }} \
--pkgrelease=${{ env.PKG_RELEASE }} \
--maintainer="maintainer@example.com" \
--requires="" \
--default \
--pakdir=. \
--backup=no \
--deldoc=yes \
--deldesc=yes \
--delspec=yes \
make install
- name: Upload Debian Package
uses: actions/upload-artifact@v3
with:
name: cpu-check-deb
path: build/*.deb
- name: Upload to Gitea Package Registry
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
run: |
curl --user "eric:df299a6e592a8bd829d018b7816e76d03756408d" \
--upload-file build/cpu-check_${{ env.PKG_VERSION }}-${{ env.PKG_RELEASE }}_amd64.deb \
"https://git.ericxliu.me/api/packages/eric/debian/pool/bionic/main/upload"