Repository navigation
194 lines (187 loc) · 6.74 KB
/
Copy pathrelease.yml
File metadata and controls
194 lines (187 loc) · 6.74 KB
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
name: Release
# Tags must match plugin.json. Build macOS arm64/x64, Windows x64 and Linux
# ARM64/x64 packages from the same revision, then upload a draft prerelease.
# The maintainer verifies the downloaded assets before publishing the draft.
# Contract 0 currently requires the matching Viva preview, not stable Lithe.
on:
push:
tags: ["v*"]
permissions:
contents: read
concurrency:
group: release-${{ github.ref }}
cancel-in-progress: false
jobs:
test:
name: Rust checks and tests
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- uses: actions/setup-node@v4
with:
node-version: 22
- name: Test package resources
run: node --test --test-timeout=60000 scripts/package/*.test.mjs
- name: Check formatting
run: cargo fmt --all --check
- name: Lint
run: cargo clippy --workspace --all-targets --locked -- -D warnings
- name: Test
run: cargo test --workspace --locked
- name: Check the pinned plugin SDK release
run: scripts/verify-sdk-lock.sh --download
windows:
name: Build Windows x64 backend
env:
# The plugin must run without a separately installed VC++ runtime.
RUSTFLAGS: -C target-feature=+crt-static
runs-on: windows-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: dtolnay/rust-toolchain@stable
with:
targets: x86_64-pc-windows-msvc
- uses: Swatinem/rust-cache@v2
- name: Test the native Windows backend
run: cargo test --workspace --locked --target x86_64-pc-windows-msvc
- name: Build the native Windows backend
run: cargo build --release --locked -p lithe-java-backend --target x86_64-pc-windows-msvc
- uses: actions/upload-artifact@v4
with:
name: windows-backend
path: target/x86_64-pc-windows-msvc/release/lithe-java-backend.exe
if-no-files-found: error
retention-days: 7
release:
name: Publish ${{ github.ref_name }}
needs: [test, windows, linux]
runs-on: macos-26
timeout-minutes: 60
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
# scripts/assemble-package.sh compiles the plugin backend for each
# architecture it packages.
- uses: dtolnay/rust-toolchain@stable
with:
targets: aarch64-apple-darwin, x86_64-apple-darwin
- uses: actions/setup-node@v4
with:
node-version: 22
- uses: actions/download-artifact@v4
with:
name: windows-backend
path: .artifacts/windows-backend
- name: Check the tag matches plugin.json
run: |
set -euo pipefail
version=$(plutil -extract version raw -o - io.github.lithe-idea.java-support/plugin.json)
if [[ "$GITHUB_REF_NAME" != "v$version" ]]; then
echo "::error::Tag $GITHUB_REF_NAME does not match plugin.json version $version"
exit 1
fi
- name: Build and verify both architectures
run: |
set -euo pipefail
for arch in arm64 x86_64; do
scripts/build-package.sh --arch "$arch"
done
- name: Verify Windows runtime dependencies
run: |
set -euo pipefail
/usr/bin/objdump -p .artifacts/windows-backend/lithe-java-backend.exe > "$RUNNER_TEMP/windows-imports.txt"
if grep -Ei 'DLL Name:.*(VCRUNTIME|MSVCP|libgcc|libstdc|libwinpthread)' "$RUNNER_TEMP/windows-imports.txt"; then
echo "::error::Windows backend depends on a separately installed compiler runtime"
exit 1
fi
- name: Assemble the Windows archive
run: |
set -euo pipefail
archive=$(node scripts/package/build-windows.mjs .artifacts/windows-backend/lithe-java-backend.exe)
mkdir -p dist
cp "$archive" "$archive.sha256" dist/
- uses: actions/download-artifact@v4
with:
pattern: java-linux-*
merge-multiple: true
path: dist
- name: Archive and publish
env:
GH_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
checksums="$RUNNER_TEMP/checksums.txt"
: > "$checksums"
for arch in arm64 x86_64; do
scripts/archive-package.sh --package ".artifacts/package/$arch/io.github.lithe-idea.java-support" \
--arch "$arch" >> "$checksums"
done
notes="docs/releases/$GITHUB_REF_NAME.md"
test -s "$notes"
cp "$notes" "$RUNNER_TEMP/notes.md"
{
echo
echo '### SHA-256'
echo '```'
sed 's# dist/# #' "$checksums"
cat dist/*windows-x64.zip.sha256 dist/*linux-*.zip.sha256
echo '```'
} >> "$RUNNER_TEMP/notes.md"
gh release create "$GITHUB_REF_NAME" dist/*.zip dist/*.zip.sha256 --verify-tag --draft --prerelease \
--title "Java Support $GITHUB_REF_NAME" --notes-file "$RUNNER_TEMP/notes.md"
linux:
name: Build and run Linux ${{ matrix.arch }} package
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-24.04
arch: x64
- os: ubuntu-24.04-arm
arch: arm64
runs-on: ${{ matrix.os }}
timeout-minutes: 40
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- uses: actions/setup-node@v4
with:
node-version: 22
- name: Install packaging tools
run: sudo apt-get update && sudo apt-get install -y zsh zip unzip
- name: Restore checksum-verified downloads
uses: actions/cache@v4
with:
path: |
.artifacts/jdtls-downloads
.artifacts/jdk-downloads
key: linux-${{ matrix.arch }}-${{ hashFiles('third_party/*/manifest.json') }}
- name: Test the native backend
run: cargo test --workspace --locked
- name: Build and verify the archive
run: node scripts/package/build-linux.mjs "${{ matrix.arch }}"
- name: Start the packaged backend and language server
run: node scripts/package/smoke-linux.mjs dist/*-linux-${{ matrix.arch }}.zip
- uses: actions/upload-artifact@v4
with:
name: java-linux-${{ matrix.arch }}
path: |
dist/*-linux-*.zip
dist/*-linux-*.zip.sha256
if-no-files-found: error
retention-days: 7