Refactor setup UX and async execution observer plumbing

This commit is contained in:
2026-03-25 08:14:24 -04:00
parent 7334eb33d8
commit d5df90db0f
13 changed files with 490 additions and 132 deletions

332
.github/workflows/nightly.yml vendored Normal file
View File

@@ -0,0 +1,332 @@
name: Nightly
on:
push:
branches:
- main
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
IMAGE_NAME: ghcr.io/brooklynloveszelda/alchemist
permissions:
contents: write
packages: write
jobs:
build-frontend:
runs-on: ubuntu-latest
timeout-minutes: 20
defaults:
run:
working-directory: web
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Install Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Restore Bun modules cache
uses: actions/cache@v4
with:
path: web/node_modules
key: bun-nightly-${{ hashFiles('web/bun.lock') }}
restore-keys: |
bun-nightly-
- name: Install frontend dependencies
run: bun install --frozen-lockfile
- name: Typecheck frontend
run: bun run typecheck
- name: Astro diagnostics
run: bun run check
- name: Build frontend
run: bun run build
- name: Upload frontend artifact
uses: actions/upload-artifact@v4
with:
name: web-dist
path: web/dist
retention-days: 1
build-linux:
needs: [build-frontend]
runs-on: ubuntu-latest
timeout-minutes: 45
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-gnu
artifact_name: alchemist-linux-x86_64
- target: aarch64-unknown-linux-gnu
artifact_name: alchemist-linux-aarch64
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Download frontend artifact
uses: actions/download-artifact@v4
with:
name: web-dist
path: web/dist
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Restore Rust cache
uses: Swatinem/rust-cache@v2
with:
key: nightly-linux-${{ matrix.target }}
- name: Install aarch64 cross-compilation dependencies
if: matrix.target == 'aarch64-unknown-linux-gnu'
shell: bash
run: |
set -euo pipefail
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu
echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc" >> "$GITHUB_ENV"
- name: Build release binary
run: cargo build --release --target ${{ matrix.target }}
- name: Package release artifact
shell: bash
run: |
set -euo pipefail
BINARY="target/${{ matrix.target }}/release/alchemist"
ARCHIVE="${{ matrix.artifact_name }}.tar.gz"
tar -czf "$ARCHIVE" -C "$(dirname "$BINARY")" "$(basename "$BINARY")"
sha256sum "$ARCHIVE" > "$ARCHIVE.sha256"
- name: Upload release artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact_name }}
path: |
${{ matrix.artifact_name }}.tar.gz
${{ matrix.artifact_name }}.tar.gz.sha256
build-windows:
needs: [build-frontend]
runs-on: windows-latest
timeout-minutes: 45
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Download frontend artifact
uses: actions/download-artifact@v4
with:
name: web-dist
path: web/dist
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: x86_64-pc-windows-msvc
- name: Restore Rust cache
uses: Swatinem/rust-cache@v2
with:
key: nightly-windows-x86_64
- name: Build release binary
run: cargo build --release --target x86_64-pc-windows-msvc
- name: Package release artifact
shell: bash
run: |
set -euo pipefail
cp "target/x86_64-pc-windows-msvc/release/alchemist.exe" "alchemist-windows-x86_64.exe"
sha256sum "alchemist-windows-x86_64.exe" > "alchemist-windows-x86_64.exe.sha256"
- name: Upload release artifact
uses: actions/upload-artifact@v4
with:
name: alchemist-windows-x86_64
path: |
alchemist-windows-x86_64.exe
alchemist-windows-x86_64.exe.sha256
build-macos:
needs: [build-frontend]
runs-on: macos-latest
timeout-minutes: 45
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-apple-darwin
artifact_name: alchemist-macos-x86_64
- target: aarch64-apple-darwin
artifact_name: alchemist-macos-arm64
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Download frontend artifact
uses: actions/download-artifact@v4
with:
name: web-dist
path: web/dist
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Restore Rust cache
uses: Swatinem/rust-cache@v2
with:
key: nightly-macos-${{ matrix.target }}
- name: Build release binary
run: cargo build --release --target ${{ matrix.target }}
- name: Package release artifact
shell: bash
run: |
set -euo pipefail
BINARY="target/${{ matrix.target }}/release/alchemist"
ARCHIVE="${{ matrix.artifact_name }}.tar.gz"
tar -czf "$ARCHIVE" -C "$(dirname "$BINARY")" "$(basename "$BINARY")"
shasum -a 256 "$ARCHIVE" > "$ARCHIVE.sha256"
- name: Upload release artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact_name }}
path: |
${{ matrix.artifact_name }}.tar.gz
${{ matrix.artifact_name }}.tar.gz.sha256
docker-nightly:
needs: [build-frontend]
runs-on: ubuntu-latest
timeout-minutes: 90
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push nightly image
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ env.IMAGE_NAME }}:nightly
cache-from: type=gha
cache-to: type=gha,mode=max
provenance: false
publish-nightly:
needs: [build-linux, build-windows, build-macos, docker-nightly]
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download release artifacts
uses: actions/download-artifact@v4
with:
pattern: alchemist-*
merge-multiple: true
path: release-assets
- name: Compute nightly metadata
id: meta
shell: bash
run: |
set -euo pipefail
echo "short_sha=$(git rev-parse --short=7 "${GITHUB_SHA}")" >> "$GITHUB_OUTPUT"
echo "date=$(date -u +%Y-%m-%d)" >> "$GITHUB_OUTPUT"
- name: Force-update nightly tag
shell: bash
run: |
set -euo pipefail
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git tag -f nightly "${GITHUB_SHA}"
git push origin refs/tags/nightly --force
- name: Publish nightly release
uses: softprops/action-gh-release@v2
with:
tag_name: nightly
name: Nightly — ${{ steps.meta.outputs.short_sha }} (${{ steps.meta.outputs.date }})
prerelease: true
make_latest: false
overwrite_files: true
generate_release_notes: false
files: release-assets/*
body: |
## Nightly Build
Commit: `${{ github.sha }}`
Date: `${{ steps.meta.outputs.date }}`
Docker:
```bash
docker pull ${{ env.IMAGE_NAME }}:nightly
```
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Write job summary
shell: bash
run: |
set -euo pipefail
{
echo "## Nightly Published"
echo "**Tag:** nightly"
echo "**Commit:** ${{ github.sha }}"
echo "**Docker:** ${{ env.IMAGE_NAME }}:nightly"
echo
echo "### Artifacts"
for file in release-assets/*; do
echo "- $(basename "$file")"
done
} >> "$GITHUB_STEP_SUMMARY"