forked from neovide/neovide
-
Notifications
You must be signed in to change notification settings - Fork 2
223 lines (186 loc) · 7.12 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
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: Build and Test
permissions:
checks: write
contents: read
on:
push:
paths-ignore:
- "website/**"
- ".vscode/**"
- "**.md"
env:
CARGO_TERM_COLOR: always
defaults:
run:
shell: bash # necessary for windows
jobs:
lint:
uses: ./.github/workflows/lint-app.yml
test:
needs: lint
strategy:
fail-fast: false
matrix:
os: [windows-latest, macOS-12, ubuntu-latest]
toolchain: [stable, nightly]
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.toolchain == 'nightly' }}
steps:
- uses: actions/checkout@v3
- name: Setup toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ matrix.toolchain }}
- name: Show toolchain info
run: cargo --version --verbose
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ matrix.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install neovim
uses: rhysd/action-setup-vim@v1
with:
neovim: true
- name: Install cargo-nextest
uses: taiki-e/install-action@nextest
- name: Test
env:
RUST_BACKTRACE: full
run: |
cargo nextest run --profile ci
mv target/nextest/ci/results.xml target/nextest/ci/results-${{ matrix.os }}.xml
- name: Prepare test results
run: |
mkdir -p test-results
mv target/nextest/ci/results-*.xml test-results/
- name: Upload test results
uses: actions/upload-artifact@v3
with:
name: test-results
path: |
test-results
event-upload:
needs: test
name: Upload Test Event
runs-on: ubuntu-latest
steps:
- uses: actions/upload-artifact@v3
with:
name: test-event
path: ${{ github.event_path }}
build-deploy:
needs: test
strategy:
fail-fast: false
matrix:
# NOTE: Should use the oldest available Ubuntu release, for maximum compatibility
os: [windows-latest, macOS-12, ubuntu-20.04]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ matrix.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install dependencies
run: |
if [[ $RUNNER_OS == "Windows" ]]; then
if ! which cargo-wix; then cargo install cargo-wix; fi
elif [[ $RUNNER_OS == "macOS" ]]; then
rustup target add x86_64-apple-darwin
rustup target add aarch64-apple-darwin
if ! which cargo-bundle; then cargo install cargo-bundle; fi
elif [[ $RUNNER_OS == "Linux" ]]; then
sudo apt-get update
sudo apt-get -qq install -y \
curl gnupg ca-certificates git gcc-multilib g++-multilib cmake \
libssl-dev pkg-config libfreetype6-dev libasound2-dev \
libexpat1-dev libxcb-composite0-dev libbz2-dev freeglut3-dev \
libxi-dev libfuse2 appstream
fi
- name: Install neovim
uses: rhysd/action-setup-vim@v1
with:
neovim: true
- name: Build
run: |
if [[ $RUNNER_OS == "Windows" ]]; then
cargo wix --output target/release/neovide.msi --package neovide
elif [[ $RUNNER_OS == "macOS" ]]; then
echo "MACOSX_DEPLOYMENT_TARGET=10.11" >> $GITHUB_ENV
# x86
cargo build --locked --release --target=x86_64-apple-darwin
cargo bundle --release --target=x86_64-apple-darwin
# arch
cargo build --locked --release --target=aarch64-apple-darwin
cargo bundle --release --target=aarch64-apple-darwin
elif [[ $RUNNER_OS == "Linux" ]]; then
cargo build --locked --release
fi
- name: Prepare Artifacts
run: |
cd target/release
if [[ $RUNNER_OS == "Windows" ]]; then
echo "ARTIFACT=neovide.exe" >> $GITHUB_ENV
echo "ARTIFACT2=neovide.msi" >> $GITHUB_ENV
elif [[ $RUNNER_OS == "macOS" ]]; then
# merge builds
mkdir -p bundle/osx
rm -rf bundle/osx/neovide.app || true
cp -R ../x86_64-apple-darwin/release/bundle/osx/neovide.app \
bundle/osx/neovide.app
rm bundle/osx/neovide.app/Contents/MacOS/neovide
lipo ../x86_64-apple-darwin/release/bundle/osx/neovide.app/Contents/MacOS/neovide \
../aarch64-apple-darwin/release/bundle/osx/neovide.app/Contents/MacOS/neovide \
-create -output \
bundle/osx/neovide.app/Contents/MacOS/neovide
codesign --force --deep -s - bundle/osx/neovide.app
# create .dmg
hdiutil create neovide-uncompressed.dmg -volname "neovide" -srcfolder bundle/osx
hdiutil convert neovide-uncompressed.dmg -format UDZO -o neovide.dmg
echo "ARTIFACT=neovide.dmg" >> $GITHUB_ENV
elif [[ $RUNNER_OS == "Linux" ]]; then
# archive artifact
strip neovide
tar czvf neovide-linux-x86_64.tar.gz neovide
# create appimage
curl -Lo linuxdeploy https://github.com/linuxdeploy/linuxdeploy/releases/latest/download/linuxdeploy-x86_64.AppImage
chmod +x linuxdeploy
curl -Lo linuxdeploy-plugin-appimage https://github.com/linuxdeploy/linuxdeploy-plugin-appimage/releases/latest/download/linuxdeploy-plugin-appimage-x86_64.AppImage
chmod +x linuxdeploy-plugin-appimage
export LDAI_OUTPUT=neovide.AppImage
export LDAI_UPDATE_INFORMATION="gh-releases-zsync|neovide|neovide|latest|neovide.AppImage.zsync"
./linuxdeploy \
--executable=neovide \
--desktop-file=../../assets/neovide.desktop \
--appdir=AppDir \
--icon-file=../../assets/neovide.svg \
--output=appimage
echo "ARTIFACT=neovide-linux-x86_64.tar.gz" >> $GITHUB_ENV
echo "ARTIFACT2=neovide.AppImage" >> $GITHUB_ENV
echo "ARTIFACT3=neovide.AppImage.zsync" >> $GITHUB_ENV
fi
- uses: actions/upload-artifact@v3
with:
name: ${{ env.ARTIFACT }}
path: target/release/${{ env.ARTIFACT }}
- if: env.ARTIFACT2
uses: actions/upload-artifact@v3
with:
name: ${{ env.ARTIFACT2 }}
path: target/release/${{ env.ARTIFACT2 }}
- if: env.ARTIFACT3
uses: actions/upload-artifact@v3
with:
name: ${{ env.ARTIFACT3 }}
path: target/release/${{ env.ARTIFACT3 }}