-
Notifications
You must be signed in to change notification settings - Fork 8
196 lines (191 loc) · 6.39 KB
/
Copy pathbuild-artifacts.yml
File metadata and controls
196 lines (191 loc) · 6.39 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
195
196
name: Build artifacts
on:
workflow_call:
inputs:
source-ref:
required: true
type: string
channel:
required: true
type: string
cargo-profile:
required: false
type: string
default: release
vsix-profile:
required: false
type: string
default: release
permissions:
contents: read
jobs:
native:
name: Build ${{ matrix.rust-target }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-22.04
rust-target: x86_64-unknown-linux-gnu
vsix-target: linux-x64
zigbuild: true
- os: ubuntu-22.04
rust-target: aarch64-unknown-linux-gnu
vsix-target: linux-arm64
zigbuild: true
- os: ubuntu-22.04
rust-target: x86_64-unknown-linux-musl
vsix-target: alpine-x64
zigbuild: true
- os: ubuntu-22.04
rust-target: aarch64-unknown-linux-musl
vsix-target: alpine-arm64
zigbuild: true
- os: macos-15
rust-target: aarch64-apple-darwin
vsix-target: darwin-arm64
zigbuild: false
- os: windows-latest
rust-target: x86_64-pc-windows-msvc
vsix-target: win32-x64
zigbuild: false
env:
MACOSX_DEPLOYMENT_TARGET: ${{ matrix.rust-target == 'aarch64-apple-darwin' && '11.0' || '' }}
CARGO_PROFILE_RELEASE_INCREMENTAL: "false"
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.source-ref }}
submodules: recursive
- name: Setup Rust
uses: ./.github/actions/setup-rust
with:
targets: ${{ matrix.rust-target }}
- name: Setup cargo-zigbuild
if: matrix.zigbuild
run: |
set -euo pipefail
python3 -m pip install --user cargo-zigbuild
echo "${HOME}/.local/bin" >> "${GITHUB_PATH}"
- name: Setup sccache
uses: ./.github/actions/setup-sccache
- name: Rust cache
uses: Swatinem/rust-cache@v2
with:
shared-key: artifacts-${{ runner.os }}-${{ matrix.rust-target }}-${{ inputs.cargo-profile }}
cache-workspace-crates: true
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
cache-dependency-path: editors/vscode/package-lock.json
- name: Install extension dependencies
working-directory: editors/vscode
run: npm ci
- name: Set extension metadata
shell: bash
env:
CHANNEL: ${{ inputs.channel }}
run: |
set -euo pipefail
{
echo "VIDE_EXTENSION_BUILD_KIND=${CHANNEL}"
echo "VIDE_EXTENSION_COMMIT_HASH=$(git rev-parse --short HEAD)"
echo "VIDE_EXTENSION_BUILD_DATE=$(date -u +'%Y%m%dT%H%M%SZ')"
} >> "${GITHUB_ENV}"
- name: Build binary archive and stage extension server
shell: bash
run: scripts/build-artifact.sh "${{ matrix.rust-target }}" "${{ matrix.vsix-target }}" "${{ inputs.cargo-profile }}"
- name: Build VSIX
working-directory: editors/vscode
run: npm run package:vsix -- --target "${{ matrix.vsix-target }}" --profile "${{ inputs.vsix-profile }}" --server=prebuilt
- name: Upload binary archive
uses: actions/upload-artifact@v4
with:
name: binary-${{ matrix.rust-target }}
path: target/distrib/vide-${{ matrix.rust-target }}${{ inputs.cargo-profile == 'debug' && '-debug' || '' }}.*
if-no-files-found: error
- name: Upload VSIX
uses: actions/upload-artifact@v4
with:
name: vsix-${{ matrix.vsix-target }}
path: editors/vscode/vide-vscode-${{ matrix.vsix-target }}${{ inputs.vsix-profile == 'debug' && '-debug' || '' }}.vsix
if-no-files-found: error
source:
name: Build source archive and checksums
needs: native
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.source-ref }}
fetch-depth: 0
submodules: recursive
- name: Download binary archives
uses: actions/download-artifact@v4
with:
pattern: binary-*
path: target/distrib
merge-multiple: true
- name: Build source archive and checksum manifest
run: |
set -euo pipefail
mkdir -p target/distrib
python3 scripts/source-archive.py target/distrib/source.tar.gz
(
cd target/distrib
sha256sum source.tar.gz > source.tar.gz.sha256
cat ./*.sha256 | sort -k2 > sha256.sum
)
- name: Upload source archive and checksums
uses: actions/upload-artifact@v4
with:
name: source-and-checksums
path: |
target/distrib/source.tar.gz
target/distrib/source.tar.gz.sha256
target/distrib/sha256.sum
if-no-files-found: error
web:
name: Build web VSIX
runs-on: ubuntu-latest
defaults:
run:
working-directory: editors/vscode
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.source-ref }}
submodules: recursive
- name: Prepare Vide LSP WASM
uses: ./.github/actions/prepare-vide-lsp-wasm
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
cache-dependency-path: editors/vscode/package-lock.json
- name: Install extension dependencies
run: npm ci
- name: Set extension metadata
working-directory: .
shell: bash
env:
CHANNEL: ${{ inputs.channel }}
run: |
set -euo pipefail
{
echo "VIDE_EXTENSION_BUILD_KIND=${CHANNEL}"
echo "VIDE_EXTENSION_COMMIT_HASH=$(git rev-parse --short HEAD)"
echo "VIDE_EXTENSION_BUILD_DATE=$(date -u +'%Y%m%dT%H%M%SZ')"
} >> "${GITHUB_ENV}"
- name: Build web VSIX
run: npm run package:vsix:web -- --profile "${{ inputs.vsix-profile }}"
- name: Upload web VSIX
uses: actions/upload-artifact@v4
with:
name: vsix-web
path: editors/vscode/vide-vscode-web${{ inputs.vsix-profile == 'debug' && '-debug' || '' }}.vsix
if-no-files-found: error