diff --git a/.github/workflows/test-implementations.yml b/.github/workflows/test-implementations.yml new file mode 100644 index 00000000..32daa3e8 --- /dev/null +++ b/.github/workflows/test-implementations.yml @@ -0,0 +1,82 @@ +# spec tests pipeline plan + +# Stage 1: +# - Run tests on the children specs +# - report it back in this spec PR as a comment + +# Stage 2: +# - scheduled run on the children specs repo, like in a daily basis +# - if failure aggregate the results in an issue +# - each run is logged in that issue with the failed spec repo version + +# Stage 3: +# - improve notification: should it go to Discord/Slack/Email/etc? + +name: Test Implementation Repos + +on: + push: + branches: + - main + - leordev/test-implementations + pull_request: + branches: + - main + +jobs: + test: + strategy: + matrix: + include: + - repo: tbdex-js + ci_file: integrity-check.yml + + runs-on: ubuntu-latest + steps: + - name: Generate an access token to write to downstream repo + uses: actions/create-github-app-token@2986852ad836768dfea7781f31828eb3e17990fa # v1.6.2 + id: app-token + with: + app-id: ${{ secrets.CICD_ROBOT_GITHUB_APP_ID }} + private-key: ${{ secrets.CICD_ROBOT_GITHUB_APP_PRIVATE_KEY }} + owner: TBD54566975 + repositories: ${{ matrix.repo }} + + - name: Checkout spec repository + uses: actions/checkout@v4 + with: + token: ${{ steps.app-token.outputs.token }} + repository: TBD54566975/${{ matrix.repo }} + ref: main + submodules: true + # Make sure the value of GITHUB_TOKEN will not be persisted in repo's config + persist-credentials: false + + - name: Update spec submodule in ${{ matrix.repo }} + env: + # get the current sha from the action event + SPEC_SHA: ${{ github.event.head_commit.id }} + run: | + cd tbdex + git fetch origin ${{ env.SPEC_SHA }} + cd .. + SHORT_SHA=$(echo ${{ env.SPEC_SHA }} | cut -c 1-8) + git checkout -b spec/tbdex-$SHORT_SHA + git add . + git commit -m "Update spec to $SHORT_SHA" + git push origin spec/tbdex-$SHORT_SHA + + # - name: Trigger tbdex-js CI pipeline + # env: + # SHORT_SHA: ${{ steps.spec-sha.outputs.SHORT_SHA }} + # run: | + # # Trigger CI pipeline for tbdex-js (example with GitHub Actions) + # curl -X POST -H "Authorization: token $GITHUB_TOKEN" \ + # -H "Accept: application/vnd.github.v3+json" \ + # https://api.github.com/repos/your-org/${{ matrix.repo }}/actions/workflows/${{ matrix.ci_file }}/dispatches \ + # -d '{"ref":"spec/tbdex-${{ env.SHORT_SHA }}"}' + + # - name: Aggregate test results + # run: | + # # Logic to aggregate test results from child repositories + # # Send notifications to stakeholders