|
| 1 | +name: Reference assurance flow |
| 2 | +on: |
| 3 | + workflow_call: |
| 4 | + inputs: |
| 5 | + base-sha: {required: true, type: string} |
| 6 | + target-sha: {required: true, type: string} |
| 7 | + review-run-id: {required: true, type: string} |
| 8 | +permissions: |
| 9 | + contents: read |
| 10 | + actions: read |
| 11 | +jobs: |
| 12 | + classify: |
| 13 | + runs-on: ubuntu-latest |
| 14 | + steps: |
| 15 | + - uses: actions/checkout@v4 |
| 16 | + with: {ref: "${{ inputs.target-sha }}", fetch-depth: 0} |
| 17 | + - uses: actions/setup-python@v5 |
| 18 | + with: {python-version: "3.12"} |
| 19 | + - id: process |
| 20 | + shell: bash |
| 21 | + run: | |
| 22 | + revision="$(python -c 'import json; print(json.load(open(".engineering/process.lock"))["revision"])')" |
| 23 | + [[ "$revision" =~ ^[0-9a-f]{40}$ ]] || exit 2 |
| 24 | + echo "revision=$revision" >> "$GITHUB_OUTPUT" |
| 25 | + - run: pip install 'git+https://github.com/suyog19/software-engineering-process@${{ steps.process.outputs.revision }}' |
| 26 | + - run: engineering-process validate --runtime-revision '${{ steps.process.outputs.revision }}' |
| 27 | + - run: engineering-process evaluate --base '${{ inputs.base-sha }}' --head '${{ inputs.target-sha }}' --output "$RUNNER_TEMP/obligations.json" |
| 28 | + - run: engineering-process attest --predicate classification/v1 --sha '${{ inputs.target-sha }}' --capability orchestrator --verdict pass --identity github-actions --context-id '${{ github.run_id }}:classify' --output "$RUNNER_TEMP/classification.json" |
| 29 | + - uses: actions/upload-artifact@v4 |
| 30 | + with: |
| 31 | + name: process-classification-${{ inputs.target-sha }} |
| 32 | + path: | |
| 33 | + ${{ runner.temp }}/obligations.json |
| 34 | + ${{ runner.temp }}/classification.json |
| 35 | + retention-days: 7 |
| 36 | + objective-validation: |
| 37 | + needs: classify |
| 38 | + runs-on: ubuntu-latest |
| 39 | + steps: |
| 40 | + - uses: actions/checkout@v4 |
| 41 | + with: {ref: "${{ inputs.target-sha }}", fetch-depth: 0} |
| 42 | + - uses: actions/setup-python@v5 |
| 43 | + with: {python-version: "3.12"} |
| 44 | + - id: process |
| 45 | + shell: bash |
| 46 | + run: | |
| 47 | + revision="$(python -c 'import json; print(json.load(open(".engineering/process.lock"))["revision"])')" |
| 48 | + [[ "$revision" =~ ^[0-9a-f]{40}$ ]] || exit 2 |
| 49 | + echo "revision=$revision" >> "$GITHUB_OUTPUT" |
| 50 | + - run: pip install 'git+https://github.com/suyog19/software-engineering-process@${{ steps.process.outputs.revision }}' |
| 51 | + - uses: actions/download-artifact@v4 |
| 52 | + with: {name: "process-classification-${{ inputs.target-sha }}", path: "${{ runner.temp }}/classification"} |
| 53 | + - run: engineering-process run-validation --sha '${{ inputs.target-sha }}' --obligations '${{ runner.temp }}/classification/obligations.json' --output-dir '${{ runner.temp }}/objective' |
| 54 | + - uses: actions/upload-artifact@v4 |
| 55 | + if: always() |
| 56 | + with: |
| 57 | + name: process-objective-${{ inputs.target-sha }} |
| 58 | + path: ${{ runner.temp }}/objective |
| 59 | + retention-days: 7 |
| 60 | + readiness: |
| 61 | + needs: [classify, objective-validation] |
| 62 | + runs-on: ubuntu-latest |
| 63 | + steps: |
| 64 | + - uses: actions/checkout@v4 |
| 65 | + with: {ref: "${{ inputs.target-sha }}", fetch-depth: 0} |
| 66 | + - uses: actions/setup-python@v5 |
| 67 | + with: {python-version: "3.12"} |
| 68 | + - id: process |
| 69 | + shell: bash |
| 70 | + run: | |
| 71 | + revision="$(python -c 'import json; print(json.load(open(".engineering/process.lock"))["revision"])')" |
| 72 | + [[ "$revision" =~ ^[0-9a-f]{40}$ ]] || exit 2 |
| 73 | + echo "revision=$revision" >> "$GITHUB_OUTPUT" |
| 74 | + - run: pip install 'git+https://github.com/suyog19/software-engineering-process@${{ steps.process.outputs.revision }}' |
| 75 | + - uses: actions/download-artifact@v4 |
| 76 | + with: {name: "process-classification-${{ inputs.target-sha }}", path: "${{ runner.temp }}/classification"} |
| 77 | + - uses: actions/download-artifact@v4 |
| 78 | + with: {name: "process-objective-${{ inputs.target-sha }}", path: "${{ runner.temp }}/objective"} |
| 79 | + - uses: actions/download-artifact@v4 |
| 80 | + with: |
| 81 | + name: "process-independent-review-${{ inputs.target-sha }}" |
| 82 | + run-id: ${{ inputs.review-run-id }} |
| 83 | + github-token: ${{ github.token }} |
| 84 | + path: ${{ runner.temp }}/review |
| 85 | + - name: Assemble exact-SHA evidence and verified provenance |
| 86 | + shell: bash |
| 87 | + run: | |
| 88 | + mkdir -p "$RUNNER_TEMP/evidence" |
| 89 | + cp "$RUNNER_TEMP/classification/classification.json" "$RUNNER_TEMP/evidence/" |
| 90 | + cp "$RUNNER_TEMP/objective/test-result.json" "$RUNNER_TEMP/evidence/" |
| 91 | + cp "$RUNNER_TEMP/review/independent-review.json" "$RUNNER_TEMP/evidence/" |
| 92 | + python - <<'PY' |
| 93 | + import json, os |
| 94 | + root=os.environ['RUNNER_TEMP']; merged={"evidence":{}} |
| 95 | + for path in (f"{root}/objective/trust-index.json", f"{root}/review/trust-index.json"): |
| 96 | + merged["evidence"].update(json.load(open(path))["evidence"]) |
| 97 | + json.dump(merged, open(f"{root}/trust-index.json", "w")) |
| 98 | + PY |
| 99 | + - run: engineering-process readiness --sha '${{ inputs.target-sha }}' --obligations '${{ runner.temp }}/classification/obligations.json' --evidence-dir '${{ runner.temp }}/evidence' --trust-index '${{ runner.temp }}/trust-index.json' --artifact-dir '${{ runner.temp }}/objective' |
0 commit comments