-
-
Notifications
You must be signed in to change notification settings - Fork 27
223 lines (212 loc) · 8.27 KB
/
main.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
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
name: CI
on:
push:
paths:
- "src/**"
- "api/**"
- ".github/workflows/*"
- "craftos2-lua/**"
- "craftos2-lua"
- "resources/CraftOSTest.lua"
- "resources/CCT-Tests.patch"
pull_request:
paths:
- "src/**"
- "api/**"
- ".github/workflows/*"
- "craftos2-lua/**"
- "craftos2-lua"
- "resources/CraftOSTest.lua"
jobs:
build:
name: Build & test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Download ROM
run: sudo git clone https://github.com/MCJack123/craftos2-rom /usr/local/share/craftos
- name: Install dependencies
run: |
sudo apt update
sudo apt install -y libsdl2-dev libsdl2-mixer-dev libhpdf-dev libpng++-dev libwebp-dev libpoco-dev libncurses5-dev
- name: Build Lua
run: |
git submodule update --init --recursive
make -C craftos2-lua linux -j$(grep ^cpu\\scores /proc/cpuinfo | uniq | awk '{print $4}')
- name: Build CraftOS-PC
run: |
CFLAGS=-Wall ./configure
make -j$(grep ^cpu\\scores /proc/cpuinfo | uniq | awk '{print $4}')
- name: Run CraftOSTest
run: ./craftos --headless --script resources/CraftOSTest.lua || echo $? > ~/.retval
continue-on-error: true
timeout-minutes: 2
- name: Show logs
run: |
cat ~/.local/share/craftos-pc/computer/0/CraftOSTest.log
if [ -e ~/.retval ]; then exit $(cat ~/.retval); fi
build-basic:
name: Build & test (no optional features)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Download ROM
run: sudo git clone https://github.com/MCJack123/craftos2-rom /usr/local/share/craftos
- name: Install dependencies
run: |
sudo apt update
sudo apt install -y libsdl2-dev libpoco-dev
- name: Build Lua
run: |
git submodule update --init --recursive
make -C craftos2-lua linux -j$(grep ^cpu\\scores /proc/cpuinfo | uniq | awk '{print $4}')
- name: Build CraftOS-PC
run: |
CFLAGS=-Wall ./configure --without-ncurses --without-png --without-sdl_mixer --with-html
make -j$(grep ^cpu\\scores /proc/cpuinfo | uniq | awk '{print $4}')
- name: Run CraftOSTest
run: ./craftos --headless --script resources/CraftOSTest.lua || echo $? > ~/.retval
continue-on-error: true
timeout-minutes: 2
- name: Show logs
run: |
cat ~/.local/share/craftos-pc/computer/0/CraftOSTest.log
if [ -e ~/.retval ]; then exit $(cat ~/.retval); fi
build-standalone:
name: Build & test (standalone)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Install dependencies
run: |
sudo apt update
sudo apt install -y libsdl2-dev libsdl2-mixer-dev libhpdf-dev libpng++-dev libwebp-dev libpoco-dev libncurses5-dev nodejs
- name: Build standalone ROM
run: |
git clone https://github.com/MCJack123/craftos2-rom
cd craftos2-rom
node ../resources/packStandaloneROM.js
cd ..
- name: Build Lua
run: |
git submodule update --init --recursive
make -C craftos2-lua linux -j$(grep ^cpu\\scores /proc/cpuinfo | uniq | awk '{print $4}')
- name: Build CraftOS-PC
run: |
CFLAGS=-Wall ./configure --with-standalone_rom=craftos2-rom/fs_standalone.cpp
make -j$(grep ^cpu\\scores /proc/cpuinfo | uniq | awk '{print $4}')
- name: Run CraftOSTest
run: ./craftos --headless --script resources/CraftOSTest.lua || echo $? > ~/.retval
continue-on-error: true
timeout-minutes: 2
- name: Show logs
run: |
cat ~/.local/share/craftos-pc/computer/0/CraftOSTest.log
if [ -e ~/.retval ]; then exit $(cat ~/.retval); fi
build-cct-test:
name: Run CC:T tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Download ROM & CC:T
run: |
sudo git clone https://github.com/MCJack123/craftos2-rom /usr/local/share/craftos
git clone --branch v1.20.1-1.112.0 https://github.com/cc-tweaked/CC-Tweaked ../CC-Tweaked
patch -p1 -d ../CC-Tweaked < resources/CCT-Tests.patch
- name: Install dependencies
run: |
sudo apt update
sudo apt install -y libsdl2-dev libsdl2-mixer-dev libhpdf-dev libpng++-dev libwebp-dev libpoco-dev libncurses5-dev
- name: Build Lua
run: |
git submodule update --init --recursive
make -C craftos2-lua linux -j$(grep ^cpu\\scores /proc/cpuinfo | uniq | awk '{print $4}')
- name: Build CraftOS-PC
run: |
CFLAGS=-Wall ./configure
make -j$(grep ^cpu\\scores /proc/cpuinfo | uniq | awk '{print $4}')
- name: Run CC:T McFly Tests
run: ./craftos --mount-ro test-rom=../CC-Tweaked/projects/core/src/test/resources/test-rom --headless --script resources/CCT-Test-Bootstrap.lua || echo $? > ~/.retval
continue-on-error: true
timeout-minutes: 1
- name: Show logs
run: |
cat ~/.local/share/craftos-pc/computer/0/test-log.txt
if [ -e ~/.retval ]; then exit $(cat ~/.retval); fi
build-windows:
name: Build Windows
runs-on: windows-2022
steps:
- uses: actions/checkout@v1
- name: Download ROM
run: git clone https://github.com/MCJack123/craftos2-rom "C:\Program Files\CraftOS-PC"
- name: Restore vcpkg cache
uses: lukka/run-vcpkg@v10
with:
vcpkgGitCommitId: 861c33057553ee836e7061ffbdabc25ea343145d
- name: Prepare environment
run: |
git submodule update --init --recursive
mkdir x64\ReleaseC
mkdir x64\Release
& $Env:VCPKG_ROOT\vcpkg integrate install
((Get-Content -path "$Env:VCPKG_ROOT\ports\poco\portfile.cmake") -replace "VCPKG_TARGET_IS_WINDOWS", "false") -replace "lib/cmake/Poco", "cmake" | Set-Content -Path "$Env:VCPKG_ROOT\ports\poco\portfile.cmake"
- name: Build CraftOS-PC
env:
APIKEY: ${{secrets.WINDOWS_APIKEY}}
run: |
function Invoke-Environment {
param
(
# Any cmd shell command, normally a configuration batch file.
[Parameter(Mandatory=$true)]
[string] $Command
)
$Command = "`"" + $Command + "`""
cmd /c "$Command > nul 2>&1 && set" | . { process {
if ($_ -match '^([^=]+)=(.*)') {
[System.Environment]::SetEnvironmentVariable($matches[1], $matches[2])
}
}}
}
Invoke-Environment "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
$tag = git rev-parse --short HEAD
Set-Item ENV:ExternalCompilerOptions /DCRAFTOSPC_COMMIT='\"'$tag'\" '/DCRASHREPORT_API_KEY
[System.Text.Encoding]::ASCII.GetString([System.Convert]::FromBase64String($Env:APIKEY)) | Out-File -Encoding "UTF8" src\apikey.cpp
msbuild "CraftOS-PC 2.sln" /p:Configuration=ReleaseC
msbuild "CraftOS-PC 2.sln" /p:Configuration=Release
copy x64\Release\CraftOS-PC.exe CraftOS-PC.exe
copy x64\Release\CraftOS-PC.pdb CraftOS-PC.pdb
copy x64\ReleaseC\CraftOS-PC.exe CraftOS-PC_console.exe
copy x64\ReleaseC\CraftOS-PC.pdb CraftOS-PC_console.pdb
copy craftos2-lua\src\lua52.dll lua52.dll
copy craftos2-lua\src\lua52.pdb lua52.pdb
# Remove buildtrees that kill the cache
Remove-Item vcpkg\buildtrees\* -Force -Recurse -ErrorAction SilentlyContinue
- name: Run CraftOSTest
run: |
x64\ReleaseC\CraftOS-PC --headless --script resources\CraftOSTest.lua --rom "C:\Program Files\CraftOS-PC"
echo $LASTEXITCODE > retval.txt
continue-on-error: true
timeout-minutes: 2
- name: Show logs
run: |
type "$ENV:APPDATA\CraftOS-PC\computer\0\CraftOSTest.log"
$code = Get-Content .\retval.txt
if ( $code -ne 0 ) { exit $code }
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: CraftOS-PC-Artifact
path: |
CraftOS-PC.exe
CraftOS-PC_console.exe
lua52.dll
- name: Upload artifact symbols
uses: actions/upload-artifact@v2
with:
name: CraftOS-PC-Artifact-Symbols
path: |
CraftOS-PC.pdb
CraftOS-PC_console.pdb
lua52.pdb