Skip to content

Commit aff5dd1

Browse files
Merge branch 'mehah:main' into kokekanon/features15.00
2 parents c1ce5f3 + 1d6fc87 commit aff5dd1

File tree

475 files changed

+7509
-4161
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

475 files changed

+7509
-4161
lines changed
Lines changed: 48 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
---
21
name: Analysis - SonarCloud
32

43
on:
@@ -12,72 +11,78 @@ env:
1211
VCPKG_BUILD_TYPE: release
1312
CMAKE_BUILD_PARALLEL_LEVEL: 2
1413
MAKEFLAGS: '-j 2'
15-
NUMBER_OF_PROCESSORS: 2
1614

1715
jobs:
1816
sonarcloud:
1917
name: SonarCloud
2018
runs-on: ubuntu-22.04
2119

2220
steps:
23-
- uses: actions/checkout@main
24-
if: ${{ github.event_name == 'pull_request' || github.event_name == 'pull_request_target' }}
25-
with:
26-
fetch-depth: 0
27-
ref: ${{github.event.pull_request.head.ref}}
28-
repository: ${{github.event.pull_request.head.repo.full_name}}
29-
30-
- uses: actions/checkout@main
31-
if: ${{ github.event_name == 'push' }}
21+
- name: Checkout repository
22+
uses: actions/checkout@v4
3223
with:
3324
fetch-depth: 0
25+
ref: ${{ github.event_name == 'push' && github.ref || github.event.pull_request.head.ref }}
26+
repository: ${{ github.event_name == 'push' && github.repository || github.event.pull_request.head.repo.full_name }}
3427

3528
- name: Install Linux Dependencies
36-
run: >
37-
sudo apt-get update && sudo apt-get install ccache libglew-dev libx11-dev linux-headers-$(uname -r)
29+
run: |
30+
sudo apt-get update
31+
sudo apt-get install -y ccache libglew-dev libx11-dev linux-headers-$(uname -r)
3832
39-
- name: Switch to gcc-11
33+
- name: Switch to GCC 11
4034
run: |
41-
sudo apt install gcc-11 g++-11
42-
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 100 --slave /usr/bin/g++ g++ /usr/bin/g++-11 --slave /usr/bin/gcov gcov /usr/bin/gcov-11
35+
sudo apt install -y gcc-11 g++-11
36+
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 100 \
37+
--slave /usr/bin/g++ g++ /usr/bin/g++-11 \
38+
--slave /usr/bin/gcov gcov /usr/bin/gcov-11
4339
sudo update-alternatives --set gcc /usr/bin/gcc-11
4440
45-
- name: CCache
46-
id: ccache
47-
uses: actions/cache@main
41+
- name: Detect CPU core count
42+
id: cpu-count
43+
run: echo "count=$(nproc)" >> "$GITHUB_OUTPUT"
44+
45+
- name: Cache CCache
46+
uses: actions/cache@v4
4847
with:
4948
path: $HOME/.ccache
50-
key: ccache-${{ runner.os }}-${{ hashFiles('**/src') }}
49+
key: ccache-${{ runner.os }}-${{ hashFiles('CMakeLists.txt', 'vcpkg.json', 'src/**/*.cpp', 'src/**/*.h') }}
5150
restore-keys: |
52-
ccache-${{ runner.os}}-
51+
ccache-${{ runner.os }}-
5352
54-
- name: Sonar cache
55-
uses: actions/cache@main
53+
- name: Cache SonarCloud analysis data
54+
uses: actions/cache@v4
5655
with:
5756
path: $HOME/.cfamily
58-
key: sonar-${{ runner.os}}-${{ hashFiles('**/src') }}
57+
key: sonar-cfamily-${{ runner.os }}-${{ hashFiles('CMakeLists.txt', 'vcpkg.json', 'src/**/*.cpp', 'src/**/*.h') }}
5958
restore-keys: |
60-
sonar-${{ runner.os}}-
59+
sonar-cfamily-${{ runner.os }}-
6160
6261
- name: Cache SonarCloud packages
63-
uses: actions/cache@main
62+
uses: actions/cache@v4
6463
with:
6564
path: $HOME/.sonar/cache
66-
key: sonar-${{ runner.os}}-${{ hashFiles('**/src') }}
65+
key: sonar-packages-${{ runner.os }}
6766
restore-keys: |
68-
sonar-${{ runner.os}}-
67+
sonar-packages-${{ runner.os }}-
6968
70-
- name: Restore artifacts and install vcpkg
69+
- name: Extract vcpkg commit ID
7170
id: vcpkg-step
7271
run: |
7372
vcpkgCommitId=$(grep '.builtin-baseline' vcpkg.json | awk -F: '{print $2}' | tr -d '," ')
74-
echo "vcpkg commit ID: $vcpkgCommitId"
75-
echo "name=vcpkgGitCommitId::$vcpkgCommitId" >> $env:GITHUB_OUTPUT
73+
echo "vcpkgGitCommitId=$vcpkgCommitId" >> "$GITHUB_OUTPUT"
74+
75+
- name: Cache vcpkg installed packages
76+
uses: actions/cache@v4
77+
with:
78+
path: build/vcpkg_installed
79+
key: vcpkg-installed-${{ runner.os }}-${{ steps.vcpkg-step.outputs.vcpkgGitCommitId }}
80+
restore-keys: |
81+
vcpkg-installed-${{ runner.os }}-
7682
77-
- name: Get vcpkg commit id from vcpkg.json
78-
uses: lukka/run-vcpkg@main
83+
- name: Setup vcpkg with baseline
84+
uses: lukka/run-vcpkg@v11
7985
with:
80-
vcpkgGitURL: "https://github.com/microsoft/vcpkg.git"
8186
vcpkgGitCommitId: ${{ steps.vcpkg-step.outputs.vcpkgGitCommitId }}
8287
vcpkgJsonIgnores: "['**/vcpkg/**', '**/browser/overlay-ports/**']"
8388

@@ -87,7 +92,12 @@ jobs:
8792
- name: Generate compilation database
8893
run: |
8994
mkdir -p build
90-
cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_TOOLCHAIN_FILE="$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake" -DOPTIONS_ENABLE_CCACHE=ON -DSPEED_UP_BUILD_UNITY=OFF -S . -B build
95+
cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
96+
-DCMAKE_BUILD_TYPE=Debug \
97+
-DCMAKE_TOOLCHAIN_FILE="$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake" \
98+
-DOPTIONS_ENABLE_CCACHE=ON \
99+
-DSPEED_UP_BUILD_UNITY=OFF \
100+
-S . -B build
91101
92102
- name: Run PR sonar-scanner
93103
if: ${{ github.event_name == 'pull_request' || github.event_name == 'pull_request_target' }}
@@ -97,13 +107,13 @@ jobs:
97107
BRANCH: ${{ github.event.pull_request.head.ref }}
98108
run: |
99109
sonar-scanner \
100-
--define sonar.cfamily.threads="${{ env.NUMBER_OF_PROCESSORS }}" \
110+
--define sonar.cfamily.threads=${{ steps.cpu-count.outputs.count }} \
101111
--define sonar.cfamily.cache.enabled=true \
102112
--define sonar.cfamily.cache.path="$HOME/.cfamily" \
103113
--define sonar.cfamily.compile-commands=build/compile_commands.json \
104114
--define sonar.pullrequest.key=${{ github.event.pull_request.number }} \
105115
--define sonar.pullrequest.branch=$BRANCH \
106-
--define sonar.pullrequest.base=${{ github.event.pull_request.base_ref }}
116+
--define sonar.pullrequest.base=${{ github.event.pull_request.base.ref }}
107117
108118
- name: Run sonar-scanner
109119
if: ${{ github.event_name == 'push' }}
@@ -112,7 +122,7 @@ jobs:
112122
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
113123
run: |
114124
sonar-scanner \
115-
--define sonar.cfamily.threads="${{ env.NUMBER_OF_PROCESSORS }}" \
125+
--define sonar.cfamily.threads=${{ steps.cpu-count.outputs.count }} \
116126
--define sonar.cfamily.cache.enabled=true \
117127
--define sonar.cfamily.cache.path="$HOME/.cfamily" \
118128
--define sonar.cfamily.compile-commands=build/compile_commands.json

.github/workflows/build-browser.yml

Lines changed: 34 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,40 @@ name: Build - Emscripten
33
on:
44
workflow_dispatch:
55
pull_request:
6+
types: [opened, synchronize, reopened, ready_for_review]
7+
paths:
8+
- "src/**"
9+
- ".github/workflows/build-emscripten.yml"
610
push:
11+
paths:
12+
- "src/**"
13+
- ".github/workflows/build-emscripten.yml"
714
branches:
815
- main
916

1017
jobs:
11-
job:
18+
cancel-runs:
19+
if: github.event_name == 'pull_request' && github.ref != 'refs/heads/main'
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Cancel Previous Runs
23+
uses: styfle/cancel-workflow-action@main
24+
with:
25+
access_token: ${{ github.token }}
26+
27+
build:
1228
name: ${{ matrix.buildtype }}
1329
runs-on: ubuntu-latest
1430

31+
concurrency:
32+
group: otclient-emscripten-${{ github.workflow }}-${{ github.ref }}-${{ matrix.buildtype }}
33+
cancel-in-progress: true
34+
1535
strategy:
1636
fail-fast: false
1737
matrix:
18-
buildtype: [emscripten-release, emscripten-debug]
38+
buildtype: [emscripten-debug]
1939
include:
20-
- buildtype: emscripten-release
21-
cmake_build_type: Release
2240
- buildtype: emscripten-debug
2341
cmake_build_type: Debug
2442

@@ -37,13 +55,17 @@ jobs:
3755
vcpkgCommitId=$(grep '.builtin-baseline' vcpkg.json | awk -F: '{print $2}' | tr -d '," ')
3856
echo "vcpkgGitCommitId=$vcpkgCommitId" >> $GITHUB_OUTPUT
3957
40-
- name: Cache vcpkg binary artifacts
58+
- name: Cache full vcpkg artifacts
4159
uses: actions/cache@v4
4260
with:
43-
path: ~/.cache/vcpkg/archives
44-
key: vcpkg-binary-cache-${{ steps.vcpkg-step.outputs.vcpkgGitCommitId }}-${{ matrix.buildtype }}
61+
path: |
62+
~/.cache/vcpkg/archives
63+
${{ github.workspace }}/vcpkg/installed
64+
${{ github.workspace }}/vcpkg/buildtrees
65+
${{ github.workspace }}/vcpkg/downloads
66+
key: vcpkg-${{ matrix.buildtype }}-${{ steps.hash.outputs.hash }}
4567
restore-keys: |
46-
vcpkg-binary-cache-${{ steps.vcpkg-step.outputs.vcpkgGitCommitId }}-
68+
vcpkg-${{ matrix.buildtype }}-
4769
4870
- name: Setup vcpkg
4971
uses: lukka/run-vcpkg@v11
@@ -53,13 +75,9 @@ jobs:
5375
- name: Install CMake and Ninja
5476
uses: lukka/[email protected]
5577

56-
- name: Cache CMake build directory
57-
uses: actions/cache@v4
58-
with:
59-
path: ${{ github.workspace }}/build-${{ matrix.buildtype }}
60-
key: cmake-cache-${{ github.sha }}-${{ matrix.buildtype }}
61-
restore-keys: |
62-
cmake-cache-${{ github.sha }}-${{ matrix.buildtype }}-
78+
- name: Compute vcpkg hash
79+
id: hash
80+
run: echo "hash=$(sha256sum vcpkg.json | cut -d' ' -f1)" >> $GITHUB_OUTPUT
6381

6482
- name: Configure CMake
6583
run: |
@@ -85,4 +103,4 @@ jobs:
85103
with:
86104
name: otclient-${{ matrix.buildtype }}-${{ github.sha }}
87105
path: ${{ github.workspace }}/build-${{ matrix.buildtype }}/bin/
88-
retention-days: 30
106+
retention-days: 30

.github/workflows/build-docker.yml

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,47 @@
1-
---
21
name: Build - Docker
32

43
on:
54
workflow_dispatch:
65
pull_request:
6+
types: [opened, synchronize, reopened, ready_for_review]
7+
paths:
8+
- "Dockerfile"
9+
- ".dockerignore"
10+
- ".github/workflows/build-docker.yml"
11+
- "src/**"
712
push:
813
branches: [ $default-branch ]
14+
paths:
15+
- "Dockerfile"
16+
- ".dockerignore"
17+
- ".github/workflows/build-docker.yml"
18+
- "src/**"
919

1020
env:
1121
REGISTRY: ghcr.io
1222
IMAGE_NAME: ${{ github.repository }}
1323

1424
jobs:
25+
cancel-runs:
26+
if: github.event_name == 'pull_request' && github.ref != 'refs/heads/main'
27+
runs-on: ubuntu-latest
28+
steps:
29+
- name: Cancel Previous Runs
30+
uses: styfle/cancel-workflow-action@main
31+
with:
32+
access_token: ${{ github.token }}
33+
1534
docker:
35+
name: Docker Build & Push
1636
runs-on: ubuntu-latest
37+
38+
concurrency:
39+
group: otclient-docker-${{ github.workflow }}-${{ github.ref }}
40+
cancel-in-progress: true
41+
1742
steps:
1843
- name: Checkout
19-
uses: actions/checkout@main
44+
uses: actions/checkout@v4
2045
with:
2146
fetch-depth: 0
2247

@@ -30,15 +55,13 @@ jobs:
3055
username: ${{ github.actor }}
3156
password: ${{ secrets.GITHUB_TOKEN }}
3257

33-
# Extract metadata (tags, labels) for Docker
34-
# https://github.com/docker/metadata-action
3558
- name: Extract Docker metadata
3659
id: meta
3760
uses: docker/metadata-action@v5
3861
with:
3962
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
4063

41-
- name: Build and push Docker image
64+
- name: Build and push Docker image with cache
4265
uses: docker/build-push-action@v5
4366
with:
4467
context: .

0 commit comments

Comments
 (0)