forked from dtinth/mosh-static
-
Notifications
You must be signed in to change notification settings - Fork 4
216 lines (183 loc) · 6.73 KB
/
autobuild.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
on:
workflow_dispatch:
name: Auto-Build
jobs:
macports-cache:
runs-on: macos-12
steps:
- uses: actions/checkout@v3
- name: Install gtar sudo wrapper
run: |
sudo mv /usr/local/bin/gtar /usr/local/bin/gtar.orig
sudo cp macOS/gtar /usr/local/bin/gtar
sudo chmod +x /usr/local/bin/gtar
- name: Cache macports
id: cache-macports
uses: actions/cache@v3
env:
cache-name: cache-macports
with:
path: /opt/local
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('macOS/port-deps.sh') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Setup macports dependencies
if: steps.cache-macports.outputs.cache-hit != 'true'
run: |
curl -L "https://github.com/macports/macports-base/releases/download/v2.8.1/MacPorts-2.8.1-12-Monterey.pkg" --output macports.pkg
sudo installer -pkg macports.pkg -target /
chmod +x macOS/port-deps.sh && ./macOS/port-deps.sh
linux-build:
name: Linux Build
runs-on: ubuntu-20.04
strategy:
matrix:
architecture: [amd64, arm64, armv7]
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Build container for ${{ matrix.architecture }}
run: |
docker build -t builder --build-arg TARGET_ARCH=${{ matrix.architecture }} .
- run: git clone --depth=1 --branch mosh-1.4.0 https://github.com/mobile-shell/mosh.git
- name: Build binaries for ${{ matrix.architecture }}
run: docker run -v $PWD/mosh:/mosh -w /mosh --name=builder builder sh -c './autogen.sh && LDFLAGS=-static ./configure && make'
- name: Test run mosh-server
run: docker run -v $PWD/mosh:/mosh -w /mosh/src/frontend builder sh -c 'chmod +x mosh-server && ./mosh-server'
- name: Rename binaries
run: |
mv mosh/src/frontend/mosh-server mosh/src/frontend/mosh-server-linux-${{ matrix.architecture }}
mv mosh/src/frontend/mosh-client mosh/src/frontend/mosh-client-linux-${{ matrix.architecture }}
- uses: actions/upload-artifact@v3
with:
name: mosh-server-linux-${{ matrix.architecture }}
path: mosh/src/frontend/mosh-server-linux-${{ matrix.architecture }}
if-no-files-found: error
- uses: actions/upload-artifact@v3
with:
name: mosh-client-linux-${{ matrix.architecture }}
path: mosh/src/frontend/mosh-client-linux-${{ matrix.architecture }}
if-no-files-found: error
macos-build:
name: macOS Build (x86_64, arm64)
needs: macports-cache
runs-on: macos-12
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install gtar sudo wrapper
run: |
sudo mv /usr/local/bin/gtar /usr/local/bin/gtar.orig
sudo cp macOS/gtar /usr/local/bin/gtar
sudo chmod +x /usr/local/bin/gtar
- name: Restore macports cache
id: cache-macports
uses: actions/cache@v3
env:
cache-name: cache-macports
with:
path: /opt/local
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('macOS/port-deps.sh') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- run: git clone --depth=1 --branch mosh-1.4.0 https://github.com/mobile-shell/mosh.git
- run: PATH=/opt/local/bin:$PATH ./autogen.sh
working-directory: ./mosh
- run: |
chmod +x build.sh
env ZERO_AR_DATE=1 MACOSX_DEPLOYMENT_TARGET=11.0 PATH=/opt/local/bin:$PATH ./build.sh
working-directory: ./macOS
- uses: actions/upload-artifact@v3
with:
name: mosh-client-darwin-x86_64
path: ./macOS/prefix_x86_64/local/bin/mosh-client-darwin-x86_64
- uses: actions/upload-artifact@v3
with:
name: mosh-server-darwin-x86_64
path: ./macOS/prefix_x86_64/local/bin/mosh-server-darwin-x86_64
- uses: actions/upload-artifact@v3
with:
name: mosh-client-darwin-arm64
path: ./macOS/prefix_arm64/local/bin/mosh-client-darwin-arm64
- uses: actions/upload-artifact@v3
with:
name: mosh-server-darwin-arm64
path: ./macOS/prefix_arm64/local/bin/mosh-server-darwin-arm64
release:
name: Release
needs: [linux-build, macos-build]
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Download artifacts
uses: actions/download-artifact@v3
- name: Create release description
run: |
(
echo '- [Build #${{ github.run_number }}](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})'
echo '- [Workflow file](https://github.com/${{ github.repository }}/blob/${{ github.sha }}/.github/workflows/autobuild.yml)'
echo
echo '## Files'
echo '### Linux'
echo '```'
(
for dir in mosh-client-linux* mosh-server-linux*; do
cd "$dir"
for prog in mosh*; do
file "$prog"
done
cd ..
done
)
echo '```'
echo
echo '### macOS'
echo '```'
(
for dir in mosh-client-darwin* mosh-server-darwin*; do
cd "$dir"
for prog in mosh*; do
file "$prog"
done
cd ..
done
)
echo '```'
echo
echo '## SHA256 Checksums'
echo '```'
(
for dir in mosh-client* mosh-server*; do
cd "$dir"
for prog in mosh*; do
sha256sum "$prog"
done
cd ..
done
)
echo '```'
) | tee release.md
- id: upload_artifact
uses: actions/upload-artifact@v3
with:
name: release.md
path: release.md
if-no-files-found: error
- name: Create release
id: create_release
uses: softprops/action-gh-release@v1
with:
name: "Build #${{ github.run_number }}"
tag_name: run-${{ github.run_number }}
prerelease: false
draft: false
body_path: release.md
files: |
mosh-client-*/mosh-client*
mosh-server-*/mosh-server*