Skip to content

Commit a8988ba

Browse files
committed
ci: overhaul GitHub Actions workflows
- Add composite actions for Clang (setup-clang) and Conan (setup-conan) to eliminate duplicated setup across workflows - Merge coverage.yml into ci.yml as a conditional on Linux Debug builds - Consolidate docker.yml into a single matrix job and modernize cache from type=local to type=gha - Add concurrency groups with tag-safe cancel-in-progress to wheel.yml and docker.yml - Update wheel.yml to use setup-conan composite action - Refactor windows-portable.yml to consume wheel artifacts from wheel.yml via workflow_run instead of rebuilding - Add release.yml for one-click releases with version validation, changelog stamping, tagging, and GitHub release creation
1 parent 4958099 commit a8988ba

8 files changed

Lines changed: 321 additions & 226 deletions

File tree

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: 'Set up Clang/LLVM'
2+
description: 'Install Clang, libc++, and LLVM tools on Linux'
3+
4+
inputs:
5+
llvm-version:
6+
description: 'LLVM major version to install'
7+
required: false
8+
default: '20'
9+
10+
runs:
11+
using: 'composite'
12+
steps:
13+
- name: Install Clang ${{ inputs.llvm-version }}
14+
shell: bash
15+
env:
16+
LLVM_VERSION: ${{ inputs.llvm-version }}
17+
run: |
18+
sudo apt-get update -y -q
19+
sudo apt-get install -y -q build-essential lsb-release wget software-properties-common gnupg
20+
sudo wget https://apt.llvm.org/llvm.sh
21+
sudo chmod +x llvm.sh
22+
sudo ./llvm.sh ${LLVM_VERSION}
23+
sudo apt-get install -y -q libc++-${LLVM_VERSION}-dev libc++abi-${LLVM_VERSION}-dev clang-tools-${LLVM_VERSION}
24+
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-${LLVM_VERSION} 200
25+
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-${LLVM_VERSION} 200
26+
sudo update-alternatives --install /usr/bin/llvm-cov llvm-cov /usr/bin/llvm-cov-${LLVM_VERSION} 100
27+
sudo update-alternatives --install /usr/bin/ld ld /usr/bin/ld.lld-${LLVM_VERSION} 100
28+
echo "CC=clang" >> $GITHUB_ENV
29+
echo "CXX=clang++" >> $GITHUB_ENV
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: 'Set up Conan'
2+
description: 'Set up Conan package manager with caching and optional dependency install'
3+
4+
inputs:
5+
build-type:
6+
description: 'CMake build type (Release, Debug, RelWithDebInfo)'
7+
required: false
8+
default: 'Release'
9+
python-version:
10+
description: 'Python version to set up'
11+
required: false
12+
default: '3.12'
13+
install-dependencies:
14+
description: 'Run conan install after setup (set false for cibuildwheel workflows)'
15+
required: false
16+
default: 'true'
17+
18+
runs:
19+
using: 'composite'
20+
steps:
21+
- name: Set up Python
22+
uses: actions/setup-python@v6
23+
with:
24+
python-version: ${{ inputs.python-version }}
25+
cache: 'pip'
26+
27+
- name: Cache Conan packages
28+
uses: actions/cache@v5
29+
with:
30+
path: ~/.conan2/p
31+
key: ${{ runner.os }}-conan-${{ inputs.build-type }}-${{ hashFiles('conanfile.py') }}
32+
restore-keys: |
33+
${{ runner.os }}-conan-${{ inputs.build-type }}-
34+
35+
- name: Install Conan
36+
shell: bash
37+
run: |
38+
python -m pip install --upgrade pip
39+
pip install conan
40+
41+
- name: Detect Conan profile
42+
shell: bash
43+
run: conan profile detect --force
44+
45+
- name: Install dependencies with Conan
46+
if: inputs.install-dependencies == 'true'
47+
shell: bash
48+
run: |
49+
CONAN_ARGS="--build=missing -s compiler.cppstd=20 -s build_type=${{ inputs.build-type }} -c tools.cmake.cmaketoolchain:generator=Ninja"
50+
if [ "$RUNNER_OS" = "Linux" ]; then
51+
CONAN_ARGS="$CONAN_ARGS -s compiler.libcxx=libc++"
52+
fi
53+
conan install . $CONAN_ARGS

.github/workflows/ci.yml

Lines changed: 20 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ on:
1717
permissions: read-all
1818

1919
concurrency:
20-
group: test-${{ github.ref }}
20+
group: ci-${{ github.ref }}
2121
cancel-in-progress: true
2222

2323
jobs:
@@ -30,6 +30,7 @@ jobs:
3030
include:
3131
- os: ubuntu-22.04
3232
build_type: Debug
33+
coverage: true
3334

3435
name: Build on ${{ matrix.os }} (${{ matrix.build_type }})
3536
runs-on: ${{ matrix.os }}
@@ -41,37 +42,9 @@ jobs:
4142
fetch-depth: 0
4243
submodules: true
4344

44-
- name: Cache Conan
45-
uses: actions/cache@v5
46-
with:
47-
path: ~/.conan2/p
48-
key: ${{ runner.os }}-conan-${{ matrix.build_type }}-${{ hashFiles('conanfile.py') }}
49-
restore-keys: |
50-
${{ runner.os }}-conan-${{ matrix.build_type }}-
51-
52-
- name: Set up Python
53-
uses: actions/setup-python@v6
54-
with:
55-
python-version: '3.12'
56-
cache: 'pip'
57-
5845
- name: Set up Clang (Linux)
5946
if: runner.os == 'Linux'
60-
env:
61-
LLVM_VERSION: 20
62-
run: |
63-
sudo apt-get update -y -q
64-
sudo apt-get install -y -q build-essential lsb-release wget software-properties-common
65-
sudo wget https://apt.llvm.org/llvm.sh
66-
sudo chmod +x llvm.sh
67-
sudo ./llvm.sh ${LLVM_VERSION}
68-
sudo apt-get install -y -q libc++-${LLVM_VERSION}-dev libc++abi-${LLVM_VERSION}-dev clang-tools-${LLVM_VERSION}
69-
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-${LLVM_VERSION} 200
70-
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-${LLVM_VERSION} 200
71-
sudo update-alternatives --install /usr/bin/llvm-cov llvm-cov /usr/bin/llvm-cov-${LLVM_VERSION} 100
72-
sudo update-alternatives --install /usr/bin/ld ld /usr/bin/ld.lld-${LLVM_VERSION} 100
73-
echo "CC=clang" >> $GITHUB_ENV
74-
echo "CXX=clang++" >> $GITHUB_ENV
47+
uses: ./.github/actions/setup-clang
7548

7649
- name: Set up MSVC (Windows)
7750
if: runner.os == 'Windows'
@@ -83,26 +56,27 @@ jobs:
8356
uses: lukka/get-cmake@latest
8457

8558
- name: Set up Conan
86-
run: |
87-
python -m pip install --upgrade pip
88-
pip install conan
89-
conan profile detect --force
90-
91-
- name: Install Dependencies with Conan (Linux)
92-
if: runner.os == 'Linux'
93-
run: |
94-
conan install . --build=missing -s compiler.cppstd=20 -s build_type=${{ matrix.build_type }} -c tools.cmake.cmaketoolchain:generator=Ninja -s compiler.libcxx=libc++
95-
96-
- name: Install Dependencies with Conan (Windows)
97-
if: runner.os == 'Windows'
98-
run: |
99-
conan install . --build=missing -s compiler.cppstd=20 -s build_type=${{ matrix.build_type }} -c tools.cmake.cmaketoolchain:generator=Ninja
59+
uses: ./.github/actions/setup-conan
60+
with:
61+
build-type: ${{ matrix.build_type }}
10062

10163
- name: Build with CMake
10264
run: |
10365
cd build/${{ matrix.build_type }}
104-
cmake ../.. -G Ninja -DCMAKE_TOOLCHAIN_FILE="generators/conan_toolchain.cmake" -DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
66+
cmake ../.. -G Ninja -DCMAKE_TOOLCHAIN_FILE="generators/conan_toolchain.cmake" -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} ${{ matrix.coverage && '-DCODE_COVERAGE=ON' || '' }}
10567
cmake --build .
10668
10769
- name: Run Tests
108-
run: ctest --test-dir build/${{ matrix.build_type }}
70+
run: ctest --test-dir build/${{ matrix.build_type }}
71+
72+
- name: Generate Coverage Report
73+
if: matrix.coverage
74+
run: |
75+
pip install gcovr
76+
gcovr -r . --filter src/endstone_core/ --gcov-executable "llvm-cov gcov" --xml coverage.xml build/${{ matrix.build_type }}
77+
78+
- name: Upload Coverage to Codecov
79+
if: matrix.coverage
80+
uses: codecov/codecov-action@v5
81+
env:
82+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

.github/workflows/coverage.yml

Lines changed: 0 additions & 79 deletions
This file was deleted.

0 commit comments

Comments
 (0)