-
-
Notifications
You must be signed in to change notification settings - Fork 10
199 lines (166 loc) · 5.71 KB
/
build.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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
name: 'Build'
env:
VERSION: 3.7.0
BUILD_TYPE: Release
ARCH: x64
VCPKG_CONFIG: Release
VCPKG_HASH: 8e9dc3c690558456a667ede3555e01783c3fab9c
DOC_INSTANCE: wrs/bt
DOC_ARTIFACT: webHelpBT2-all.zip
DOC_ALGOLIA_ARTIFACT: algolia-indexes-BT.zip
DOC_DOCKER_VERSION: 232.10275
on: [push, workflow_dispatch]
# Gives the workflow permissions to clone the repo and create a page deployment
permissions:
id-token: write
pages: write
jobs:
build-win:
runs-on: windows-latest
name: 'Windows Build'
env:
VCPKG_DEFAULT_VCPKG_TRIPLET: x64-windows-static
VCPKG_TRIPLET: x64-windows-static
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: pre-build patch script
run: .\pre-build.ps1
shell: pwsh
- uses: friendlyanon/setup-vcpkg@v1
# seems like the absense of commit hash expects vcpkg submodule, i don't want that
with:
committish: ${{ env.VCPKG_HASH }}
# set to false to clear any cache in case of build errors
cache: false
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: ⚙️ configure
run: >
cmake -B build -S .
-D CMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
-D "CMAKE_TOOLCHAIN_FILE=${{ env.VCPKG_ROOT }}/scripts/buildsystems/vcpkg.cmake"
-D "VCPKG_TARGET_TRIPLET=${{ env.VCPKG_TRIPLET }}"
working-directory: .
- name: 🏭 build
run: cmake --build build --config ${{ env.VCPKG_CONFIG }}
working-directory: .
- name: debug
run: ls -R
working-directory: build/test
- name: 🧪 unit tests
run: .\test.exe
working-directory: build/test/Release
- name: 📦 pack
run: cpack -C ${{ env.BUILD_TYPE }}
working-directory: build
# - name: debug
# run: ls -R
# working-directory: build
- name: Create artifacts directory
run: mkdir atf
# put the following inside "atf" subdir:
# 1. msi installer, renamed after version number
# 2. zipped .exe
# 3. version.txt containing version number
- name: prep artifacts
run: |
cp build/bt.msi atf/${{ env.MSI_FILE_NAME }}
Compress-Archive -Path build/bt/Release/bt.exe -DestinationPath atf/${{ env.ZIP_FILE_NAME }} -CompressionLevel Optimal
Compress-Archive -Path build/bt/Release/bt.pdb -DestinationPath atf/${{ env.PDB_FILE_NAME }} -CompressionLevel Optimal
"${{ env.VERSION }}" | Out-File atf/version.txt -NoNewline
(Get-FileHash -Algorithm SHA256 -Path atf/${{ env.ZIP_FILE_NAME }}).Hash | Out-File atf/${{ env.ZIP_FILE_NAME }}.sha256.txt
(Get-FileHash -Algorithm SHA256 -Path atf/${{ env.MSI_FILE_NAME }}).Hash | Out-File atf/${{ env.MSI_FILE_NAME }}.sha256.txt
cp docs/release-notes.md atf/
cp docs/instructions.md atf/
env:
ZIP_FILE_NAME: bt-${{ env.VERSION }}.zip
PDB_FILE_NAME: pdb-${{ env.VERSION }}.zip
MSI_FILE_NAME: bt-${{ env.VERSION }}.msi
# python.exe exit code for vt_scan.py is -1073741819 - this is a bug in python, it's not a real error.
- name: VT Scan
run: |
pip install -r scripts/requirements.txt
python scripts/vt_scan.py --files atf/${{ env.ZIP_FILE_NAME }} atf/${{ env.MSI_FILE_NAME }} --md-output atf/vt.md
$LASTEXITCODE = 0
env:
ZIP_FILE_NAME: bt-${{ env.VERSION }}.zip
MSI_FILE_NAME: bt-${{ env.VERSION }}.msi
VT_API_KEY: ${{ secrets.VT_API_KEY }}
- uses: actions/upload-artifact@v3
name: collect binaries
with:
name: bin
path: atf/*
# build-linux:
# runs-on: ubuntu-latest
# name: 'Linux Build'
# env:
# VCPKG_DEFAULT_VCPKG_TRIPLET: x64-linux
# VCPKG_TRIPLET: x64-linux
# steps:
# - uses: actions/checkout@v3
# with:
# submodules: true
# - uses: friendlyanon/setup-vcpkg@v1
# with:
# committish: ${{ env.VCPKG_HASH }}
# cache: true
# - name: ⚙️ configure
# run: >
# cmake -B build -S .
# -D CMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
# -D "CMAKE_TOOLCHAIN_FILE=${{ env.VCPKG_ROOT }}/scripts/buildsystems/vcpkg.cmake"
# -D "VCPKG_TARGET_TRIPLET=${{ env.VCPKG_TRIPLET }}"
# working-directory: .
# - name: 🏭 build
# run: cmake --build build --config ${{ env.VCPKG_CONFIG }}
# working-directory: .
# - name: debug
# run: ls -R
# working-directory: build
# - name: 🧪 unit tests
# run: ./test
# working-directory: build/test
wrs-build:
runs-on: ubuntu-latest
name: 'Build Docs'
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Build docs
uses: JetBrains/writerside-github-action@v4
with:
instance: ${{ env.DOC_INSTANCE }}
artifact: ${{ env.DOC_INSTANCE }}
docker-version: ${{ env.DOC_DOCKER_VERSION }}
- name: Upload documentation
uses: actions/upload-artifact@v4
with:
name: docs
path: artifacts/*.zip
retention-days: 1
wrs-deploy:
needs: wrs-build
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
name: 'Deploy Docs to GitHub Pages'
steps:
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: docs
- name: Unzip artifact
run: unzip -O UTF-8 -qq ${{ env.DOC_ARTIFACT }} -d dir
- name: Setup Pages
uses: actions/configure-pages@v2
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: dir
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1