ci(deploy): use correct runner labels and build native binaries
The first run failed with `cargo: command not found` — `runs-on: fedora-43` is the generic (node) runner, not the Rust toolchain. Split the build: Rust on `runs-on: rust`, the SPA on `fedora-43` (matching the fleet's existing conventions, cf. cichlid/helexa workflows). Also drop the musl static-cross build: the entire fleet is Fedora 43, so native binaries built on the `rust` runner run on the targets without glibc skew (deployment-gitea-actions.md §6 permits building on a runner no newer than the oldest target). Removes the unverifiable musl-toolchain dependency. Pin pnpm via packageManager so corepack resolves it deterministically. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016fKZzDpvjiJ9eYbPGgJvUP
This commit is contained in:
@@ -1,12 +1,18 @@
|
|||||||
# CI-driven deploy for newsfeed (architecture deployment-gitea-actions.md).
|
# CI-driven deploy for newsfeed (architecture deployment-gitea-actions.md).
|
||||||
#
|
#
|
||||||
# The workflow is the source of infra truth — hosts/ports/paths live here, not in a
|
# The workflow is the source of infra truth — hosts/ports/paths live here, not in a
|
||||||
# manifest. Build-and-rsync model: build static musl binaries + the SPA bundle, then
|
# manifest. Build-and-rsync model: build the binaries + the SPA bundle, then rsync
|
||||||
# rsync straight to the targets as the scoped `gitea_ci` user.
|
# straight to the targets as the scoped `gitea_ci` user.
|
||||||
#
|
#
|
||||||
# api + worker -> slartibartfast.kosherinata.internal (share one SQLite file)
|
# api + worker -> slartibartfast.kosherinata.internal (share one SQLite file)
|
||||||
# web (SPA) -> oolon.kosherinata.internal (nginx serves + proxies /v1)
|
# web (SPA) -> oolon.kosherinata.internal (nginx serves + proxies /v1)
|
||||||
#
|
#
|
||||||
|
# Runners (labels match the fleet's registered runners): Rust jobs run on `rust`
|
||||||
|
# (cargo toolchain); node/deploy jobs run on `fedora-43` (node + rsync/ssh/curl).
|
||||||
|
# The whole fleet is Fedora 43, so binaries are built native — no glibc skew, no musl
|
||||||
|
# toolchain needed (deployment-gitea-actions.md §6: build on a runner no newer than the
|
||||||
|
# oldest target).
|
||||||
|
#
|
||||||
# One-time host prep (gitea_ci user, sudoers, service account, dirs, cert, vhost) is done
|
# One-time host prep (gitea_ci user, sudoers, service account, dirs, cert, vhost) is done
|
||||||
# by script/infra-setup.sh. Only secret required here: RSYNC_SSH_KEY (the runner's private
|
# by script/infra-setup.sh. Only secret required here: RSYNC_SSH_KEY (the runner's private
|
||||||
# key). newsfeed has no app secrets — SQLite has no password and tokens are hashed at rest.
|
# key). newsfeed has no app secrets — SQLite has no password and tokens are hashed at rest.
|
||||||
@@ -25,53 +31,44 @@ env:
|
|||||||
API_HOST: slartibartfast.kosherinata.internal
|
API_HOST: slartibartfast.kosherinata.internal
|
||||||
WEB_HOST: oolon.kosherinata.internal
|
WEB_HOST: oolon.kosherinata.internal
|
||||||
API_PORT: "8081"
|
API_PORT: "8081"
|
||||||
TARGET: x86_64-unknown-linux-musl
|
|
||||||
SSH_OPTS: -o StrictHostKeyChecking=accept-new
|
SSH_OPTS: -o StrictHostKeyChecking=accept-new
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build-api:
|
||||||
# Toolchain runner: rustup with the musl target + musl-gcc, node+pnpm baked into the
|
runs-on: rust
|
||||||
# image (deployment-gitea-actions.md §5). Adjust the label to a registered runner.
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
# lint/test gate: a broken commit never deploys
|
||||||
|
- run: cargo fmt --all --check
|
||||||
|
- run: cargo clippy --workspace --all-targets -- -D warnings
|
||||||
|
- run: cargo test --workspace
|
||||||
|
- name: build binaries
|
||||||
|
run: |
|
||||||
|
cargo build --release -p newsfeed-api -p newsfeed-worker
|
||||||
|
mkdir -p out
|
||||||
|
cp target/release/newsfeed-api target/release/newsfeed-worker out/
|
||||||
|
- uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: binaries
|
||||||
|
path: out/
|
||||||
|
|
||||||
|
build-web:
|
||||||
runs-on: fedora-43
|
runs-on: fedora-43
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
- name: build SPA
|
||||||
# --- lint/test gate: a broken commit never deploys ---
|
|
||||||
- name: fmt
|
|
||||||
run: cargo fmt --all --check
|
|
||||||
- name: clippy
|
|
||||||
run: cargo clippy --workspace --all-targets -- -D warnings
|
|
||||||
- name: test
|
|
||||||
run: cargo test --workspace
|
|
||||||
|
|
||||||
# --- build static binaries ---
|
|
||||||
- name: build binaries
|
|
||||||
run: |
|
|
||||||
rustup target add "$TARGET"
|
|
||||||
cargo build --release --target "$TARGET" -p newsfeed-api -p newsfeed-worker
|
|
||||||
mkdir -p dist/bin
|
|
||||||
cp "target/$TARGET/release/newsfeed-api" dist/bin/
|
|
||||||
cp "target/$TARGET/release/newsfeed-worker" dist/bin/
|
|
||||||
|
|
||||||
# --- build SPA bundle ---
|
|
||||||
- name: build web
|
|
||||||
working-directory: web
|
working-directory: web
|
||||||
run: |
|
run: |
|
||||||
corepack enable
|
corepack enable
|
||||||
pnpm install --frozen-lockfile
|
pnpm install --frozen-lockfile
|
||||||
pnpm build
|
pnpm build
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v3
|
|
||||||
with:
|
|
||||||
name: binaries
|
|
||||||
path: dist/bin/
|
|
||||||
- uses: actions/upload-artifact@v3
|
- uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: web
|
name: web
|
||||||
path: web/dist/
|
path: web/dist/
|
||||||
|
|
||||||
deploy-api:
|
deploy-api:
|
||||||
needs: build
|
needs: build-api
|
||||||
runs-on: fedora-43
|
runs-on: fedora-43
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
@@ -129,7 +126,7 @@ jobs:
|
|||||||
'journalctl -u newsfeed-api.service -u newsfeed-worker.service -n 80 --no-pager' || true
|
'journalctl -u newsfeed-api.service -u newsfeed-worker.service -n 80 --no-pager' || true
|
||||||
|
|
||||||
deploy-web:
|
deploy-web:
|
||||||
needs: build
|
needs: build-web
|
||||||
runs-on: fedora-43
|
runs-on: fedora-43
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/download-artifact@v3
|
- uses: actions/download-artifact@v3
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
"private": true,
|
"private": true,
|
||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
|
"packageManager": "pnpm@10.30.3",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
"build": "tsc --noEmit && vite build",
|
"build": "tsc --noEmit && vite build",
|
||||||
|
|||||||
Reference in New Issue
Block a user