Skip to content

Commit 1153a86

Browse files
committed
chore: update dist, cross-compile
Swap to cross-compiling to aarch64-unknown-linux targets.
1 parent 53bdbda commit 1153a86

2 files changed

Lines changed: 79 additions & 46 deletions

File tree

.github/workflows/release.yml

Lines changed: 66 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1+
# This file was autogenerated by dist: https://opensource.axo.dev/cargo-dist/
2+
#
13
# Copyright 2022-2024, axodotdev
24
# SPDX-License-Identifier: MIT or Apache-2.0
35
#
46
# CI that:
57
#
68
# * checks for a Git Tag that looks like a release
7-
# * builds artifacts with cargo-dist (archives, installers, hashes)
9+
# * builds artifacts with dist (archives, installers, hashes)
810
# * uploads those artifacts to temporary workflow zip
911
# * on success, uploads the artifacts to Axo Releases and makes an Announcement
1012
# * on success, uploads the artifacts to a GitHub Release
@@ -13,11 +15,10 @@
1315
# title/body based on your changelogs.
1416

1517
name: Release
16-
1718
permissions:
18-
contents: write
19-
id-token: write
20-
attestations: write
19+
"attestations": "write"
20+
"contents": "write"
21+
"id-token": "write"
2122

2223
# This task will run whenever you push a git tag that looks like a version
2324
# like "1.0.0", "v0.1.0-prerelease.1", "my-app/0.1.0", "releases/v1.0.0", etc.
@@ -26,10 +27,10 @@ permissions:
2627
# must be a Cargo-style SemVer Version (must have at least major.minor.patch).
2728
#
2829
# If PACKAGE_NAME is specified, then the announcement will be for that
29-
# package (erroring out if it doesn't have the given version or isn't cargo-dist-able).
30+
# package (erroring out if it doesn't have the given version or isn't dist-able).
3031
#
3132
# If PACKAGE_NAME isn't specified, then the announcement will be for all
32-
# (cargo-dist-able) packages in the workspace with that version (this mode is
33+
# (dist-able) packages in the workspace with that version (this mode is
3334
# intended for workspaces with only one dist-able package, or with all dist-able
3435
# packages versioned/released in lockstep).
3536
#
@@ -47,7 +48,7 @@ on:
4748
- '**[0-9]+.[0-9]+.[0-9]+*'
4849

4950
jobs:
50-
# Run 'cargo dist plan' (or host) to determine what tasks we need to do
51+
# Run 'dist plan' (or host) to determine what tasks we need to do
5152
plan:
5253
runs-on: "ubuntu-20.04"
5354
outputs:
@@ -62,20 +63,25 @@ jobs:
6263
- uses: actions/checkout@v4
6364
with:
6465
submodules: recursive
65-
- name: Install cargo-dist
66+
- name: Install dist
6667
# we specify bash to get pipefail; it guards against the `curl` command
6768
# failing. otherwise `sh` won't catch that `curl` returned non-0
6869
shell: bash
69-
run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.16.0-prerelease.6/cargo-dist-installer.sh | sh"
70+
run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.26.0-prerelease.3/cargo-dist-installer.sh | sh"
71+
- name: Cache dist
72+
uses: actions/upload-artifact@v4
73+
with:
74+
name: cargo-dist-cache
75+
path: ~/.cargo/bin/dist
7076
# sure would be cool if github gave us proper conditionals...
7177
# so here's a doubly-nested ternary-via-truthiness to try to provide the best possible
7278
# functionality based on whether this is a pull_request, and whether it's from a fork.
7379
# (PRs run on the *source* but secrets are usually on the *target* -- that's *good*
7480
# but also really annoying to build CI around when it needs secrets to work right.)
7581
- id: plan
7682
run: |
77-
cargo dist ${{ (!github.event.pull_request && format('host --steps=create --tag={0}', github.ref_name)) || (env.AXO_RELEASES_TOKEN && 'host --steps=check') || 'plan' }} --output-format=json > plan-dist-manifest.json
78-
echo "cargo dist ran successfully"
83+
dist ${{ (!github.event.pull_request && format('host --steps=create --tag={0}', github.ref_name)) || (env.AXO_RELEASES_TOKEN && 'host --steps=check') || 'plan' }} --output-format=json > plan-dist-manifest.json
84+
echo "dist ran successfully"
7985
cat plan-dist-manifest.json
8086
echo "manifest=$(jq -c "." plan-dist-manifest.json)" >> "$GITHUB_OUTPUT"
8187
- name: "Upload dist-manifest.json"
@@ -93,18 +99,19 @@ jobs:
9399
if: ${{ fromJson(needs.plan.outputs.val).ci.github.artifacts_matrix.include != null && (needs.plan.outputs.publishing == 'true' || fromJson(needs.plan.outputs.val).ci.github.pr_run_mode == 'upload') }}
94100
strategy:
95101
fail-fast: false
96-
# Target platforms/runners are computed by cargo-dist in create-release.
102+
# Target platforms/runners are computed by dist in create-release.
97103
# Each member of the matrix has the following arguments:
98104
#
99105
# - runner: the github runner
100-
# - dist-args: cli flags to pass to cargo dist
101-
# - install-dist: expression to run to install cargo-dist on the runner
106+
# - dist-args: cli flags to pass to dist
107+
# - install-dist: expression to run to install dist on the runner
102108
#
103109
# Typically there will be:
104110
# - 1 "global" task that builds universal installers
105111
# - N "local" tasks that build each platform's binaries and platform-specific installers
106112
matrix: ${{ fromJson(needs.plan.outputs.val).ci.github.artifacts_matrix }}
107113
runs-on: ${{ matrix.runner }}
114+
container: ${{ matrix.container && matrix.container.image || null }}
108115
env:
109116
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
110117
BUILD_MANIFEST_NAME: target/distrib/${{ join(matrix.targets, '-') }}-dist-manifest.json
@@ -115,12 +122,15 @@ jobs:
115122
- uses: actions/checkout@v4
116123
with:
117124
submodules: recursive
118-
- uses: swatinem/rust-cache@v2
119-
with:
120-
key: ${{ join(matrix.targets, '-') }}
121-
cache-provider: ${{ matrix.cache_provider }}
122-
- name: Install cargo-dist
123-
run: ${{ matrix.install_dist }}
125+
- name: Install Rust non-interactively if not already installed
126+
if: ${{ matrix.container }}
127+
run: |
128+
if ! command -v cargo > /dev/null 2>&1; then
129+
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
130+
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
131+
fi
132+
- name: Install dist
133+
run: ${{ matrix.install_dist.run }}
124134
# Get the dist-manifest
125135
- name: Fetch local artifacts
126136
uses: actions/download-artifact@v4
@@ -134,8 +144,8 @@ jobs:
134144
- name: Build artifacts
135145
run: |
136146
# Actually do builds and make zips and whatnot
137-
cargo dist build ${{ needs.plan.outputs.tag-flag }} --print=linkage --output-format=json ${{ matrix.dist_args }} > dist-manifest.json
138-
echo "cargo dist ran successfully"
147+
dist build ${{ needs.plan.outputs.tag-flag }} --print=linkage --output-format=json ${{ matrix.dist_args }} > dist-manifest.json
148+
echo "dist ran successfully"
139149
- name: Attest
140150
uses: actions/attest-build-provenance@v1
141151
with:
@@ -149,7 +159,7 @@ jobs:
149159
run: |
150160
# Parse out what we just built and upload it to scratch storage
151161
echo "paths<<EOF" >> "$GITHUB_OUTPUT"
152-
jq --raw-output ".upload_files[]" dist-manifest.json >> "$GITHUB_OUTPUT"
162+
dist print-upload-files-from-manifest --manifest dist-manifest.json >> "$GITHUB_OUTPUT"
153163
echo "EOF" >> "$GITHUB_OUTPUT"
154164
155165
cp dist-manifest.json "$BUILD_MANIFEST_NAME"
@@ -174,9 +184,12 @@ jobs:
174184
- uses: actions/checkout@v4
175185
with:
176186
submodules: recursive
177-
- name: Install cargo-dist
178-
shell: bash
179-
run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.16.0-prerelease.6/cargo-dist-installer.sh | sh"
187+
- name: Install cached dist
188+
uses: actions/download-artifact@v4
189+
with:
190+
name: cargo-dist-cache
191+
path: ~/.cargo/bin/
192+
- run: chmod +x ~/.cargo/bin/dist
180193
# Get all the local artifacts for the global tasks to use (for e.g. checksums)
181194
- name: Fetch local artifacts
182195
uses: actions/download-artifact@v4
@@ -187,8 +200,8 @@ jobs:
187200
- id: cargo-dist
188201
shell: bash
189202
run: |
190-
cargo dist build ${{ needs.plan.outputs.tag-flag }} --output-format=json "--artifacts=global" > dist-manifest.json
191-
echo "cargo dist ran successfully"
203+
dist build ${{ needs.plan.outputs.tag-flag }} --output-format=json "--artifacts=global" > dist-manifest.json
204+
echo "dist ran successfully"
192205
193206
# Parse out what we just built and upload it to scratch storage
194207
echo "paths<<EOF" >> "$GITHUB_OUTPUT"
@@ -230,8 +243,12 @@ jobs:
230243
- uses: actions/checkout@v4
231244
with:
232245
submodules: recursive
233-
- name: Install cargo-dist
234-
run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.16.0-prerelease.6/cargo-dist-installer.sh | sh"
246+
- name: Install cached dist
247+
uses: actions/download-artifact@v4
248+
with:
249+
name: cargo-dist-cache
250+
path: ~/.cargo/bin/
251+
- run: chmod +x ~/.cargo/bin/dist
235252
# Fetch artifacts from scratch-storage
236253
- name: Fetch artifacts
237254
uses: actions/download-artifact@v4
@@ -244,7 +261,7 @@ jobs:
244261
- id: host
245262
shell: bash
246263
run: |
247-
cargo dist host ${{ needs.plan.outputs.tag-flag }} --steps=upload --steps=release --output-format=json > dist-manifest.json
264+
dist host ${{ needs.plan.outputs.tag-flag }} --steps=upload --steps=release --output-format=json > dist-manifest.json
248265
echo "artifacts uploaded and released successfully"
249266
cat dist-manifest.json
250267
echo "manifest=$(jq -c "." dist-manifest.json)" >> "$GITHUB_OUTPUT"
@@ -290,6 +307,11 @@ jobs:
290307
name=$(echo "$filename" | sed "s/\.rb$//")
291308
version=$(echo "$release" | jq .app_version --raw-output)
292309
310+
export PATH="/home/linuxbrew/.linuxbrew/bin:$PATH"
311+
brew update
312+
# We avoid reformatting user-provided data such as the app description and homepage.
313+
brew style --except-cops FormulaAudit/Homepage,FormulaAudit/Desc,FormulaAuditStrict --fix "Formula/${filename}" || true
314+
293315
git add "Formula/${filename}"
294316
git commit -m "${name} ${version}"
295317
done
@@ -334,8 +356,8 @@ jobs:
334356
secrets: inherit
335357
# publish jobs get escalated permissions
336358
permissions:
337-
id-token: write
338-
packages: write
359+
"id-token": "write"
360+
"packages": "write"
339361

340362
# Create an Announcement for all the Axo Releases, updating the "latest" release
341363
# Create a GitHub Release while uploading all files to it
@@ -358,8 +380,12 @@ jobs:
358380
- uses: actions/checkout@v4
359381
with:
360382
submodules: recursive
361-
- name: Install cargo-dist
362-
run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.16.0-prerelease.6/cargo-dist-installer.sh | sh"
383+
- name: Install cached dist
384+
uses: actions/download-artifact@v4
385+
with:
386+
name: cargo-dist-cache
387+
path: ~/.cargo/bin/
388+
- run: chmod +x ~/.cargo/bin/dist
363389
- name: Fetch Axo Artifacts
364390
uses: actions/download-artifact@v4
365391
with:
@@ -368,7 +394,8 @@ jobs:
368394
merge-multiple: true
369395
- name: Announce Axo Releases
370396
run: |
371-
cargo dist host --steps=announce ${{ needs.plan.outputs.tag-flag }}
397+
dist host --steps=announce ${{ needs.plan.outputs.tag-flag }}
398+
# Create a GitHub Release while uploading all files to it
372399
- name: "Download GitHub Artifacts"
373400
uses: actions/download-artifact@v4
374401
with:
@@ -384,9 +411,9 @@ jobs:
384411
PRERELEASE_FLAG: "${{ fromJson(needs.host.outputs.val).announcement_is_prerelease && '--prerelease' || '' }}"
385412
ANNOUNCEMENT_TITLE: "${{ fromJson(needs.host.outputs.val).announcement_title }}"
386413
ANNOUNCEMENT_BODY: "${{ fromJson(needs.host.outputs.val).announcement_github_body }}"
414+
RELEASE_COMMIT: "${{ github.sha }}"
387415
run: |
388416
# Write and read notes from a file to avoid quoting breaking things
389417
echo "$ANNOUNCEMENT_BODY" > $RUNNER_TEMP/notes.txt
390418
391-
gh release create "${{ needs.plan.outputs.tag }}" --title "$ANNOUNCEMENT_TITLE" --notes-file "$RUNNER_TEMP/notes.txt" $PRERELEASE_FLAG
392-
gh release upload "${{ needs.plan.outputs.tag }}" artifacts/*
419+
gh release create "${{ needs.plan.outputs.tag }}" --target "$RELEASE_COMMIT" $PRERELEASE_FLAG --title "$ANNOUNCEMENT_TITLE" --notes-file "$RUNNER_TEMP/notes.txt" artifacts/*

Cargo.toml

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,10 @@ debug-assertions = false
8484
inherits = "release"
8585
lto = "thin"
8686

87-
# Config for 'cargo dist'
87+
# Config for 'dist'
8888
[workspace.metadata.dist]
89-
# The preferred cargo-dist version to use in CI (Cargo.toml SemVer syntax)
90-
cargo-dist-version = "0.16.0-prerelease.6"
89+
# The preferred dist version to use in CI (Cargo.toml SemVer syntax)
90+
cargo-dist-version = "0.26.0-prerelease.3"
9191
# CI backends to support
9292
ci = "github"
9393
# The installers to generate for each app
@@ -106,14 +106,16 @@ unix-archive = ".tar.gz"
106106
npm-scope = "@axodotdev"
107107
# Features to pass to cargo build
108108
features = ["build-with-tailwind"]
109-
# Publish jobs to run in CI
109+
# Which actions to run on pull requests
110110
pr-run-mode = "plan"
111111
# Where to host releases
112112
hosting = ["axodotdev", "github"]
113113
# Whether to install an updater program
114114
install-updater = false
115115
# Whether to enable GitHub Attestations
116116
github-attestations = true
117+
# Path that installers should place binaries in
118+
install-path = "CARGO_HOME"
117119

118120
[[workspace.metadata.dist.extra-artifacts]]
119121
artifacts = ["oranda-config-schema.json"]
@@ -123,6 +125,10 @@ build = ["cargo", "run", "--", "config-schema", "--output=oranda-config-schema.j
123125
artifacts = ["oranda-css/dist/oranda.css"]
124126
build = ["cargo", "run", "--", "generate-css"]
125127

126-
[workspace.metadata.dist.github-custom-runners]
127-
aarch64-unknown-linux-gnu = "buildjet-8vcpu-ubuntu-2204-arm"
128-
aarch64-unknown-linux-musl = "buildjet-8vcpu-ubuntu-2204-arm"
128+
[dist.github-custom-runners.aarch64-unknown-linux-gnu.container]
129+
image = "quay.io/pypa/manylinux_2_28_x86_64"
130+
host = "x86_64-unknown-linux-musl"
131+
132+
[dist.github-custom-runners.aarch64-unknown-linux-musl.container]
133+
image = "quay.io/pypa/manylinux_2_28_x86_64"
134+
host = "x86_64-unknown-linux-musl"

0 commit comments

Comments
 (0)