Brand generated syncs as Intelligence Flow Labs (#31) #65
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Boatstack-owned control plane. | |
| name: Verify Boatstack distribution | |
| on: | |
| pull_request: | |
| push: | |
| branches: [main] | |
| permissions: | |
| contents: read | |
| jobs: | |
| test: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Verify upstream sync contract | |
| shell: bash | |
| run: | | |
| workflow=".github/workflows/sync-upstream.yml" | |
| current="labs/12-product-engineering-loop" | |
| retired="examples/12-product-engineering-loop" | |
| count="$(grep -cF "$current" "$workflow")" | |
| if [[ "$count" != "2" ]]; then | |
| echo "Expected exactly two sync references to $current; found $count." >&2 | |
| exit 1 | |
| fi | |
| if grep -Fq "$retired" "$workflow"; then | |
| echo "Sync workflow still references retired path $retired." >&2 | |
| exit 1 | |
| fi | |
| title='Sync Boatstack from Intelligence Flow Labs @ $short' | |
| title_count="$(grep -cF "$title" "$workflow")" | |
| if [[ "$title_count" != "2" ]]; then | |
| echo "Expected commit and PR titles to use $title; found $title_count." >&2 | |
| exit 1 | |
| fi | |
| - name: Detect projected runtime | |
| id: runtime | |
| shell: bash | |
| run: | | |
| if [[ -f boatstack/go.mod ]]; then | |
| echo "go=true" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "go=false" >> "$GITHUB_OUTPUT" | |
| fi | |
| - uses: actions/setup-go@v5 | |
| if: steps.runtime.outputs.go == 'true' | |
| with: | |
| go-version-file: boatstack/go.mod | |
| cache-dependency-path: boatstack/go.mod | |
| - run: go test ./... | |
| if: steps.runtime.outputs.go == 'true' | |
| working-directory: boatstack | |
| - run: go build ./cmd/boatstack-helper | |
| if: steps.runtime.outputs.go == 'true' | |
| working-directory: boatstack | |
| - uses: actions/setup-python@v5 | |
| if: steps.runtime.outputs.go != 'true' | |
| with: | |
| python-version: "3.11" | |
| - name: Verify legacy projection during migration | |
| if: steps.runtime.outputs.go != 'true' | |
| env: | |
| PYTHONUTF8: "1" | |
| run: python3 -m unittest discover -s tests -v | |
| - name: Compile legacy projection during migration | |
| if: steps.runtime.outputs.go != 'true' | |
| env: | |
| PYTHONUTF8: "1" | |
| run: python3 -m compileall -q boatstack | |
| - name: Validate Bash installer | |
| if: steps.runtime.outputs.go == 'true' && runner.os != 'Windows' | |
| shell: bash | |
| run: bash -n install.sh | |
| - name: Validate PowerShell installer | |
| if: steps.runtime.outputs.go == 'true' && runner.os == 'Windows' | |
| shell: pwsh | |
| run: | | |
| $tokens = $null | |
| $errors = $null | |
| [System.Management.Automation.Language.Parser]::ParseFile((Resolve-Path install.ps1), [ref]$tokens, [ref]$errors) > $null | |
| if ($errors.Count -gt 0) { | |
| $errors | ForEach-Object { Write-Error $_ } | |
| exit 1 | |
| } | |
| auto-merge-sync: | |
| if: >- | |
| github.event_name == 'pull_request' && | |
| github.event.pull_request.head.repo.full_name == github.repository && | |
| startsWith(github.head_ref, 'sync/intelligence-flow-') | |
| needs: test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Create repository automation token | |
| id: app-token | |
| uses: actions/create-github-app-token@v3 | |
| with: | |
| client-id: ${{ vars.BOATSTACK_APP_CLIENT_ID }} | |
| private-key: ${{ secrets.BOATSTACK_APP_PRIVATE_KEY }} | |
| owner: operatorstack | |
| repositories: boatstack | |
| permission-contents: write | |
| permission-pull-requests: write | |
| - uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.event.pull_request.head.sha }} | |
| - name: Verify generated projection provenance | |
| env: | |
| APP_SLUG: ${{ steps.app-token.outputs.app-slug }} | |
| HEAD_BRANCH: ${{ github.head_ref }} | |
| PR_AUTHOR: ${{ github.event.pull_request.user.login }} | |
| shell: bash | |
| run: | | |
| source_repo="$(jq -r '.source.repository' UPSTREAM.json)" | |
| source_commit="$(jq -r '.source.commit' UPSTREAM.json)" | |
| short="${source_commit:0:12}" | |
| [[ "$PR_AUTHOR" == "${APP_SLUG}[bot]" ]] | |
| [[ "$source_repo" == "operatorstack/intelligence-flow" ]] | |
| [[ "$HEAD_BRANCH" == "sync/intelligence-flow-$short" ]] | |
| - name: Merge verified generated PR | |
| env: | |
| GH_TOKEN: ${{ steps.app-token.outputs.token }} | |
| PR_URL: ${{ github.event.pull_request.html_url }} | |
| run: gh pr merge "$PR_URL" --squash |