-
Notifications
You must be signed in to change notification settings - Fork 0
164 lines (132 loc) · 5.51 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
name: Build
on: [push, pull_request]
env:
EXECUTABLE_NAME: soukoban-rs
OSX_APP_NAME: Sokoban
jobs:
build-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: Build
run: cargo build --release
- name: Pack
uses: vimtor/action-zip@v1
with:
files: assets target/release/${{ env.EXECUTABLE_NAME }}.exe
dest: sokoban-windows.zip
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: sokoban-windows.zip
path: sokoban-windows.zip
# - name: Create installer
# run: |
# set VERSION=
# dotnet build -p:Version=${{ env.TAG }} -c Release build/windows/installer/Installer.wixproj --output installer
# - name: Upload artifact to release
# uses: svenstaro/upload-release-action@v2
# with:
# repo_token: ${{ secrets.GITHUB_TOKEN }}
# file: installer/en-US/installer.msi
# asset_name: sokoban-windows.msi
# tag: ${{ env.TAG }}
# overwrite: true
build-linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install pkg-config libx11-dev libasound2-dev libudev-dev
- name: Build
run: cargo build --release
- name: Pack
run: |
chmod +x target/release/${{ env.EXECUTABLE_NAME }}
mv target/release/${{ env.EXECUTABLE_NAME }} .
tar -czf sokoban-linux.tar.gz ${{ env.EXECUTABLE_NAME }} assets
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: sokoban-linux.tar.gz
path: sokoban-linux.tar.gz
build-macos:
runs-on: macos-latest
env:
MACOSX_DEPLOYMENT_TARGET: 11.0
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: aarch64-apple-darwin, x86_64-apple-darwin
- name: Build (ARM)
run: SDKROOT=$(xcrun -sdk macosx --show-sdk-path) cargo build --release --target=aarch64-apple-darwin
- name: Build (x64)
run: SDKROOT=$(xcrun -sdk macosx --show-sdk-path) cargo build --release --target=x86_64-apple-darwin
- name: Create universal binary
run: lipo -create -output target/release/${{ env.EXECUTABLE_NAME }} target/aarch64-apple-darwin/release/${{ env.EXECUTABLE_NAME }} target/x86_64-apple-darwin/release/${{ env.EXECUTABLE_NAME }}
- name: Pack
run: |
mkdir -p build/macos/src/Game.app/Contents/MacOS/assets
cp -r assets/ build/macos/src/Game.app/Contents/MacOS/assets
cp target/release/${{ env.EXECUTABLE_NAME }} build/macos/src/Game.app/Contents/MacOS/
mv build/macos/src/Game.app build/macos/src/${{ env.OSX_APP_NAME }}.app
ln -s /Applications build/macos/src/
hdiutil create -fs HFS+ -volname "${{ env.OSX_APP_NAME }}" -srcfolder build/macos/src sokoban-macos.dmg
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: sokoban-macos.dmg
path: sokoban-macos.dmg
build-android:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: Add rustup target(s)
run: rustup target add aarch64-linux-android
- name: Install cargo-apk
run: cargo install --force cargo-apk
- name: Build
# Uses a debug build, since release builds require keystore configuration
run: ANDROID_NDK_ROOT=$ANDROID_NDK_LATEST_HOME cargo apk build --package mobile
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: sokoban-android.apk
path: target/debug/apk/sokoban-rs.apk
build-wasm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install pkg-config libx11-dev libasound2-dev libudev-dev
- name: Install trunk
uses: jetli/[email protected]
with:
version: latest
- name: Add rustup target(s)
run: rustup target add wasm32-unknown-unknown
- name: Build
run: trunk build --release
- name: Optimize
uses: NiklasEi/wasm-opt-action@v2
with:
file: dist/*.wasm
- name: Pack
uses: vimtor/action-zip@v1
with:
files: dist/
dest: sokoban-wasm.zip
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: sokoban-wasm.zip
path: sokoban-wasm.zip