CI: разделить проверки Story и Epic PR #145

Open
bsodfather wants to merge 2 commits from ops/hermes-bmad-ci into main
pull from: ops/hermes-bmad-ci
4 changed files with 64 additions and 18 deletions

No files matched your search

+7 -12
View File
@@ -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 }}
+52
View File
@@ -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
+4 -5
View File
@@ -156,11 +156,10 @@ class DeployPolicyTests(unittest.TestCase):
self.assertIn("default: none", block)
self.assertIn("required: true", block)
def test_push_main_source_ci_stays_enabled(self):
self.assertRegex(
workflow_text(),
r"(?m)^ push:\n branches:\n - main$",
)
def test_full_ci_targets_main_pull_requests(self):
workflow = workflow_text()
self.assertRegex(workflow, r"(?m)^ pull_request:\n branches: \[main\]$")
self.assertNotRegex(workflow, r"(?m)^ push:")
def test_deploy_requires_successful_required_checks(self):
deploy = job_block("deploy")
+1 -1
View File
@@ -112,7 +112,7 @@ class WorkflowScopeTests(unittest.TestCase):
def test_only_four_heavy_rust_steps_are_skippable(self):
workflow = WORKFLOW.read_text(encoding="utf-8")
self.assertIn("run: python3 scripts/ci-release-tooling-scope.py", workflow)
self.assertIn("FORCE_FULL: ${{ inputs.validation_level == 'feature' || contains(gitea.event.pull_request.labels.*.name, 'feature-ready') }}", workflow)
self.assertIn("FORCE_FULL: ${{ gitea.event_name == 'pull_request' || inputs.validation_level == 'feature' }}", workflow)
conditional = "if: steps.release_tooling.outputs.ci_only != 'true'"
for name in (
"Check typed runtime configuration contract",