forked from PazerOP/tf2_bot_detector
-
Notifications
You must be signed in to change notification settings - Fork 7
175 lines (153 loc) · 6.67 KB
/
ccpp.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
171
172
173
174
175
name: build
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: windows-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@v3
- 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 "::set-output name=value::$TF2BD_VERSION_NOBUILD.${{ github.run_number }}"
- 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 "::set-output name=workspace::$tf2bd_workspace"
echo "::set-output name=build_dir::$tf2bd_workspace/tf2bd_cmake_build_dir/"
build:
needs: config
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest]
triplet: [x86-windows, x64-windows]
discord_integration: [true]
# discord_integration: [true, false]
build_type: [Debug, Release]
include:
- os: windows-latest
triplet: x86-windows
tf2bd_arch: x86
- os: windows-latest
triplet: x64-windows
tf2bd_arch: x64
steps:
- name: Determine artifact behavior
id: determine_artifact_behavior
if: matrix.discord_integration == true
run: echo "::set-output name=upload::1"
- 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@v3
with:
fetch-depth: 0
submodules: recursive
- 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@v3
- name: Configure build tools
uses: ilammy/msvc-dev-cmd@v1.12.1
with:
arch: ${{ matrix.tf2bd_arch }}
# we're technically getting cmake twice
# should be fine right
- uses: lukka/get-cmake@latest
- 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" \
-DCMAKE_RUNTIME_OUTPUT_DIRECTORY="${{ needs.config.outputs.tf2bd_build_dir }}" \
-DTF2BD_ENABLE_DISCORD_INTEGRATION=${{ matrix.discord_integration }} \
-DTF2BD_VERSION_BUILD=${{ github.run_number }} \
../
- name: Build tf2bd
working-directory: ${{needs.config.outputs.tf2bd_build_dir}}
if: ${{ startsWith(matrix.os, 'windows') }}
run: |
cmake --build . --config ${{matrix.build_type}}
- name: "Artifacts: Fresh, signed exe"
if: steps.determine_artifact_behavior.outputs.upload && startsWith(matrix.os, 'windows')
uses: actions/upload-artifact@v2
with:
name: "smartscreen_${{ matrix.triplet }}_${{ needs.config.outputs.tf2bd_version }}_${{ matrix.build_type }}"
if-no-files-found: error
path: "${{ needs.config.outputs.tf2bd_build_dir }}/*.exe"
- name: "Artifacts: Prepare staging/"
if: steps.determine_artifact_behavior.outputs.upload && startsWith(matrix.os, 'windows')
run: |
echo "Copying build artifacts to staging..."
cp -v ${{ needs.config.outputs.tf2bd_build_dir }}/*.exe ${{ needs.config.outputs.tf2bd_build_dir }}/*.dll ${{ needs.config.outputs.tf2bd_workspace }}/staging/
echo "Performing smartscreen workaround..."
echo "Hash of current exe: "
sha1sum "${{ needs.config.outputs.tf2bd_workspace }}/staging/tf2_bot_detector.exe"
cp -v "${{ needs.config.outputs.tf2bd_workspace }}/smartscreen/${{ matrix.tf2bd_arch }}/tf2_bot_detector.exe" "${{ needs.config.outputs.tf2bd_workspace }}/staging/tf2_bot_detector.exe"
echo "Hash of cached exe: "
sha1sum "${{ needs.config.outputs.tf2bd_workspace }}/staging/tf2_bot_detector.exe"
- name: "Artifacts: Upload staging/"
if: steps.determine_artifact_behavior.outputs.upload && startsWith(matrix.os, 'windows')
uses: actions/upload-artifact@v2
with:
name: "tf2-bot-detector_${{ matrix.triplet }}_${{ needs.config.outputs.tf2bd_version }}_${{ matrix.build_type }}"
if-no-files-found: error
path: ${{ needs.config.outputs.tf2bd_workspace }}/staging/
- name: "Artifacts: symbols"
if: steps.determine_artifact_behavior.outputs.upload && startsWith(matrix.os, 'windows')
uses: actions/upload-artifact@v2
with:
name: "tf2-bot-detector-symbols_${{ matrix.triplet }}_${{ needs.config.outputs.tf2bd_version }}_${{ matrix.build_type }}"
if-no-files-found: error
path: "${{ needs.config.outputs.tf2bd_build_dir }}/**.pdb"