Skip to content

Commit 9a76725

Browse files
committed
Update CI to build on linux
1 parent c88efb4 commit 9a76725

1 file changed

Lines changed: 148 additions & 28 deletions

File tree

.github/workflows/build.yml

Lines changed: 148 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -5,64 +5,184 @@ on:
55
pull_request:
66
workflow_dispatch:
77

8-
defaults:
9-
run:
10-
working-directory: C:/SML
11-
128
jobs:
139
build:
14-
runs-on: self-hosted
10+
runs-on: arc-k8s
1511
steps:
1612
- name: Check for permission to run CI
1713
env:
1814
GH_TOKEN: ${{ secrets.BOT_TOKEN }}
1915
if: ${{ env.GH_TOKEN == '' }}
2016
# https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions?tool=powershell#setting-an-error-message
2117
run: |
22-
Write-Output "::error title=External Contributor PR::Pull requests made by users not in the organization intentionally can't access the CI secrets. Don't worry about the CI failure, the team will build the project locally to test it out anyways."
18+
echo "::error title=External Contributor PR::Pull requests made by users not in the organization intentionally can't access the CI secrets. Don't worry about the CI failure, the team will build the project locally to test it out anyways."
2319
exit 1
2420
25-
- name: Cleanup
26-
run: Remove-Item * -Recurse -Force -Confirm:$false -ErrorAction Ignore
21+
- name: Dependencies
22+
run: sudo apt update && sudo apt install -y wget build-essential zstd dos2unix
23+
24+
- name: Setup github CLI
25+
run: |
26+
(type -p wget >/dev/null || (sudo apt update && sudo apt install wget -y)) \
27+
&& sudo mkdir -p -m 755 /etc/apt/keyrings \
28+
&& out=$(mktemp) && wget -nv -O$out https://cli.github.com/packages/githubcli-archive-keyring.gpg \
29+
&& cat $out | sudo tee /etc/apt/keyrings/githubcli-archive-keyring.gpg > /dev/null \
30+
&& sudo chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg \
31+
&& sudo mkdir -p -m 755 /etc/apt/sources.list.d \
32+
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
33+
&& sudo apt update \
34+
&& sudo apt install gh -y
35+
36+
- name: Setup Wine
37+
run: |
38+
export WINEPREFIX="$RUNNER_TEMP/.wine"
39+
echo "WINEPREFIX=$WINEPREFIX" >> $GITHUB_ENV
40+
echo "WINEDEBUG=-all" >> $GITHUB_ENV
41+
42+
## When we switch back to the upstream build, check if the runner image has been updated to Ubuntu 26.04, which supports WoW64
43+
# sudo dpkg --add-architecture i386
44+
# sudo mkdir -pm755 /etc/apt/keyrings
45+
# wget -O - https://dl.winehq.org/wine-builds/winehq.key | sudo gpg --dearmor -o /etc/apt/keyrings/winehq-archive.key -
46+
# sudo wget -NP /etc/apt/sources.list.d/ https://dl.winehq.org/wine-builds/ubuntu/dists/noble/winehq-noble.sources
47+
# sudo apt update && sudo apt install -y --no-install-recommends winehq-devel
48+
49+
## Building from source with the oleaut32 typelib patch to properly compile with the VS typelib for opening blueprint nodes in VS
50+
## until https://gitlab.winehq.org/wine/wine/-/merge_requests/9640 is merged
51+
sudo apt update
52+
sudo apt install -y gcc-multilib gcc-mingw-w64 libasound2-dev bluez libpulse-dev libdbus-1-dev libfontconfig-dev libfreetype-dev libgnutls28-dev libgl-dev libunwind-dev libx11-dev libxcomposite-dev libxcursor-dev libxfixes-dev libxi-dev libxrandr-dev libxrender-dev libxext-dev libwayland-bin libwayland-dev libegl-dev libxkbcommon-dev libxkbregistry-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libosmesa6-dev libsdl2-dev libudev-dev libvulkan-dev flex bison
53+
54+
export WINE_VERSION="11.0"
55+
56+
wget -O $RUNNER_TEMP/wine_typelib.patch https://gitlab.winehq.org/wine/wine/-/merge_requests/9640.patch
57+
58+
export PATCH_HASH="$(sha256sum $RUNNER_TEMP/wine_typelib.patch | awk '{print $1}')"
59+
60+
export WINE_BUILD_ID="$WINE_VERSION-$PATCH_HASH"
61+
62+
if [ ! -d $RUNNER_TOOL_CACHE/wine-source-$WINE_BUILD_ID ]; then
63+
git clone -b wine-$WINE_VERSION https://gitlab.winehq.org/wine/wine.git $RUNNER_TOOL_CACHE/wine-source-$WINE_BUILD_ID
64+
65+
cd $RUNNER_TOOL_CACHE/wine-source-$WINE_BUILD_ID
66+
67+
git config user.email "ci@example.com"
68+
git config user.name "CI"
69+
git am $RUNNER_TEMP/wine_typelib.patch
70+
71+
mkdir build && cd build
72+
73+
../configure --enable-archs=x86_64,i386 --without-tests
74+
make -j$(nproc)
75+
fi
76+
77+
cd $RUNNER_TOOL_CACHE/wine-source-$WINE_BUILD_ID/build
78+
sudo make install
79+
80+
mkdir -p $WINEPREFIX
81+
WINEDLLOVERRIDES="mscoree,mshtml=" wineboot -u
82+
wineserver -w
2783
28-
- uses: actions/checkout@v2
84+
- name: Setup MSVC
85+
run: |
86+
sudo apt install -y msitools perl
87+
88+
git clone -b ue-patches https://github.com/mircearoata/msvc-wine.git $RUNNER_TEMP/msvc-wine
89+
90+
export MSVC_DOWNLOAD_ARGS='
91+
--accept-license
92+
--channel release.ltsc.17.8
93+
--msvc-version 17.8
94+
--sdk-version 10.0.22621
95+
Microsoft.Net.4.8.SDK
96+
Microsoft.VisualStudio.MinShell
97+
'
98+
99+
# Avoid redownloading and reextracting files to reduce amount of rebuilds
100+
CACHE_HASH=$($RUNNER_TEMP/msvc-wine/vsdownload.py --print-selection $MSVC_DOWNLOAD_ARGS | sha256sum | awk '{print $1}')
101+
MSVC_DIR="$RUNNER_TOOL_CACHE/msvc/$CACHE_HASH"
102+
103+
if [ ! -f $RUNNER_TOOL_CACHE/msvc-download/X64.Debuggers.And.Tools-x64_en-us.msi ]; then
104+
wget -P $RUNNER_TOOL_CACHE/msvc-download https://github.com/kbandla/installers/releases/latest/download/X64.Debuggers.And.Tools-x64_en-us.msi
105+
fi
106+
107+
if [ ! -f $MSVC_DIR/.installed ]; then
108+
$RUNNER_TEMP/msvc-wine/vsdownload.py \
109+
--dest $MSVC_DIR \
110+
--cache $RUNNER_TOOL_CACHE/msvc-download \
111+
$MSVC_DOWNLOAD_ARGS
112+
113+
msiextract -C $MSVC_DIR $RUNNER_TOOL_CACHE/msvc-download/X64.Debuggers.And.Tools-x64_en-us.msi > /dev/null
114+
115+
$RUNNER_TEMP/msvc-wine/install.sh $MSVC_DIR
116+
117+
cat > $MSVC_DIR/bin/x64/pdbcopy << 'EOF'
118+
#!/usr/bin/env bash
119+
#
120+
# Copyright (c) 2025 Mircea Roata
121+
#
122+
# Permission to use, copy, modify, and/or distribute this software for any
123+
# purpose with or without fee is hereby granted, provided that the above
124+
# copyright notice and this permission notice appear in all copies.
125+
#
126+
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
127+
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
128+
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
129+
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
130+
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
131+
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
132+
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
133+
134+
. "$(dirname "$0")"/msvcenv.sh
135+
136+
SDKDEBUGBINDIR="$SDKBASE/Debuggers/x64"
137+
"$(dirname "$0")"/wine-msvc.sh "$SDKDEBUGBINDIR/pdbcopy.exe" "$@"
138+
EOF
139+
140+
ln -sf ./pdbcopy $MSVC_DIR/bin/x64/pdbcopy.exe
141+
chmod +x $MSVC_DIR/bin/x64/pdbcopy*
142+
143+
touch $MSVC_DIR/.installed
144+
fi
145+
146+
echo "UE_WINE_MSVC=`realpath $MSVC_DIR`" >> $GITHUB_ENV
147+
148+
- uses: actions/checkout@v6
29149
with:
30150
path: SML
31151

32-
- name: Copy repo to working directory
33-
run: Copy-Item "$Env:GITHUB_WORKSPACE\\SML" -Destination "C:\\SML" -Recurse
34-
35152
- name: Create UE directory
36153
run: mkdir ue
37154

38155
- name: Download, Extract and Setup UE
39-
working-directory: C:/SML/ue
156+
working-directory: ue
40157
env:
41158
GH_TOKEN: ${{ secrets.BOT_TOKEN }}
42159
run: |
43-
gh release download --repo satisfactorymodding/UnrealEngine -p "UnrealEngine-CSS-Editor-Win64.7z.*"
44-
7z x UnrealEngine-CSS-Editor-Win64.7z.001
45-
rm UnrealEngine-CSS-Editor-Win64.7z*
46-
.\\SetupScripts\\Register.bat
160+
gh release download --repo satisfactorymodding/UnrealEngine -p "UnrealEngine-CSS-Editor-Linux.tar.zst.*"
161+
cat UnrealEngine-CSS-Editor-Linux.tar.zst.* | zstd -d | tar -xf -
162+
rm UnrealEngine-CSS-Editor-Linux.tar.zst.*
163+
./Engine/Binaries/Linux/UnrealVersionSelector -register
47164
48-
- name: Download and Extract Wwise
49-
# TODO: Switch back to https://github.com/Backblaze/B2_Command_Line_Tool/releases/latest/download/b2-windows.exe once b2 fixes their signing
165+
- name: Download Wwise
50166
run: |
51-
Invoke-WebRequest -Uri "https://github.com/Backblaze/B2_Command_Line_Tool/releases/download/v4.1.0/b2-windows.exe" -OutFile "b2.exe"
52-
.\b2.exe account authorize "${{ secrets.WWISE_B2_KEY_ID }}" "${{ secrets.WWISE_B2_KEY }}"
53-
.\b2.exe file download "b2://${{ secrets.WWISE_B2_BUCKET }}/Wwise.7z" "Wwise.7z"
54-
7z x -aoa Wwise.7z -oSML\\Plugins\\
55-
rm Wwise.7z
167+
gh release download --repo mircearoata/wwise-cli -p wwise-cli_linux_amd64 -O wwise-cli
168+
chmod +x ./wwise-cli
169+
# Discard stdout to not show signed download URLs while they are still valid
170+
./wwise-cli download --sdk-version "2023.1.14.8770" --filter Packages=SDK --filter DeploymentPlatforms=Windows_vc160 --filter DeploymentPlatforms=Windows_vc170 --filter DeploymentPlatforms=Linux --filter DeploymentPlatforms= >/dev/null
171+
./wwise-cli integrate-ue --integration-version "2023.1.14.3555" --project "$GITHUB_WORKSPACE/SML/FactoryGame.uproject" >/dev/null
172+
env:
173+
GH_TOKEN: ${{ secrets.BOT_TOKEN }}
174+
WWISE_EMAIL: ${{ secrets.WWISE_EMAIL }}
175+
WWISE_PASSWORD: ${{ secrets.WWISE_PASSWORD }}
56176

57177
- name: Build for Development Editor
58-
run: .\\ue\\Engine\\Build\\BatchFiles\\Build.bat FactoryEditor Win64 Development -project="C:\\SML\\SML\\FactoryGame.uproject"
178+
run: ./ue/Engine/Build/BatchFiles/Linux/Build.sh FactoryEditor Linux Development -project="$GITHUB_WORKSPACE/SML/FactoryGame.uproject"
59179

60180
- name: Package SML Mod
61-
run: .\\ue\\Engine\\Build\\BatchFiles\\RunUAT.bat -ScriptsForProject="C:\\SML\\SML\\FactoryGame.uproject" PackagePlugin -Project="C:\\SML\\SML\\FactoryGame.uproject" -dlcname=SML -merge -build -server -clientconfig=Shipping -serverconfig=Shipping -platform=Win64 -serverplatform=Win64+Linux -nocompileeditor -installed
181+
run: ./ue/Engine/Build/BatchFiles/RunUAT.sh -ScriptsForProject="$GITHUB_WORKSPACE/SML/FactoryGame.uproject" PackagePlugin -Project="$GITHUB_WORKSPACE/SML/FactoryGame.uproject" -dlcname=SML -merge -build -server -clientconfig=Shipping -serverconfig=Shipping -platform=Win64 -serverplatform=Win64+Linux -nocompileeditor -installed
62182

63183
- name: Archive SML artifact
64-
uses: actions/upload-artifact@v4
184+
uses: actions/upload-artifact@v7
65185
if: ${{ github.event_name == 'push' }}
66186
with:
67187
name: sml
68-
path: C:\\SML\\SML\\Saved\\ArchivedPlugins\\SML\\*.zip
188+
path: SML/Saved/ArchivedPlugins/SML/*.zip

0 commit comments

Comments
 (0)