|
| 1 | +name: Runtime Harness Package Rehearsal |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + version: |
| 7 | + description: 'Package version (for example: 0.1.0 or 0.1.0-rc.1)' |
| 8 | + required: true |
| 9 | + type: string |
| 10 | + channel: |
| 11 | + description: 'Release channel' |
| 12 | + required: false |
| 13 | + default: stable |
| 14 | + type: choice |
| 15 | + options: |
| 16 | + - stable |
| 17 | + - rc |
| 18 | + publish: |
| 19 | + description: 'Publish the candidate to GitHub Packages before verification' |
| 20 | + required: false |
| 21 | + default: false |
| 22 | + type: boolean |
| 23 | + |
| 24 | +permissions: |
| 25 | + actions: read |
| 26 | + contents: read |
| 27 | + packages: write |
| 28 | + |
| 29 | +jobs: |
| 30 | + rehearse-runtime-harness: |
| 31 | + runs-on: ubuntu-latest |
| 32 | + steps: |
| 33 | + - name: Checkout |
| 34 | + uses: actions/checkout@v5 |
| 35 | + |
| 36 | + - name: Assert promotion contract alignment |
| 37 | + shell: pwsh |
| 38 | + run: | |
| 39 | + pwsh -NoLogo -NoProfile -File tools/Assert-PromotionContractAlignment.ps1 -OutputJsonPath tests/results/promotion-contract/runtime-harness-package-alignment.json -StepSummaryPath $env:GITHUB_STEP_SUMMARY |
| 40 | +
|
| 41 | + - name: Setup Node |
| 42 | + uses: actions/setup-node@v5 |
| 43 | + with: |
| 44 | + node-version: '20' |
| 45 | + cache: npm |
| 46 | + registry-url: https://npm.pkg.github.com |
| 47 | + scope: '@labview-community-ci-cd' |
| 48 | + |
| 49 | + - name: Install repository dependencies |
| 50 | + run: npm ci --ignore-scripts |
| 51 | + |
| 52 | + - name: Resolve runtime-harness publish context |
| 53 | + id: context |
| 54 | + shell: bash |
| 55 | + run: | |
| 56 | + set -euo pipefail |
| 57 | + node tools/priority/js-package-release.mjs \ |
| 58 | + --action resolve \ |
| 59 | + --package-dir packages/runtime-harness \ |
| 60 | + --version "${{ inputs.version }}" \ |
| 61 | + --channel "${{ inputs.channel }}" \ |
| 62 | + --publish "${{ inputs.publish }}" \ |
| 63 | + --repo "${{ github.repository }}" \ |
| 64 | + --owner "${{ github.repository_owner }}" \ |
| 65 | + --server-url "${{ github.server_url }}" \ |
| 66 | + --report tests/results/_agent/release/runtime-harness-package-context.json \ |
| 67 | + --github-output "$GITHUB_OUTPUT" |
| 68 | +
|
| 69 | + - name: Stage runtime-harness package candidate |
| 70 | + id: stage |
| 71 | + shell: bash |
| 72 | + run: | |
| 73 | + set -euo pipefail |
| 74 | + node tools/priority/js-package-release.mjs \ |
| 75 | + --action stage \ |
| 76 | + --package-dir packages/runtime-harness \ |
| 77 | + --version "${{ inputs.version }}" \ |
| 78 | + --channel "${{ inputs.channel }}" \ |
| 79 | + --publish "${{ inputs.publish }}" \ |
| 80 | + --repo "${{ github.repository }}" \ |
| 81 | + --owner "${{ github.repository_owner }}" \ |
| 82 | + --server-url "${{ github.server_url }}" \ |
| 83 | + --staging-dir tests/results/_agent/release/runtime-harness-package/staging \ |
| 84 | + --tarball-dir tests/results/_agent/release/runtime-harness-package/tarballs \ |
| 85 | + --copy-license-from LICENSE \ |
| 86 | + --report tests/results/_agent/release/runtime-harness-package-stage.json \ |
| 87 | + --github-output "$GITHUB_OUTPUT" |
| 88 | +
|
| 89 | + - name: Publish runtime-harness candidate |
| 90 | + if: steps.context.outputs.publish == 'true' |
| 91 | + env: |
| 92 | + NODE_AUTH_TOKEN: ${{ github.token }} |
| 93 | + run: > |
| 94 | + node tools/npm/cli.mjs publish "${{ steps.stage.outputs.tarball_path }}" |
| 95 | + --tag "${{ steps.context.outputs.dist_tag }}" |
| 96 | +
|
| 97 | + - name: Verify runtime-harness candidate from clean consumer context |
| 98 | + id: verify |
| 99 | + env: |
| 100 | + NODE_AUTH_TOKEN: ${{ github.token }} |
| 101 | + shell: bash |
| 102 | + run: | |
| 103 | + set -euo pipefail |
| 104 | + verify_source="${{ steps.stage.outputs.tarball_path }}" |
| 105 | + if [ "${{ steps.context.outputs.publish }}" = "true" ]; then |
| 106 | + verify_source="${{ steps.context.outputs.package_spec }}" |
| 107 | + fi |
| 108 | + node tools/priority/js-package-release.mjs \ |
| 109 | + --action verify \ |
| 110 | + --package-dir packages/runtime-harness \ |
| 111 | + --version "${{ inputs.version }}" \ |
| 112 | + --channel "${{ inputs.channel }}" \ |
| 113 | + --publish "${{ inputs.publish }}" \ |
| 114 | + --repo "${{ github.repository }}" \ |
| 115 | + --owner "${{ github.repository_owner }}" \ |
| 116 | + --server-url "${{ github.server_url }}" \ |
| 117 | + --source-spec "$verify_source" \ |
| 118 | + --consumer-dir tests/results/_agent/release/runtime-harness-package/consumer \ |
| 119 | + --registry-url "${{ steps.context.outputs.registry_url }}" \ |
| 120 | + --report tests/results/_agent/release/runtime-harness-package-verification.json \ |
| 121 | + --github-output "$GITHUB_OUTPUT" |
| 122 | +
|
| 123 | + - name: Validate release reports |
| 124 | + run: | |
| 125 | + node tools/npm/run-script.mjs schema:validate -- --schema docs/schemas/js-package-release-v1.schema.json --data tests/results/_agent/release/runtime-harness-package-context.json --data tests/results/_agent/release/runtime-harness-package-stage.json --data tests/results/_agent/release/runtime-harness-package-verification.json |
| 126 | +
|
| 127 | + - name: Write rehearsal summary |
| 128 | + shell: bash |
| 129 | + run: | |
| 130 | + set -euo pipefail |
| 131 | + mkdir -p tests/results/_agent/release |
| 132 | + summary_path="tests/results/_agent/release/runtime-harness-package-summary.md" |
| 133 | + verification_source="packed tarball" |
| 134 | + if [ "${{ steps.context.outputs.publish }}" = "true" ]; then |
| 135 | + verification_source="published package spec" |
| 136 | + fi |
| 137 | + { |
| 138 | + echo "# runtime-harness package rehearsal summary" |
| 139 | + echo "" |
| 140 | + echo "- Package: \`${{ steps.context.outputs.package_name }}\`" |
| 141 | + echo "- Version: \`${{ steps.context.outputs.version }}\`" |
| 142 | + echo "- Channel: \`${{ steps.context.outputs.channel }}\`" |
| 143 | + echo "- Published: \`${{ steps.context.outputs.publish }}\`" |
| 144 | + echo "- Dist tag: \`${{ steps.context.outputs.dist_tag }}\`" |
| 145 | + echo "- Registry: \`${{ steps.context.outputs.registry_url }}\`" |
| 146 | + echo "- Package spec: \`${{ steps.context.outputs.package_spec }}\`" |
| 147 | + echo "- Verification source: \`${verification_source}\`" |
| 148 | + echo "- Tarball: \`${{ steps.stage.outputs.tarball_path }}\`" |
| 149 | + } | tee "$summary_path" |
| 150 | +
|
| 151 | + - name: Append summary |
| 152 | + shell: bash |
| 153 | + run: | |
| 154 | + cat tests/results/_agent/release/runtime-harness-package-summary.md >> "$GITHUB_STEP_SUMMARY" |
| 155 | +
|
| 156 | + - name: Write promotion evidence ledger |
| 157 | + if: always() |
| 158 | + shell: pwsh |
| 159 | + run: | |
| 160 | + $gateStatus = switch ('${{ job.status }}') { |
| 161 | + 'success' { 'pass' } |
| 162 | + 'cancelled' { 'blocked' } |
| 163 | + default { 'fail' } |
| 164 | + } |
| 165 | + $channel = if ([string]::IsNullOrWhiteSpace('${{ steps.context.outputs.channel }}')) { 'unknown' } else { '${{ steps.context.outputs.channel }}' } |
| 166 | + $version = if ([string]::IsNullOrWhiteSpace('${{ steps.context.outputs.version }}')) { 'unknown' } else { '${{ steps.context.outputs.version }}' } |
| 167 | + pwsh -NoLogo -NoProfile -File tools/Write-PromotionEvidenceLedger.ps1 -OutputPath tests/results/promotion-contract/runtime-harness-package-ledger.json -WorkflowName '${{ github.workflow }}' -Stream '@labview-community-ci-cd/runtime-harness' -Channel $channel -Version $version -GateStatus $gateStatus -GateReason 'runtime-harness-package-rehearsal workflow result' -SummaryPath 'tests/results/_agent/release/runtime-harness-package-summary.md' -StepSummaryPath $env:GITHUB_STEP_SUMMARY |
| 168 | +
|
| 169 | + - name: Emit SLO metrics |
| 170 | + if: always() |
| 171 | + shell: bash |
| 172 | + env: |
| 173 | + GH_TOKEN: ${{ github.token }} |
| 174 | + run: | |
| 175 | + node tools/priority/slo-metrics.mjs \ |
| 176 | + --repo "${{ github.repository }}" \ |
| 177 | + --output tests/results/_agent/slo/runtime-harness-package-rehearsal-slo-metrics.json |
| 178 | +
|
| 179 | + - name: Upload rehearsal artifacts |
| 180 | + if: always() |
| 181 | + uses: actions/upload-artifact@v5 |
| 182 | + with: |
| 183 | + name: runtime-harness-package-rehearsal-${{ github.run_id }} |
| 184 | + path: | |
| 185 | + tests/results/_agent/release/runtime-harness-package-context.json |
| 186 | + tests/results/_agent/release/runtime-harness-package-stage.json |
| 187 | + tests/results/_agent/release/runtime-harness-package-verification.json |
| 188 | + tests/results/_agent/release/runtime-harness-package-summary.md |
| 189 | + tests/results/promotion-contract/runtime-harness-package-ledger.json |
| 190 | + tests/results/_agent/slo/runtime-harness-package-rehearsal-slo-metrics.json |
| 191 | + tests/results/_agent/release/runtime-harness-package/tarballs/*.tgz |
| 192 | + if-no-files-found: error |
0 commit comments