ci: align release channels and speed rust checks

This commit is contained in:
fawney19
2026-05-14 14:09:27 +08:00
parent 48fe52b207
commit a7e71624e3
11 changed files with 163 additions and 80 deletions

View File

@@ -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)

View File

@@ -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

View File

@@ -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

View File

@@ -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()