Files
BlueArchiveToolkit/.gitea/workflows/bat.yml
T
nyaKazuhaandGitHub 40bd82e227
bat-rust / Build and test Rust (push) Successful in 1m45s
fix(ci):
2026-07-21 22:05:25 +08:00

82 lines
2.4 KiB
YAML

# Gitea Actions workflow for the Rust workspace.
# This workflow is linux-runner friendly and does not touch real resource
# directories. It intentionally avoids external GitHub Actions so self-hosted
# runners do not need to clone action repositories through a network proxy.
name: bat-rust
on:
push:
branches:
- "**"
pull_request:
workflow_dispatch:
jobs:
rust:
name: Build and test Rust
runs-on: linux
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
BAT_SKIP_ENV_FILE: "1"
steps:
- name: Load Runner Environment
shell: bash
run: |
source /var/lib/act_runner/env.sh
rustc --version
cargo --version
- name: Checkout
shell: bash
run: |
set -euo pipefail
: "${GITHUB_SERVER_URL:?GITHUB_SERVER_URL is required}"
: "${GITHUB_REPOSITORY:?GITHUB_REPOSITORY is required}"
: "${GITHUB_SHA:?GITHUB_SHA is required}"
repo_url="${GITHUB_SERVER_URL%/}/${GITHUB_REPOSITORY}.git"
if [ -d .git ]; then
git remote set-url origin "${repo_url}" 2>/dev/null || git remote add origin "${repo_url}"
else
git init .
git remote add origin "${repo_url}"
fi
ref="${GITHUB_REF:-${GITHUB_SHA}}"
git fetch --no-tags --depth=1 origin "${ref}" || git fetch --no-tags --depth=1 origin "${GITHUB_SHA}"
git checkout --force --detach FETCH_HEAD
git submodule update --init --recursive
- name: Show tool versions
shell: bash
run: |
source /var/lib/act_runner/env.sh
set -euo pipefail
command -v git
rustc --version
cargo --version
rustfmt --version
cargo clippy --version
- name: Check formatting
shell: bash
run: source /var/lib/act_runner/env.sh && cargo fmt --all -- --check
- name: Check workspace
shell: bash
run: source /var/lib/act_runner/env.sh && cargo check --workspace --locked
- name: Build workspace
shell: bash
run: source /var/lib/act_runner/env.sh && cargo build --workspace --locked
- name: Run clippy
shell: bash
run: source /var/lib/act_runner/env.sh && cargo clippy --workspace --all-targets --locked -- -D warnings
- name: Run tests
shell: bash
run: source /var/lib/act_runner/env.sh && cargo test --workspace --locked