mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-01 17:00:21 +08:00
ci: align release channels and speed rust checks
This commit is contained in:
@@ -4,6 +4,13 @@
|
||||
# 应用端口(默认 8084)
|
||||
APP_PORT=8084
|
||||
|
||||
# Docker Compose 镜像(默认正式版 latest;提前测试可改 rc/beta;也可固定具体版本)
|
||||
# 示例:
|
||||
# APP_IMAGE=ghcr.io/fawney19/aether:latest
|
||||
# APP_IMAGE=ghcr.io/fawney19/aether:rc
|
||||
# APP_IMAGE=ghcr.io/fawney19/aether:beta
|
||||
# APP_IMAGE=ghcr.io/fawney19/aether:0.7.0-rc.1
|
||||
|
||||
# API Key 前缀(默认 sk)
|
||||
API_KEY_PREFIX=sk
|
||||
|
||||
|
||||
4
.github/workflows/build-proxy.yml
vendored
4
.github/workflows/build-proxy.yml
vendored
@@ -103,9 +103,9 @@ jobs:
|
||||
shell: bash
|
||||
run: |
|
||||
if [ "${{ matrix.use_cross }}" = "true" ]; then
|
||||
cross build --release --target ${{ matrix.target }}
|
||||
cross build --release --locked --target ${{ matrix.target }}
|
||||
else
|
||||
cargo build --release --target ${{ matrix.target }}
|
||||
cargo build --release --locked --target ${{ matrix.target }}
|
||||
fi
|
||||
|
||||
- name: Package (Unix)
|
||||
|
||||
28
.github/workflows/deploy-pages.yml
vendored
28
.github/workflows/deploy-pages.yml
vendored
@@ -15,7 +15,35 @@ concurrency:
|
||||
cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
preflight:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
deploy_pages: ${{ steps.classify.outputs.deploy_pages }}
|
||||
steps:
|
||||
- name: Ensure stable Pages release tag
|
||||
id: classify
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
echo "deploy_pages=false" >> "${GITHUB_OUTPUT}"
|
||||
|
||||
if [[ "${GITHUB_REF_TYPE}" != "tag" ]]; then
|
||||
echo "Manual Pages deployment."
|
||||
echo "deploy_pages=true" >> "${GITHUB_OUTPUT}"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
tag="${GITHUB_REF_NAME}"
|
||||
if [[ ! "${tag}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
||||
echo "Skipping Pages deploy for non-stable release tag: ${tag}"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "deploy_pages=true" >> "${GITHUB_OUTPUT}"
|
||||
|
||||
build:
|
||||
needs: preflight
|
||||
if: needs.preflight.outputs.deploy_pages == 'true'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
|
||||
91
.github/workflows/release.yml
vendored
91
.github/workflows/release.yml
vendored
@@ -19,8 +19,55 @@ env:
|
||||
DOCKERHUB_IMAGE: fawney19/aether
|
||||
|
||||
jobs:
|
||||
preflight:
|
||||
name: Release preflight
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
publish: ${{ steps.classify.outputs.publish }}
|
||||
version_tag: ${{ steps.classify.outputs.version_tag }}
|
||||
prerelease: ${{ steps.classify.outputs.prerelease }}
|
||||
make_latest: ${{ steps.classify.outputs.make_latest }}
|
||||
steps:
|
||||
- name: Classify release tag
|
||||
id: classify
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
|
||||
echo "publish=false" >> "${GITHUB_OUTPUT}"
|
||||
echo "version_tag=" >> "${GITHUB_OUTPUT}"
|
||||
echo "prerelease=false" >> "${GITHUB_OUTPUT}"
|
||||
echo "make_latest=false" >> "${GITHUB_OUTPUT}"
|
||||
|
||||
if [[ "${GITHUB_REF_TYPE}" != "tag" ]]; then
|
||||
echo "Manual release build; publish jobs will be skipped."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
tag="${GITHUB_REF_NAME}"
|
||||
if [[ ! "${tag}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-(beta|rc)\.[0-9]+)?$ ]]; then
|
||||
echo "Unsupported release tag: ${tag}" >&2
|
||||
echo "Expected vX.Y.Z, vX.Y.Z-beta.N, or vX.Y.Z-rc.N." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "version_tag=${tag}" >> "${GITHUB_OUTPUT}"
|
||||
|
||||
if [[ "${tag}" == *-* ]]; then
|
||||
echo "prerelease=true" >> "${GITHUB_OUTPUT}"
|
||||
else
|
||||
echo "make_latest=true" >> "${GITHUB_OUTPUT}"
|
||||
fi
|
||||
|
||||
if [[ "${GITHUB_EVENT_NAME}" == "push" ]]; then
|
||||
echo "publish=true" >> "${GITHUB_OUTPUT}"
|
||||
else
|
||||
echo "Manual release build for ${tag}; publish jobs will be skipped."
|
||||
fi
|
||||
|
||||
frontend:
|
||||
name: Build frontend
|
||||
needs: preflight
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
@@ -48,6 +95,7 @@ jobs:
|
||||
|
||||
build:
|
||||
name: Build ${{ matrix.name }}
|
||||
needs: preflight
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: true
|
||||
@@ -97,7 +145,7 @@ jobs:
|
||||
|
||||
- name: Build
|
||||
env:
|
||||
AETHER_VERSION: ${{ startsWith(github.ref, 'refs/tags/v') && github.ref_name || '' }}
|
||||
AETHER_VERSION: ${{ needs.preflight.outputs.version_tag }}
|
||||
CARGO_TERM_COLOR: always
|
||||
shell: bash
|
||||
run: |
|
||||
@@ -117,7 +165,8 @@ jobs:
|
||||
|
||||
docker:
|
||||
name: Docker multi-arch
|
||||
needs: [frontend, build]
|
||||
needs: [preflight, frontend, build]
|
||||
if: needs.preflight.outputs.publish == 'true'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
@@ -163,12 +212,13 @@ jobs:
|
||||
docker.io/${{ env.DOCKERHUB_IMAGE }}
|
||||
tags: |
|
||||
type=semver,pattern={{version}}
|
||||
type=semver,pattern={{major}}.{{minor}}
|
||||
type=raw,value=pre,enable=${{ contains(github.ref, '-') }}
|
||||
type=raw,value=fix,enable=${{ contains(github.ref, '-fix') }}
|
||||
type=semver,pattern={{major}}.{{minor}},enable=${{ needs.preflight.outputs.make_latest == 'true' }}
|
||||
type=raw,value=latest,enable=${{ needs.preflight.outputs.make_latest == 'true' }}
|
||||
type=raw,value=beta,enable=${{ contains(github.ref_name, '-beta.') }}
|
||||
type=raw,value=rc,enable=${{ contains(github.ref_name, '-rc.') }}
|
||||
type=sha,prefix=
|
||||
flavor: |
|
||||
latest=auto
|
||||
latest=false
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v6
|
||||
@@ -182,7 +232,7 @@ jobs:
|
||||
|
||||
package:
|
||||
name: Release tarballs
|
||||
needs: [frontend, build]
|
||||
needs: [preflight, frontend, build]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
@@ -238,29 +288,10 @@ jobs:
|
||||
|
||||
github-release:
|
||||
name: GitHub Release assets
|
||||
needs: [docker, package]
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
needs: [preflight, docker, package]
|
||||
if: needs.preflight.outputs.publish == 'true'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Classify release tag
|
||||
id: release_tag
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
tag="${GITHUB_REF_NAME}"
|
||||
if [[ ! "${tag}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z][0-9A-Za-z.-]*)?$ ]]; then
|
||||
echo "Unsupported release tag: ${tag}" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ "${tag}" == *-* ]]; then
|
||||
echo "prerelease=true" >> "${GITHUB_OUTPUT}"
|
||||
echo "make_latest=false" >> "${GITHUB_OUTPUT}"
|
||||
else
|
||||
echo "prerelease=false" >> "${GITHUB_OUTPUT}"
|
||||
echo "make_latest=true" >> "${GITHUB_OUTPUT}"
|
||||
fi
|
||||
|
||||
- name: Download release package artifact
|
||||
uses: actions/download-artifact@v5
|
||||
with:
|
||||
@@ -292,8 +323,8 @@ jobs:
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
generate_release_notes: true
|
||||
prerelease: ${{ steps.release_tag.outputs.prerelease }}
|
||||
make_latest: ${{ steps.release_tag.outputs.make_latest }}
|
||||
prerelease: ${{ needs.preflight.outputs.prerelease }}
|
||||
make_latest: ${{ needs.preflight.outputs.make_latest }}
|
||||
files: |
|
||||
release-assets/*.tar.gz
|
||||
release-assets/SHA256SUMS
|
||||
|
||||
47
.github/workflows/rust-ci.yml
vendored
47
.github/workflows/rust-ci.yml
vendored
@@ -36,12 +36,8 @@ jobs:
|
||||
|
||||
- name: Install Rust toolchain
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
|
||||
- name: Show Rust toolchain
|
||||
run: rustup show active-toolchain
|
||||
|
||||
- name: Install rustfmt component
|
||||
run: rustup component add rustfmt
|
||||
with:
|
||||
components: rustfmt
|
||||
|
||||
- name: Format
|
||||
run: cargo fmt --all --check
|
||||
@@ -54,12 +50,8 @@ jobs:
|
||||
|
||||
- name: Install Rust toolchain
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
|
||||
- name: Show Rust toolchain
|
||||
run: rustup show active-toolchain
|
||||
|
||||
- name: Install clippy component
|
||||
run: rustup component add clippy
|
||||
with:
|
||||
components: clippy
|
||||
|
||||
- name: Rust cache
|
||||
uses: Swatinem/rust-cache@v2
|
||||
@@ -91,12 +83,8 @@ jobs:
|
||||
|
||||
- name: Install Rust toolchain
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
|
||||
- name: Show Rust toolchain
|
||||
run: rustup show active-toolchain
|
||||
|
||||
- name: Install clippy component
|
||||
run: rustup component add clippy
|
||||
with:
|
||||
components: clippy
|
||||
|
||||
- name: Rust cache
|
||||
uses: Swatinem/rust-cache@v2
|
||||
@@ -128,12 +116,8 @@ jobs:
|
||||
|
||||
- name: Install Rust toolchain
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
|
||||
- name: Show Rust toolchain
|
||||
run: rustup show active-toolchain
|
||||
|
||||
- name: Install clippy component
|
||||
run: rustup component add clippy
|
||||
with:
|
||||
components: clippy
|
||||
|
||||
- name: Rust cache
|
||||
uses: Swatinem/rust-cache@v2
|
||||
@@ -196,11 +180,14 @@ jobs:
|
||||
- name: Setup sccache
|
||||
uses: mozilla-actions/sccache-action@v0.0.9
|
||||
|
||||
- name: Install nextest
|
||||
uses: taiki-e/install-action@nextest
|
||||
|
||||
- name: Test
|
||||
env:
|
||||
RUSTC_WRAPPER: sccache
|
||||
SCCACHE_GHA_ENABLED: "true"
|
||||
run: cargo test -p aether-gateway
|
||||
run: cargo nextest run -p aether-gateway
|
||||
|
||||
- name: Show sccache stats
|
||||
if: always()
|
||||
@@ -230,11 +217,14 @@ jobs:
|
||||
- name: Setup sccache
|
||||
uses: mozilla-actions/sccache-action@v0.0.9
|
||||
|
||||
- name: Install nextest
|
||||
uses: taiki-e/install-action@nextest
|
||||
|
||||
- name: Test
|
||||
env:
|
||||
RUSTC_WRAPPER: sccache
|
||||
SCCACHE_GHA_ENABLED: "true"
|
||||
run: cargo test -p aether-data
|
||||
run: cargo nextest run -p aether-data
|
||||
|
||||
- name: Show sccache stats
|
||||
if: always()
|
||||
@@ -264,11 +254,14 @@ jobs:
|
||||
- name: Setup sccache
|
||||
uses: mozilla-actions/sccache-action@v0.0.9
|
||||
|
||||
- name: Install nextest
|
||||
uses: taiki-e/install-action@nextest
|
||||
|
||||
- name: Test
|
||||
env:
|
||||
RUSTC_WRAPPER: sccache
|
||||
SCCACHE_GHA_ENABLED: "true"
|
||||
run: cargo test --workspace --exclude aether-gateway --exclude aether-data
|
||||
run: cargo nextest run --workspace --exclude aether-gateway --exclude aether-data
|
||||
|
||||
- name: Show sccache stats
|
||||
if: always()
|
||||
|
||||
@@ -104,7 +104,7 @@ cp -a data/aether.db backup_$(date +%Y%m%d_%H%M%S).db
|
||||
curl -fsSL https://raw.githubusercontent.com/fawney19/Aether/aether-rust-pioneer/install.sh | sudo bash
|
||||
```
|
||||
|
||||
运行后按提示输入语言、版本和部署方式。固定安装某个 tag 时,版本选择选 `2`,再输入类似 `v0.7.0-rc23` 的 tag。默认会安装最新预发布版本;Docker Compose 模式默认使用 `pre` 镜像通道。
|
||||
运行后按提示输入语言、版本和部署方式。默认会安装最新正式版。需要提前测试时可用 `AETHER_CHANNEL=rc` 或 `AETHER_CHANNEL=beta`;Docker Compose 模式默认使用 `latest` 镜像通道。固定安装某个 tag 时,版本选择选 `4`,再输入类似 `v0.7.0-rc.1` 的 tag。
|
||||
二进制安装在下载 Release 压缩包前会询问是否使用下载加速源;选择使用时会先打印原始 GitHub URL,再要求输入新的压缩包下载 URL。非交互式安装可用 `AETHER_RELEASE_ARCHIVE_URL` 指定压缩包 URL。
|
||||
如果安装目录里已经有配置,脚本会优先复用:Docker Compose 保留已有 `.env`,二进制服务模式保留已有 `/etc/aether/aether-gateway.env`。只有首次生成新配置时才会提示输入管理员密码。
|
||||
|
||||
@@ -116,8 +116,10 @@ curl -fsSL https://raw.githubusercontent.com/fawney19/Aether/aether-rust-pioneer
|
||||
请输入选项 / Enter choice [1]:
|
||||
|
||||
请选择 Aether 版本:
|
||||
1) 最新预发布版本
|
||||
2) 指定 tag,例如 v0.7.0-rc23
|
||||
1) 最新正式版
|
||||
2) 最新 RC 预发布版
|
||||
3) 最新 Beta 预发布版
|
||||
4) 指定 tag,例如 v0.7.0-rc.1
|
||||
|
||||
请输入选项 [1]:
|
||||
|
||||
|
||||
@@ -335,6 +335,7 @@ fn configure_tcp_socket(stream: &TcpStream, state: &Arc<AppState>) {
|
||||
|
||||
/// Build rustls ClientConfig with system root certificates.
|
||||
pub fn build_tls_config() -> rustls::ClientConfig {
|
||||
let _ = rustls::crypto::ring::default_provider().install_default();
|
||||
let root_store =
|
||||
rustls::RootCertStore::from_iter(webpki_roots::TLS_SERVER_ROOTS.iter().cloned());
|
||||
rustls::ClientConfig::builder()
|
||||
|
||||
@@ -503,6 +503,7 @@ pub fn resolve_request_timing<B>(
|
||||
}
|
||||
|
||||
fn build_tls_config(http1_only: bool) -> Arc<ClientConfig> {
|
||||
let _ = rustls::crypto::ring::default_provider().install_default();
|
||||
let root_store =
|
||||
rustls::RootCertStore::from_iter(webpki_roots::TLS_SERVER_ROOTS.iter().cloned());
|
||||
let mut config = ClientConfig::builder()
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
services:
|
||||
app:
|
||||
image: ${APP_IMAGE:-ghcr.io/fawney19/aether:pre}
|
||||
image: ${APP_IMAGE:-ghcr.io/fawney19/aether:latest}
|
||||
container_name: aether-app
|
||||
env_file:
|
||||
- .env
|
||||
|
||||
@@ -58,7 +58,7 @@ services:
|
||||
restart: unless-stopped
|
||||
|
||||
app:
|
||||
image: ${APP_IMAGE:-ghcr.io/fawney19/aether:pre}
|
||||
image: ${APP_IMAGE:-ghcr.io/fawney19/aether:latest}
|
||||
container_name: aether-app
|
||||
env_file:
|
||||
- .env
|
||||
|
||||
52
install.sh
52
install.sh
@@ -4,7 +4,7 @@ set -euo pipefail
|
||||
REPO="${AETHER_REPO:-fawney19/Aether}"
|
||||
SOURCE_REF="${AETHER_SOURCE_REF:-aether-rust-pioneer}"
|
||||
VERSION="${AETHER_VERSION:-}"
|
||||
CHANNEL="${AETHER_CHANNEL:-pre}"
|
||||
CHANNEL="${AETHER_CHANNEL:-stable}"
|
||||
CHANNEL_EXPLICIT="false"
|
||||
if [[ -n "${AETHER_CHANNEL:-}" ]]; then
|
||||
CHANNEL_EXPLICIT="true"
|
||||
@@ -55,10 +55,11 @@ Options:
|
||||
single: system service with SQLite + in-process runtime
|
||||
cluster: system service connected to shared database + Redis
|
||||
Linux services use systemd; macOS services use launchd
|
||||
--channel CHANNEL Release channel to resolve when --version is omitted: pre or rc
|
||||
pre resolves the latest semver prerelease tag (default)
|
||||
rc restricts resolution to tags like v0.7.0-rc23
|
||||
--version VERSION Exact release tag to install, for example v0.7.0-rc23
|
||||
--channel CHANNEL Release channel to resolve when --version is omitted: stable, latest, rc, or beta
|
||||
stable/latest resolves the latest stable tag (default)
|
||||
rc resolves the latest tag like v0.7.0-rc.1
|
||||
beta resolves the latest tag like v0.7.0-beta.1
|
||||
--version VERSION Exact release tag to install, for example v0.7.0-rc.1
|
||||
--repo OWNER/REPO GitHub repository to download from (default: fawney19/Aether)
|
||||
--source-ref REF Source branch/tag used for compose templates (default: aether-rust-pioneer)
|
||||
--archive PATH Install from a local release tarball instead of downloading
|
||||
@@ -368,8 +369,10 @@ select_version() {
|
||||
cat >/dev/tty <<'EOF'
|
||||
|
||||
请选择 Aether 版本:
|
||||
1) 最新预发布版本
|
||||
2) 指定 tag,例如 v0.7.0-rc23
|
||||
1) 最新正式版
|
||||
2) 最新 RC 预发布版
|
||||
3) 最新 Beta 预发布版
|
||||
4) 指定 tag,例如 v0.7.0-rc.1
|
||||
|
||||
请输入选项 [1]:
|
||||
EOF
|
||||
@@ -377,8 +380,10 @@ EOF
|
||||
cat >/dev/tty <<'EOF'
|
||||
|
||||
Choose Aether version:
|
||||
1) Latest pre release
|
||||
2) Exact tag, for example v0.7.0-rc23
|
||||
1) Latest stable release
|
||||
2) Latest RC prerelease
|
||||
3) Latest beta prerelease
|
||||
4) Exact tag, for example v0.7.0-rc.1
|
||||
|
||||
Enter choice [1]:
|
||||
EOF
|
||||
@@ -387,9 +392,15 @@ EOF
|
||||
IFS= read -r choice </dev/tty || choice=""
|
||||
case "${choice:-1}" in
|
||||
1)
|
||||
CHANNEL="pre"
|
||||
CHANNEL="stable"
|
||||
;;
|
||||
2)
|
||||
CHANNEL="rc"
|
||||
;;
|
||||
3)
|
||||
CHANNEL="beta"
|
||||
;;
|
||||
4)
|
||||
if ui_is_zh; then
|
||||
cat >/dev/tty <<'EOF'
|
||||
请输入准确 tag:
|
||||
@@ -713,20 +724,26 @@ resolve_version() {
|
||||
|
||||
local tag=""
|
||||
case "${CHANNEL}" in
|
||||
pre)
|
||||
stable|latest)
|
||||
tag="$(download_stdout "https://api.github.com/repos/${REPO}/releases?per_page=50" |
|
||||
sed -n 's/.*"tag_name"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' |
|
||||
grep -E '^v[0-9]+(\.[0-9]+)*-[0-9A-Za-z][0-9A-Za-z.-]*$' |
|
||||
grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' |
|
||||
head -n1 || true)"
|
||||
;;
|
||||
rc)
|
||||
tag="$(download_stdout "https://api.github.com/repos/${REPO}/releases?per_page=50" |
|
||||
sed -n 's/.*"tag_name"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' |
|
||||
grep -E '^v[0-9]+(\.[0-9]+)*-rc[0-9]+$' |
|
||||
grep -E '^v[0-9]+\.[0-9]+\.[0-9]+-rc\.[0-9]+$' |
|
||||
head -n1 || true)"
|
||||
;;
|
||||
beta)
|
||||
tag="$(download_stdout "https://api.github.com/repos/${REPO}/releases?per_page=50" |
|
||||
sed -n 's/.*"tag_name"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' |
|
||||
grep -E '^v[0-9]+\.[0-9]+\.[0-9]+-beta\.[0-9]+$' |
|
||||
head -n1 || true)"
|
||||
;;
|
||||
*)
|
||||
die "unsupported release channel: ${CHANNEL}; expected pre or rc"
|
||||
die "unsupported release channel: ${CHANNEL}; expected stable, latest, rc, or beta"
|
||||
;;
|
||||
esac
|
||||
echo "${tag}"
|
||||
@@ -999,11 +1016,14 @@ compose_image() {
|
||||
tag="${VERSION#v}"
|
||||
else
|
||||
case "${CHANNEL}" in
|
||||
pre|rc)
|
||||
stable|latest)
|
||||
tag="latest"
|
||||
;;
|
||||
rc|beta)
|
||||
tag="${CHANNEL}"
|
||||
;;
|
||||
*)
|
||||
tag="${CHANNEL}"
|
||||
die "unsupported release channel: ${CHANNEL}; expected stable, latest, rc, or beta"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user