Skip to content

Commit 7f16c37

Browse files
committed
Try slippi build actions
1 parent f73ca7f commit 7f16c37

File tree

1 file changed

+352
-0
lines changed

1 file changed

+352
-0
lines changed

.github/workflows/main.yml

Lines changed: 352 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,352 @@
1+
name: Builds
2+
3+
on:
4+
push:
5+
branches:
6+
- "**"
7+
paths-ignore:
8+
- "**.md"
9+
pull_request:
10+
branches:
11+
- slippi
12+
paths-ignore:
13+
- "**.md"
14+
15+
jobs:
16+
pre_build:
17+
name: Pre Build Checks
18+
runs-on: ubuntu-latest
19+
outputs:
20+
should_skip: ${{ steps.skip_check.outputs.should_skip }}
21+
steps:
22+
- id: skip_check
23+
uses: fkirc/skip-duplicate-actions@master
24+
with:
25+
concurrent_skipping: "same_content"
26+
do_not_skip: '["push", "workflow_dispatch", "schedule"]'
27+
28+
# goal is to prevent merges when the commit is not from the main branch, builds should still succeed
29+
check_rust_commit:
30+
needs: [pre_build]
31+
if: ${{ needs.pre_build.outputs.should_skip != 'true' }}
32+
name: Verify SlippiRustExtensions Commit is in Main
33+
runs-on: ubuntu-latest
34+
steps:
35+
- uses: actions/checkout@v4
36+
- name: Main Branch Check
37+
shell: bash
38+
run: |
39+
git submodule update --init Externals/SlippiRustExtensions
40+
cd Externals/SlippiRustExtensions
41+
commit_id=$(git rev-parse HEAD)
42+
git branch --contains $commit_id | grep main
43+
44+
windows:
45+
needs: [pre_build]
46+
if: ${{ needs.pre_build.outputs.should_skip != 'true' }}
47+
strategy:
48+
fail-fast: false
49+
matrix:
50+
build_type: [Netplay]
51+
include:
52+
- build_type: Netplay
53+
artifact_name: mainline-windows-netplay
54+
build_config: -G "Ninja" -DCMAKE_BUILD_TYPE="Release" -DSLIPPI_PLAYBACK=false
55+
name: "Windows ${{ matrix.build_type }}"
56+
runs-on: windows-2022
57+
steps:
58+
- name: "Checkout"
59+
uses: actions/checkout@v4
60+
with:
61+
submodules: recursive
62+
- id: rust_ver
63+
name: Grab Rust Version
64+
shell: bash
65+
run: echo "rust_ver=$(sed -rn 's/^channel = "(.*)"/\1/p' ./Externals/SlippiRustExtensions/rust-toolchain.toml)" >> "$GITHUB_OUTPUT"
66+
- name: "Install Rust"
67+
uses: actions-rust-lang/setup-rust-toolchain@v1
68+
with:
69+
toolchain: ${{ steps.rust_ver.outputs.rust_ver }} # Pin to our specific Rust version.
70+
rustflags: "" # Disable default injection of warnings = errors.
71+
- name: Cache Utils
72+
uses: actions/cache@v4
73+
with:
74+
path: |
75+
./CodeSignTool/
76+
key: ${{ runner.os }}-${{ secrets.CACHE_CONTROL }}
77+
- name: 'Fetch Git Tags'
78+
shell: bash
79+
run: |
80+
git fetch --prune --unshallow
81+
echo "GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD)" >> $GITHUB_ENV
82+
echo "GIT_HASH=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
83+
echo "GIT_TAG=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV
84+
echo "CURR_DATE=$(date +%Y-%m-%d)" >> $GITHUB_ENV
85+
- uses: egor-tensin/vs-shell@v2
86+
- name: "Build ${{ matrix.build_type }} Dolphin"
87+
shell: cmd
88+
working-directory: ${{ github.workspace }}
89+
run: |
90+
mkdir build
91+
cd build
92+
cmake ${{ matrix.build_config }} ..
93+
cmake --build . --target dolphin-emu
94+
- name: "Prep ${{ matrix.build_type }} Artifact"
95+
working-directory: ${{ github.workspace }}
96+
run: |
97+
Xcopy /Y /E /I .\Data\Sys .\Binary\x64\Sys
98+
Xcopy /Y /E /I .\Data\user .\Binary\x64\User
99+
- name: "Codesign ${{ matrix.build_type }} Dolphin"
100+
working-directory: ${{ github.workspace }}
101+
shell: powershell
102+
env:
103+
ES_USERNAME: ${{ secrets.ES_USERNAME }}
104+
SLIPPI_BUILD_TYPE: ${{ matrix.build_type }}
105+
if: env.ES_USERNAME != null
106+
run: |
107+
$msg = git log -1 --no-merges --pretty=%B
108+
$build_type = $env:SLIPPI_BUILD_TYPE.ToLower()
109+
if ($msg -notmatch "^release:.*" -And $msg -notmatch "^release\($build_type\):.*") {
110+
echo "not release, skipping code signing"
111+
exit 0;
112+
}
113+
if (!(Test-Path ".\CodeSignTool\CodeSignTool.bat" -PathType Leaf)) {
114+
mkdir CodeSignTool
115+
cd .\CodeSignTool
116+
Invoke-WebRequest -Uri https://www.ssl.com/download/codesigntool-for-windows/ -UseBasicParsing -OutFile ".\CodeSignTool.zip"
117+
7z x CodeSignTool.zip
118+
Remove-Item CodeSignTool.zip
119+
} else {
120+
cd .\CodeSignTool
121+
}
122+
CodeSignTool.bat sign -credential_id="${{ secrets.ES_CREDENTIAL_ID }}" -username="${{ secrets.ES_USERNAME }}" -password="${{ secrets.ES_PASSWORD }}" -totp_secret="${{ secrets.ES_TOTP_SECRET }}" -input_file_path="${{ github.workspace }}\Binary\x64\Slippi_Dolphin.exe" -override="true"
123+
- name: Package Artifact
124+
working-directory: ${{ github.workspace }}
125+
run: |
126+
$FILE_NAME="${{ env.CURR_DATE }}-${{ env.GIT_HASH }}-${{ env.GIT_TAG }}-${{ matrix.artifact_name }}.zip"
127+
mkdir artifact
128+
cd .\Binary\x64\
129+
attrib +r Sys\*.* /s
130+
fsutil file createnew portable.txt 0
131+
7z a $FILE_NAME .\*
132+
move $FILE_NAME ..\..\artifact\
133+
- name: "Publish"
134+
uses: actions/upload-artifact@v4
135+
with:
136+
name: ${{ matrix.artifact_name }}
137+
path: "./artifact/"
138+
linux:
139+
needs: [pre_build]
140+
if: ${{ needs.pre_build.outputs.should_skip != 'true' }}
141+
strategy:
142+
fail-fast: false
143+
matrix:
144+
build_type: [Netplay]
145+
include:
146+
- build_type: Netplay
147+
artifact_name: mainline-linux-netplay
148+
build_config: netplay
149+
name: "Linux ${{ matrix.build_type }}"
150+
runs-on: ubuntu-22.04
151+
steps:
152+
- name: "Checkout"
153+
uses: actions/checkout@v4
154+
with:
155+
submodules: recursive
156+
- id: rust_ver
157+
name: Grab Rust Version
158+
shell: bash
159+
run: echo "rust_ver=$(sed -rn 's/^channel = "(.*)"/\1/p' ./Externals/SlippiRustExtensions/rust-toolchain.toml)" >> "$GITHUB_OUTPUT"
160+
- name: "Install Rust"
161+
uses: actions-rust-lang/setup-rust-toolchain@v1
162+
with:
163+
toolchain: ${{ steps.rust_ver.outputs.rust_ver }} # Pin to our specific Rust version.
164+
rustflags: "" # Disable default injection of warnings = errors.
165+
- name: 'Fetch Git Tags'
166+
run: |
167+
git fetch --prune --unshallow
168+
echo "GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD)" >> $GITHUB_ENV
169+
echo "GIT_HASH=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
170+
echo "GIT_TAG=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV
171+
echo "CURR_DATE=$(date +%Y-%m-%d)" >> $GITHUB_ENV
172+
- name: "Install prerequisites"
173+
shell: bash
174+
run: |
175+
sudo dpkg --add-architecture amd64
176+
sudo apt update
177+
sudo apt install \
178+
cmake \
179+
pkg-config \
180+
git \
181+
wget \
182+
libao-dev \
183+
libasound2-dev \
184+
libavcodec-dev \
185+
libavformat-dev \
186+
libbluetooth-dev \
187+
libenet-dev \
188+
libgtk2.0-dev \
189+
liblzo2-dev \
190+
libminiupnpc-dev \
191+
libopenal-dev \
192+
libpulse-dev \
193+
libreadline-dev \
194+
libsfml-dev \
195+
libsoil-dev \
196+
libsoundtouch-dev \
197+
libswscale-dev \
198+
libusb-1.0-0-dev \
199+
libwebkit2gtk-4.0-dev \
200+
libxext-dev \
201+
libxrandr-dev \
202+
portaudio19-dev \
203+
zlib1g-dev \
204+
libudev-dev \
205+
libevdev-dev \
206+
libmbedtls-dev \
207+
libcurl4-openssl-dev \
208+
libegl1-mesa-dev \
209+
libpng-dev \
210+
qt6-base-private-dev \
211+
libqt6svg6-dev \
212+
libxxf86vm-dev \
213+
x11proto-xinerama-dev \
214+
libfuse2
215+
- name: "Build ${{ matrix.build_type }} Dolphin"
216+
working-directory: ${{ github.workspace }}
217+
run: |
218+
chmod +x ./build-linux.sh && ./build-linux.sh ${{ matrix.build_config }}
219+
- name: "Build ${{ matrix.build_type }} AppImage"
220+
working-directory: ${{ github.workspace }}
221+
run: |
222+
chmod +x ./build-appimage.sh && ./build-appimage.sh ${{ matrix.build_config }}
223+
- name: "Package"
224+
working-directory: ${{ github.workspace }}
225+
run: |
226+
mkdir artifact
227+
FILE_NAME=${{ env.CURR_DATE }}-${{ env.GIT_HASH }}-${{ env.GIT_TAG }}-${{ matrix.artifact_name }}.zip
228+
chmod +x ./*.AppImage
229+
zip -r "${FILE_NAME}" ./*.AppImage*
230+
zip -r -j "${FILE_NAME}" ./*.AppImage*
231+
pushd ./AppDir/usr/bin/
232+
zip -r -u "../../../${FILE_NAME}" ./Sys
233+
popd
234+
mv "${FILE_NAME}" ./artifact/
235+
- name: "Publish"
236+
uses: actions/upload-artifact@v4
237+
with:
238+
name: ${{ matrix.artifact_name }}
239+
path: "./artifact/"
240+
macOS:
241+
needs: [pre_build]
242+
if: ${{ needs.pre_build.outputs.should_skip != 'true' }}
243+
strategy:
244+
fail-fast: false
245+
matrix:
246+
build_type: [Netplay]
247+
include:
248+
- build_type: Netplay
249+
artifact_name: mainline-macOS-netplay
250+
build_config: netplay
251+
name: "macOS ${{ matrix.build_type }}"
252+
runs-on: macos-13
253+
steps:
254+
- name: "Checkout"
255+
uses: actions/checkout@v4
256+
with:
257+
submodules: recursive
258+
- id: rust_ver
259+
name: Grab Rust Version
260+
shell: bash
261+
run: echo "rust_ver=$(sed -rn 's/^channel = "(.*)"/\1/p' ./Externals/SlippiRustExtensions/rust-toolchain.toml)" >> "$GITHUB_OUTPUT"
262+
- name: "Install Rust"
263+
uses: actions-rust-lang/setup-rust-toolchain@v1
264+
with:
265+
toolchain: ${{ steps.rust_ver.outputs.rust_ver }} # Pin to our specific Rust version.
266+
rustflags: "" # Disable default injection of warnings = errors.
267+
- name: 'Fetch Git Tags'
268+
run: |
269+
git fetch --prune --unshallow
270+
echo "GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD)" >> $GITHUB_ENV
271+
echo "GIT_HASH=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
272+
echo "GIT_TAG=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV
273+
echo "CURR_DATE=$(date +%Y-%m-%d)" >> $GITHUB_ENV
274+
- name: "Download and Install prerequisites"
275+
shell: bash
276+
run: |
277+
rm '/usr/local/bin/2to3' || true
278+
echo "HOMEBREW_NO_AUTO_UPDATE=1" >> $GITHUB_ENV
279+
brew install \
280+
ffmpeg \
281+
libpng \
282+
pkgconfig \
283+
libao \
284+
sound-touch \
285+
hidapi \
286+
qt@6
287+
# brew upgrade cmake
288+
- name: "Build ${{ matrix.build_type }} Dolphin"
289+
shell: bash
290+
working-directory: ${{ github.workspace }}
291+
env:
292+
CERTIFICATE_MACOS_APPLICATION: ${{ secrets.CERTIFICATE_MACOS_APPLICATION }}
293+
run: |
294+
export LIBRARY_PATH=$LIBRARY_PATH:/usr/local/lib
295+
chmod +x ./build-mac.sh && ./build-mac.sh ${{ matrix.build_config }}
296+
mkdir artifact
297+
FILE_NAME=${{ env.CURR_DATE }}-${{ env.GIT_HASH }}-${{ env.GIT_TAG }}-${{ matrix.artifact_name }}
298+
echo "FILE_NAME=$FILE_NAME" >> $GITHUB_ENV
299+
- name: "Codesign ${{ matrix.build_type}} Dolphin"
300+
if: env.CERTIFICATE_MACOS_APPLICATION != null
301+
shell: bash
302+
working-directory: ${{ github.workspace }}
303+
env:
304+
CERTIFICATE_MACOS_APPLICATION: ${{ secrets.CERTIFICATE_MACOS_APPLICATION }}
305+
CERTIFICATE_MACOS_PASSWORD: ${{ secrets.CERTIFICATE_MACOS_PASSWORD }}
306+
run: |
307+
chmod +x Tools/load-macos-certs-ci.sh && ./Tools/load-macos-certs-ci.sh
308+
mkdir -p ~/private_keys/
309+
echo '${{ secrets.APPLE_CONNECT_API_KEY }}' > ~/private_keys/AuthKey_${{ secrets.APPLE_API_KEY_ID }}.p8
310+
/usr/bin/codesign -f -s "${{ secrets.APPLE_IDENTITY_HASH }}" --deep --options runtime --entitlements Source/Core/DolphinQt/DolphinEmu.entitlements ./build/Binaries/Slippi_Dolphin.app
311+
- name: "Package DMG"
312+
shell: bash
313+
working-directory: ${{ github.workspace }}
314+
run: |
315+
chmod +x Tools/create-dmg/run.sh
316+
./Tools/create-dmg/run.sh --no-internet-enable \
317+
--volname "Slippi Dolphin Beta Installer" \
318+
--volicon "Data/slippi_dmg_icon.icns" \
319+
--background "Data/slippi_dmg_background.png" \
320+
--text-size 14 \
321+
--window-pos 200 120 \
322+
--window-size 590 610 \
323+
--icon-size 100 \
324+
--app-drop-link 440 196 \
325+
--icon "Slippi_Dolphin.app" 140 196 \
326+
--hide-extension "Slippi_Dolphin.app" \
327+
"${{ env.FILE_NAME }}.dmg" \
328+
"./build/Binaries/"
329+
mv "${{ env.FILE_NAME }}.dmg" artifact/
330+
- name: "Sign and Notarize ${{ matrix.build_type }} Release DMG"
331+
if: env.CERTIFICATE_MACOS_APPLICATION != null
332+
shell: bash
333+
working-directory: ${{ github.workspace }}
334+
env:
335+
APPLE_API_KEY: ${{ secrets.APPLE_API_KEY_ID }}
336+
APPLE_ISSUER_ID: ${{ secrets.APPLE_ISSUER_ID }}
337+
CERTIFICATE_MACOS_APPLICATION: ${{ secrets.CERTIFICATE_MACOS_APPLICATION }}
338+
run: |
339+
/usr/bin/codesign -f -s "${{ secrets.APPLE_IDENTITY_HASH }}" --deep --options runtime ./artifact/${{ env.FILE_NAME }}.dmg
340+
chmod +x Tools/notarize_netplay.sh && ./Tools/notarize_netplay.sh ./artifact/${{ env.FILE_NAME }}.dmg
341+
- name: "Publish"
342+
if: success() || failure()
343+
uses: actions/upload-artifact@v4
344+
with:
345+
name: ${{ matrix.artifact_name }}
346+
path: "./artifact/"
347+
#- name: "Enable Admin Debugging via SSH (if failed)"
348+
# if: failure()
349+
# uses: luchihoratiu/debug-via-ssh@main
350+
# with:
351+
# NGROK_AUTH_TOKEN: ${{ secrets.NGROK_TOKEN }}
352+
# SSH_PASS: ${{ secrets.NGROK_PASS }}

0 commit comments

Comments
 (0)