diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 6c5684e..5a0e68a 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -2,7 +2,8 @@ name: CI on: pull_request: - types: [opened, synchronize, reopened, labeled, unlabeled] + branches: [main] + types: [opened, synchronize, reopened] workflow_dispatch: inputs: validation_level: @@ -17,9 +18,6 @@ on: options: [none, production] default: none required: true - push: - branches: - - main env: CARGO_BUILD_JOBS: "2" @@ -46,7 +44,7 @@ jobs: GITEA_EVENT_NAME: ${{ gitea.event_name }} GITEA_EVENT_BEFORE: ${{ gitea.event.before }} GITEA_PR_BASE_SHA: ${{ gitea.event.pull_request.base.sha }} - FORCE_FULL: ${{ inputs.validation_level == 'feature' || contains(gitea.event.pull_request.labels.*.name, 'feature-ready') }} + FORCE_FULL: ${{ gitea.event_name == 'pull_request' || inputs.validation_level == 'feature' }} run: python3 scripts/ci-release-tooling-scope.py - name: Install Rust toolchain @@ -187,8 +185,7 @@ jobs: needs: rust name: Rust Feature Validation if: >- - inputs.validation_level == 'feature' || - contains(gitea.event.pull_request.labels.*.name, 'feature-ready') + gitea.event_name == 'pull_request' || inputs.validation_level == 'feature' runs-on: ubuntu-latest steps: @@ -251,8 +248,7 @@ jobs: frontend-e2e: needs: [rust, ui] if: >- - inputs.validation_level == 'feature' || - contains(gitea.event.pull_request.labels.*.name, 'feature-ready') + gitea.event_name == 'pull_request' || inputs.validation_level == 'feature' name: Frontend E2E runs-on: ubuntu-latest services: @@ -361,8 +357,7 @@ jobs: deployment: needs: [rust, ui] if: >- - inputs.validation_level == 'feature' || - contains(gitea.event.pull_request.labels.*.name, 'feature-ready') + gitea.event_name == 'pull_request' || inputs.validation_level == 'feature' name: Community Image Smoke runs-on: ubuntu-latest @@ -496,7 +491,7 @@ jobs: steps: - name: Require story gates and mode-appropriate feature gates env: - FEATURE_VALIDATION: ${{ inputs.validation_level == 'feature' || contains(gitea.event.pull_request.labels.*.name, 'feature-ready') }} + FEATURE_VALIDATION: ${{ gitea.event_name == 'pull_request' || inputs.validation_level == 'feature' }} RUST_RESULT: ${{ needs.rust.result }} UI_RESULT: ${{ needs.ui.result }} RUST_FEATURE_RESULT: ${{ needs.rust-feature.result }} diff --git a/.gitea/workflows/story-ci.yml b/.gitea/workflows/story-ci.yml new file mode 100644 index 0000000..ed40d05 --- /dev/null +++ b/.gitea/workflows/story-ci.yml @@ -0,0 +1,52 @@ +name: Story CI + +on: + pull_request: + branches: ['epic/**'] + types: [opened, synchronize, reopened] + +jobs: + linters: + name: Linters + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + with: + fetch-depth: 0 + + - name: Install Rust toolchain + run: | + set -eu + toolchain="$(sed -n 's/^channel = "\(.*\)"/\1/p' rust-toolchain.toml | head -n1)" + if [ -z "$toolchain" ]; then + echo "Unable to read Rust toolchain channel from rust-toolchain.toml" >&2 + exit 1 + fi + if ! rustup run "$toolchain" rustc --version >/dev/null 2>&1 || \ + ! rustup run "$toolchain" cargo --version >/dev/null 2>&1 || \ + ! rustup run "$toolchain" rustfmt --version >/dev/null 2>&1 || \ + ! rustup run "$toolchain" cargo-clippy --version >/dev/null 2>&1; then + rustup toolchain install "$toolchain" --profile minimal --component clippy --component rustfmt + fi + host="$(rustup run "$toolchain" rustc -vV | sed -n 's/^host: //p')" + toolchain_dir="${RUSTUP_HOME:-$HOME/.rustup}/toolchains/${toolchain}-${host}" + toolchain_bin="$toolchain_dir/bin" + if [ ! -x "$toolchain_bin/rustc" ] || [ ! -x "$toolchain_bin/cargo" ]; then + echo "Rust $toolchain was not installed at $toolchain_dir." >&2 + exit 1 + fi + printf '%s\n' "$toolchain_bin" >> "$GITHUB_PATH" + "$toolchain_bin/rustc" --version + "$toolchain_bin/cargo" --version + "$toolchain_bin/rustfmt" --version + "$toolchain_bin/cargo-clippy" --version + + - name: Check formatting + run: cargo fmt --all --check + + - name: Check Rust code health + run: scripts/check-rust-code-health.sh + + - name: Check Rust boundaries + run: scripts/check-rust-boundaries.sh