This commit is contained in:
imengying committed 2026-08-27 21:27:40 +08:00
1 parent e153d0ad10
commit 0cdcbe40f4
58 files changed
+5295 -2138

No files matched your search

+49 -14
View File
@@ -1,9 +1,12 @@
name: Build tagged release
name: CI and tagged release
on:
push:
branches:
- main
tags:
- "v*.*.*"
pull_request:
workflow_dispatch:
inputs:
version:
@@ -16,28 +19,31 @@ permissions:
jobs:
metadata:
name: Validate tag
name: Resolve build metadata
runs-on: ubuntu-latest
timeout-minutes: 5
outputs:
version: ${{ steps.version.outputs.version }}
release: ${{ steps.version.outputs.release }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- id: version
name: Validate three-part tag
name: Resolve release version
shell: bash
env:
RAW_VERSION: ${{ github.event_name == 'workflow_dispatch' && inputs.version || github.ref_name }}
RAW_VERSION: ${{ github.event_name == 'workflow_dispatch' && inputs.version || startsWith(github.ref, 'refs/tags/') && github.ref_name || 'v0.0.0' }}
RELEASE_BUILD: ${{ github.event_name == 'workflow_dispatch' || startsWith(github.ref, 'refs/tags/') }}
run: |
if [[ ! "$RAW_VERSION" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
if [ "$RELEASE_BUILD" = "true" ] && [[ ! "$RAW_VERSION" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Tag must use the v-prefixed format v1.2.3" >&2
exit 1
fi
version="${RAW_VERSION#v}"
echo "version=$version" >> "$GITHUB_OUTPUT"
echo "release=$RELEASE_BUILD" >> "$GITHUB_OUTPUT"
quality:
name: Quality checks
@@ -56,9 +62,13 @@ jobs:
targets: wasm32-unknown-unknown
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
with:
bun-version: 1.3.14
bun-version: 1.4.0
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Typecheck frontend
run: bunx --bun tsc -b frontend
- name: Test frontend
run: bun test --cwd frontend
- name: Build frontend
run: bun run build:frontend
- name: Check Rust formatting
@@ -115,6 +125,7 @@ jobs:
agent:
name: Agent (${{ matrix.platform }})
needs: metadata
if: needs.metadata.outputs.release == 'true'
runs-on: ${{ matrix.runner }}
timeout-minutes: 45
permissions:
@@ -128,22 +139,24 @@ jobs:
fail-fast: false
matrix:
include:
- platform: Linux x86_64
- platform: Linux x64
runner: ubuntu-latest
target: x86_64-unknown-linux-musl
asset: agent-linux-x86_64
asset: agent-linux-x64
extension: ""
cross: true
static_linux: true
- platform: Linux ARM64
runner: ubuntu-latest
target: aarch64-unknown-linux-musl
asset: agent-linux-aarch64
extension: ""
cross: true
- platform: Windows x86_64
static_linux: true
- platform: Windows x64
runner: windows-latest
target: x86_64-pc-windows-msvc
asset: agent-windows-x86_64.exe
asset: agent-windows-x64.exe
extension: .exe
cross: false
- platform: macOS ARM64
@@ -152,6 +165,12 @@ jobs:
asset: agent-macos-aarch64
extension: ""
cross: false
- platform: FreeBSD x64
runner: ubuntu-latest
target: x86_64-unknown-freebsd
asset: agent-freebsd-x64
extension: ""
cross: true
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
@@ -159,7 +178,7 @@ jobs:
- uses: dtolnay/rust-toolchain@4360b52568e2003a75bf9bc1d59f33a8e3fc893c # stable
with:
targets: ${{ matrix.target }}
- name: Install Linux cross compiler
- name: Install cross compiler
if: matrix.cross
run: cargo install cross --version 0.2.5 --locked
- name: Build Rust Agent with cross
@@ -210,13 +229,28 @@ jobs:
exit 1
fi
- name: Verify static Linux binary
if: matrix.cross
if: matrix.static_linux
shell: bash
run: |
if readelf -l "release/${{ matrix.asset }}" | grep -q 'Requesting program interpreter'; then
echo "Linux Agent must be statically linked" >&2
exit 1
fi
- name: Verify FreeBSD Agent in FreeBSD
if: matrix.target == 'x86_64-unknown-freebsd'
uses: vmactions/freebsd-vm@83b151f58c6047089f4c80eb5ba2039d158ce093 # v1.5.3
with:
release: "15"
envs: NODEFLARE_VERSION
copyback: false
run: |
set -eu
version_output=$(./release/agent-freebsd-x64 --version)
actual_version=${version_output##* }
if [ "$actual_version" != "$NODEFLARE_VERSION" ]; then
echo "Agent version $actual_version does not match tag $NODEFLARE_VERSION" >&2
exit 1
fi
- uses: actions/attest@1e69f48acb82d1966a394da916b4c1698aa569d6 # v4
with:
subject-path: release/${{ matrix.asset }}
@@ -229,6 +263,7 @@ jobs:
frontend:
name: Frontend
needs: metadata
if: needs.metadata.outputs.release == 'true'
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
@@ -244,7 +279,7 @@ jobs:
persist-credentials: false
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
with:
bun-version: 1.3.14
bun-version: 1.4.0
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Build public frontend
@@ -262,7 +297,7 @@ jobs:
release:
name: Publish GitHub Release
if: github.event_name == 'push'
if: startsWith(github.ref, 'refs/tags/v')
needs: [metadata, quality, agent, frontend]
runs-on: ubuntu-latest
timeout-minutes: 10