forked from w1ne/labwired-core
-
Notifications
You must be signed in to change notification settings - Fork 0
206 lines (176 loc) · 6.43 KB
/
Copy pathcore-release.yml
File metadata and controls
206 lines (176 loc) · 6.43 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
197
198
199
200
201
202
203
204
205
206
name: Release
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
permissions:
contents: write
packages: write
jobs:
build:
name: Build ${{ matrix.target }}
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-gnu
runner: ubuntu-latest
platform: linux-x86_64
- target: aarch64-unknown-linux-gnu
runner: ubuntu-latest
platform: linux-aarch64
cross: true
- target: x86_64-apple-darwin
runner: macos-latest
platform: darwin-x86_64
- target: aarch64-apple-darwin
runner: macos-latest
platform: darwin-aarch64
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@1.95.0
with:
targets: ${{ matrix.target }}
- name: Cache dependencies
uses: Swatinem/rust-cache@v2
with:
shared-key: release-${{ matrix.target }}
workspaces: . -> target
- name: Install cross (for aarch64 Linux)
if: matrix.cross == true
run: cargo install cross --git https://github.com/cross-rs/cross
- name: Build (cross)
if: matrix.cross == true
run: cross build -p labwired-cli -p labwired-dap --release --target ${{ matrix.target }}
- name: Build (native)
if: matrix.cross != true
run: cargo build -p labwired-cli -p labwired-dap --release --target ${{ matrix.target }}
- name: Package binary
shell: bash
run: |
VERSION="${{ github.ref_name }}"
PLATFORM="${{ matrix.platform }}"
ARCHIVE="labwired-${VERSION}-${PLATFORM}.tar.gz"
mkdir -p dist
# Both binaries ship in the one tarball: the CLI runs `labwired test`
# (the .labwired/lab.yaml contract CI and the VS Code Run button share),
# and labwired-dap is the Debug Adapter the VS Code extension spawns for
# F5. Shipping only the CLI is what made editor debugging source-build-only.
# These lines are pinned by scripts/ci/verify-release-runner-contract.sh.
cp "target/${{ matrix.target }}/release/labwired" dist/labwired
chmod +x dist/labwired
cp "target/${{ matrix.target }}/release/labwired-dap" dist/labwired-dap
chmod +x dist/labwired-dap
tar -czf "${ARCHIVE}" -C dist labwired labwired-dap
echo "ARCHIVE=${ARCHIVE}" >> "$GITHUB_ENV"
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: labwired-${{ matrix.platform }}
path: ${{ env.ARCHIVE }}
release:
name: Create GitHub Release
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: dist
merge-multiple: true
- name: Create release and upload assets
uses: softprops/action-gh-release@v2
with:
name: LabWired ${{ github.ref_name }}
body: |
## Installation
```sh
curl -fsSL https://labwired.com/install.sh | sh
```
Or with a specific version:
```sh
curl -fsSL https://labwired.com/install.sh | LABWIRED_VERSION=${{ github.ref_name }} sh
```
See the [full changelog](CHANGELOG.md) for what's new.
files: dist/*.tar.gz
fail_on_unmatched_files: true
publish:
name: Publish CI runner image
needs: release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and publish CI runner image
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile.ci
push: true
platforms: linux/amd64
tags: |
ghcr.io/w1ne/labwired:${{ github.ref_name }}
ghcr.io/w1ne/labwired:latest
build-args: |
VERSION=${{ github.ref_name }}
REVISION=${{ github.sha }}
release-smoke:
name: Smoke released archives and runner image
needs: [release, publish]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Pull the release runner image anonymously
shell: bash
run: |
set -euo pipefail
docker logout ghcr.io || true
if ! docker pull "ghcr.io/w1ne/labwired:${{ github.ref_name }}"; then
echo "::error::Unable to anonymously pull the released runner image. Make the GHCR package public in GitHub Packages, then re-run this release workflow."
exit 1
fi
- name: Run the release runner image
shell: bash
run: |
set -euo pipefail
docker run --rm \
--user "$(id -u):$(id -g)" \
--volume "$GITHUB_WORKSPACE:/workspace" \
--workdir /workspace \
"ghcr.io/w1ne/labwired:${{ github.ref_name }}" \
test \
--script examples/ci/two-node-inputs-env.yaml \
--output-dir out/release-runner-smoke \
--no-uart-stdout
test -s out/release-runner-smoke/result.json
test -s out/release-runner-smoke/junit.xml
- name: Run the default release archive through the core action
uses: ./.github/actions/labwired-test
with:
script: examples/ci/two-node-inputs-env.yaml
output-dir: out/release-action-smoke
args: --no-uart-stdout
- name: Run an explicit release archive through the core action
uses: ./.github/actions/labwired-test
with:
version: ${{ github.ref_name }}
script: examples/ci/two-node-inputs-env.yaml
output-dir: out/release-action-smoke-second
args: --no-uart-stdout
- name: Verify core action artifacts
shell: bash
run: |
test -s out/release-action-smoke/result.json
test -s out/release-action-smoke/junit.xml
test -s out/release-action-smoke-second/result.json
test -s out/release-action-smoke-second/junit.xml