-
Notifications
You must be signed in to change notification settings - Fork 226
151 lines (128 loc) · 4.63 KB
/
reusable-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
name: Build
on:
workflow_call:
inputs:
os:
default: windows-2019
type: string
configuration:
description: 'Build configuration; release or debug'
default: release
type: string
architecture:
description: 'Build Architecture'
default: x86
type: string
upload:
description: Upload resulting artifact?
type: boolean
default: false
docs:
description: Build documentation?
type: boolean
default: false
run-name: Build ${{ inputs.architecture }} on ${{ inputs.os }}
permissions:
contents: read
jobs:
build:
name: Build
runs-on: ${{ inputs.os }}
timeout-minutes: 60
env:
DXSDK_DIR: "${{ github.workspace }}\\DXSDK"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Problem Matcher
uses: ammaraskar/msvc-problem-matcher@master
- name: Setup MSVC Console
uses: ilammy/msvc-dev-cmd@v1
with:
arch: ${{ inputs.architecture }}
- name: Install documentation prerequisites
if: ${{ inputs.docs }}
shell: pwsh
run: |
choco install --no-progress miktex
choco install --no-progress doxygen.install
choco install --no-progress libreoffice-fresh
Add-Content $env:GITHUB_PATH "C:\Program Files\MiKTeX\miktex\bin\x64\"
- name: Set up Miktex with appropriate packages
if: ${{ inputs.docs }}
shell: pwsh
run: |
miktex --admin --verbose packages update-package-database
miktex --admin --verbose packages update
miktex --admin --verbose packages install noto
miktex --verbose packages update
miktex --admin --verbose fndb refresh
updmap --admin
- name: Create directories
run: |
mkdir out\build
mkdir out\install
- name: Cache irrKlang package
uses: actions/cache@v4
with:
path: ${{ github.workspace }}/Extern/irrKlang/${{ inputs.architecture }}
key: irrKlang-${{ inputs.architecture }}
- name: Cache DirectX SDK
id: cache
uses: actions/cache@v4
with:
path: "${{ github.workspace }}\\DXSDK"
key: dxsdk_jun10
- name: Download DirectX SDK
if: steps.cache.outputs.cache-hit != 'true'
shell: cmd
run: |
curl -L https://download.microsoft.com/download/a/e/7/ae743f1f-632b-4809-87a9-aa1bb3458e31/DXSDK_Jun10.exe -o DXSDK_Jun10.exe
7z x DXSDK_Jun10.exe DXSDK/Include
7z x DXSDK_Jun10.exe DXSDK/Lib
del DXSDK_Jun10.exe
dir /S /B DXSDK
- name: Configure
run: cmake . --preset windows-${{ inputs.architecture }}-${{ inputs.configuration }}
-DORBITER_MAKE_DOC=${{ inputs.docs && 'ON' || 'OFF' }}
-DDXSDK_DIR:PATH="${{ github.workspace }}\\DXSDK"
- name: Build
run: cmake --build --preset windows-${{ inputs.architecture }}-${{ inputs.configuration }} --jobs 2
- name: Test
run: ctest --preset windows-${{ inputs.architecture }}-${{ inputs.configuration }} --parallel 2
- name: Install
working-directory: ${{ github.workspace }}/out/build/windows-${{ inputs.architecture }}-${{ inputs.configuration }}
run: cmake --install . --prefix ${{ github.workspace }}/out/install
- name: List exports
shell: cmd
run: |
dumpbin /EXPORTS ${{ github.workspace }}\out\install\Orbiter\Modules\Server\Orbiter.exe /OUT:exports_tmp0.txt
type exports_tmp0.txt | find " ?" > exports_tmp1.txt
for /F "tokens=4" %%F in (exports_tmp1.txt) do @echo %%F >> exports_tmp2.txt
undname exports_tmp2.txt | sort > exports.txt
del /Q exports_tmp*.txt
- name: Diff exports with Orbiter 2016
if: ${{ inputs.architecture == 'x86' }}
shell: cmd
continue-on-error: true
run: git diff -U0 --ignore-cr-at-eol --ignore-space-at-eol --no-index exports.2016.txt exports.txt
- name: Pack
if: ${{ github.ref == 'refs/heads/main' }}
working-directory: ${{ github.workspace }}/out/install/Orbiter
shell: cmd
run: '7z a "${{ github.workspace }}/out/Orbiter.zip" .'
- name: Upload exports
if: inputs.upload
uses: actions/upload-artifact@v4
with:
name: exports-${{ inputs.architecture }}
path: ${{ github.workspace }}/exports.txt
retention-days: 1
- name: Upload Build Artifact
uses: actions/upload-artifact@v4
if: inputs.upload
with:
name: Orbiter-${{ inputs.architecture }}
# A file, directory or wildcard pattern that describes what to upload
path: ${{ github.workspace }}/out/Orbiter.zip
retention-days: 1