|
| 1 | +# Copyright Strata Contributors |
| 2 | +# SPDX-License-Identifier: Apache-2.0 OR MIT |
| 3 | +# |
| 4 | +# Downstream check: builds Strata-CLI against this PR's Strata-Python code, so |
| 5 | +# we catch breakage before it lands on main. Advisory only — visible on the PR |
| 6 | +# but does not gate merge. |
| 7 | +# |
| 8 | +# Mechanism: check out the PR's Strata-Python, clone Strata-CLI, rewrite |
| 9 | +# Strata-CLI's `require "StrataPython"` to a local path pointing at the |
| 10 | +# checked-out PR code (fork-safe: no need for the PR head SHA to exist on the |
| 11 | +# strata-org remote), then `lake update StrataPython` + build + test. CLI's |
| 12 | +# other requires (Strata, StrataDDM at rev = "main") resolve from their remotes |
| 13 | +# as usual — only the StrataPython edge is overridden. |
| 14 | +# |
| 15 | +# Trigger logic (non-draft PRs on ready_for_review/synchronize; the |
| 16 | +# `!downstream-check` comment from a collaborator) lives in the shared |
| 17 | +# downstream-gate composite action hosted in Strata. |
| 18 | + |
| 19 | +name: Downstream check |
| 20 | + |
| 21 | +on: |
| 22 | + pull_request: |
| 23 | + types: [ready_for_review, synchronize] |
| 24 | + issue_comment: |
| 25 | + types: [created] |
| 26 | + |
| 27 | +concurrency: |
| 28 | + group: downstream-${{ github.event.issue.number || github.event.pull_request.number }} |
| 29 | + cancel-in-progress: true |
| 30 | + |
| 31 | +permissions: |
| 32 | + contents: read |
| 33 | + |
| 34 | +jobs: |
| 35 | + gate: |
| 36 | + runs-on: ubuntu-latest |
| 37 | + outputs: |
| 38 | + run: ${{ steps.gate.outputs.run }} |
| 39 | + head_sha: ${{ steps.gate.outputs.head_sha }} |
| 40 | + steps: |
| 41 | + - name: Gate |
| 42 | + id: gate |
| 43 | + uses: strata-org/Strata/.github/actions/downstream-gate@main |
| 44 | + |
| 45 | + downstream: |
| 46 | + needs: gate |
| 47 | + if: needs.gate.outputs.run == 'true' |
| 48 | + runs-on: ubuntu-latest |
| 49 | + name: Strata-CLI |
| 50 | + steps: |
| 51 | + - name: Check out PR's Strata-Python |
| 52 | + uses: actions/checkout@v6 |
| 53 | + with: |
| 54 | + ref: ${{ needs.gate.outputs.head_sha }} |
| 55 | + path: upstream |
| 56 | + |
| 57 | + - name: Clone Strata-CLI |
| 58 | + run: git clone --depth 1 https://github.com/strata-org/Strata-CLI.git downstream |
| 59 | + |
| 60 | + - name: Override StrataPython require -> local PR checkout |
| 61 | + uses: strata-org/Strata/.github/actions/rewrite-require@main |
| 62 | + with: |
| 63 | + lakefile: downstream/lakefile.toml |
| 64 | + package: StrataPython |
| 65 | + path: ../upstream |
| 66 | + |
| 67 | + # Strata-CLI links the full toolchain (cvc5 + z3), same as its own CI. |
| 68 | + - name: Install cvc5 |
| 69 | + uses: strata-org/Strata/.github/actions/install-cvc5@main |
| 70 | + - name: Install z3 |
| 71 | + uses: strata-org/Strata/.github/actions/install-z3@main |
| 72 | + |
| 73 | + - name: Restore lake cache |
| 74 | + uses: actions/cache/restore@v5 |
| 75 | + with: |
| 76 | + path: | |
| 77 | + downstream/.lake |
| 78 | + key: downstream-Strata-CLI-${{ runner.os }}-${{ needs.gate.outputs.head_sha }} |
| 79 | + restore-keys: | |
| 80 | + downstream-Strata-CLI-${{ runner.os }}- |
| 81 | +
|
| 82 | + - name: lake update StrataPython |
| 83 | + working-directory: downstream |
| 84 | + run: lake update StrataPython |
| 85 | + |
| 86 | + # Strata-CLI has no lake testDriver; its own CI builds, then exercises the |
| 87 | + # binary + examples. Mirror that so a green check means the same thing. |
| 88 | + - name: Build Strata-CLI |
| 89 | + uses: leanprover/lean-action@v1 |
| 90 | + with: |
| 91 | + lake-package-directory: downstream |
| 92 | + use-github-cache: false |
| 93 | + test: false |
| 94 | + - name: Run `strata` CLI |
| 95 | + working-directory: downstream |
| 96 | + run: lake exe strata --help |
| 97 | + - name: Validate examples against expected output |
| 98 | + working-directory: downstream |
| 99 | + run: ./scripts/run_examples.sh |
| 100 | + |
| 101 | + - name: Save lake cache |
| 102 | + if: always() |
| 103 | + uses: actions/cache/save@v5 |
| 104 | + with: |
| 105 | + path: | |
| 106 | + downstream/.lake |
| 107 | + key: downstream-Strata-CLI-${{ runner.os }}-${{ needs.gate.outputs.head_sha }} |
0 commit comments