forked from PazerOP/tf2_bot_detector
-
Notifications
You must be signed in to change notification settings - Fork 7
170 lines (148 loc) · 6.58 KB
/
build-linux.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
name: build-linux
on:
push:
paths-ignore:
- 'schemas/**.json'
- 'staging/cfg/**.json'
- '*.md'
- '*.appinstaller_template'
env:
VCPKG_ROOT: ${{ github.workspace }}/submodules/vcpkg
VCPKG_BINARY_SOURCES: 'clear;nuget,GitHub,readwrite'
VCPKG_FEATURE_FLAGS: manifests,binarycaching,registries
VCPKG_CACHE_VERSION: 9
defaults:
run:
shell: bash
jobs:
config:
runs-on: ubuntu-latest
outputs:
tf2bd_version: ${{ steps.tf2bd_version.outputs.value }}
tf2bd_workspace: ${{ steps.tf2bd_paths.outputs.workspace }}
tf2bd_build_dir: ${{ steps.tf2bd_paths.outputs.build_dir }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Extract TF2BD_VERSION
id: tf2bd_version
run: |
mkdir build_dir
cd build_dir
cmake -DCMAKE_TOOLCHAIN_FILE="" ../ || true # we know this will fail, we just need version info from CMakeCache.txt
TF2BD_VERSION_NOBUILD=`cat CMakeCache.txt | grep TF2BD_VERSION_NOBUILD: | cut -d "=" -f2`
echo "value=$TF2BD_VERSION_NOBUILD.${{ github.run_number }}" >> $GITHUB_OUTPUT
- name: Debug
run: |
echo "github.event_name = ${{ github.event_name }}"
echo "github.sha = ${{ github.sha }}"
echo "github.ref = ${{ github.ref }}"
echo "github.run_id = ${{ github.run_id }}"
echo "github.run_number = ${{ github.run_number }}"
- name: Config cross-platform paths
id: tf2bd_paths
run: |
tf2bd_workspace=`realpath "${{ github.workspace }}"`
echo "workspace=$tf2bd_workspace" >> $GITHUB_OUTPUT
echo "build_dir=$tf2bd_workspace/tf2bd_cmake_build_dir/" >> $GITHUB_OUTPUT
build:
needs: config
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest ]
triplet: [ x64-ubuntu ]
# discord_integration: [ false ] # fix soon lol
discord_integration: [true, false]
build_type: [ RelWithDebInfo, Release ]
include:
- os: ubuntu-latest
triplet: x64-ubuntu
tf2bd_arch: x64
steps:
- name: Determine artifact behavior
id: determine_artifact_behavior
if: matrix.discord_integration == true
run: echo "upload=1" >> $GITHUB_OUTPUT
- name: Debug
run: |
echo "matrix.os = ${{ matrix.os }}"
echo "matrix.triplet = ${{ matrix.triplet }}"
echo "matrix.discord_integration = ${{ matrix.discord_integration }}"
echo "matrix.tf2bd_arch = ${{ matrix.tf2bd_arch }}"
echo "matrix.build_type = ${{ matrix.build_type }}"
echo "steps.determine_artifact_behavior.outputs.upload = ${{ steps.determine_artifact_behavior.outputs.upload }}"
echo "needs.config.outputs.tf2bd_version = ${{ needs.config.outputs.tf2bd_version }}"
echo "needs.config.outputs.tf2bd_workspace = ${{ needs.config.outputs.tf2bd_workspace }}"
echo "needs.config.outputs.tf2bd_build_dir = ${{ needs.config.outputs.tf2bd_build_dir }}"
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true
- name: Setup NuGet Credentials
run: >
nuget sources add
-source "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json"
-storepasswordincleartext
-name "GitHub"
-username "${{ github.repository_owner }}"
-password "${{ secrets.GITHUB_TOKEN }}"
- uses: seanmiddleditch/gha-setup-ninja@v4
- name: Configure build tools
run: "echo yea"
# we're technically getting cmake twice
# should be fine right
- uses: lukka/get-cmake@latest
- name: Add universe respository to apt
run: sudo add-apt-repository universe && sudo apt-get update
- name: Install Dependencies
run: sudo apt-get install -y --no-install-recommends libtbb-dev libgl-dev libegl-dev libglx-dev
gcc-11 g++-11 libsdl2-dev build-essential git make
pkg-config cmake ninja-build gnome-desktop-testing libasound2-dev libpulse-dev
libaudio-dev libjack-dev libsndio-dev libx11-dev libxext-dev
libxrandr-dev libxcursor-dev libxfixes-dev libxi-dev libxss-dev
libxkbcommon-dev libdrm-dev libgbm-dev libgl1-mesa-dev libglu1-mesa-dev libgles2-mesa-dev
libegl1-mesa-dev libdbus-1-dev libibus-1.0-dev libudev-dev fcitx-libs-dev
libpipewire-0.3-dev libwayland-dev libdecor-0-dev libxrender-dev
mesa-common-dev libxft-dev
- name: Install discord-game-sdk 3.2.1
if: matrix.discord_integration == true
run: wget https://dl-game-sdk.discordapp.net/3.2.1/discord_game_sdk.zip &&
mkdir discord_game_sdk &&
unzip discord_game_sdk.zip -d discord_game_sdk &&
sudo mv discord_game_sdk/lib/x86_64/discord_game_sdk.so /usr/lib/libdiscord_game_sdk.so &&
sudo mv discord_game_sdk/cpp /usr/src/discord-game-sdk &&
sudo mv discord_game_sdk/c /usr/include/discord-game-sdk
- name: Create Build Folder
run: |
mkdir "${{needs.config.outputs.tf2bd_build_dir}}"
- name: Configure Build
working-directory: ${{needs.config.outputs.tf2bd_build_dir}}
run: |
cmake -G Ninja \
-DTF2BD_IS_CI_COMPILE=ON \
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
-DCMAKE_TOOLCHAIN_FILE="${{ env.VCPKG_ROOT }}/scripts/buildsystems/vcpkg.cmake" \
-DTF2BD_ENABLE_DISCORD_INTEGRATION=${{ matrix.discord_integration }} \
-DTF2BD_VERSION_BUILD=${{ github.run_number }} \
-DDISCORD_GAME_SDK_INCLUDE=/usr/src \
../
- name: Build tf2bd
working-directory: ${{needs.config.outputs.tf2bd_build_dir}}
run: |
cmake --build . --config ${{matrix.build_type}}
- name: "Artifacts: Prepare staging/"
if: steps.determine_artifact_behavior.outputs.upload
run: |
echo "Copying build artifacts to staging..."
cp -v ${{ needs.config.outputs.tf2bd_build_dir }}/tf2_bot_detector/tf2_bot_detector ${{ needs.config.outputs.tf2bd_workspace }}/staging/
cp -v ${{ needs.config.outputs.tf2bd_build_dir }}/submodules/mh_stuff/libmh-stuff.so ${{ needs.config.outputs.tf2bd_workspace }}/staging/
- name: "Artifacts: Upload staging/"
if: steps.determine_artifact_behavior.outputs.upload
uses: actions/upload-artifact@v2
with:
name: "tf2-bot-detector_${{ matrix.os }}_${{ matrix.triplet }}_${{ needs.config.outputs.tf2bd_version }}_${{ matrix.build_type }}"
if-no-files-found: error
path: ${{ needs.config.outputs.tf2bd_workspace }}/staging/