microsoft/typespec
Publicmirrored from https://github.com/microsoft/typespecAvailable
.github/workflows/external-integration.yml
115lines · modecode
| 1 | name: Integration |
| 2 | |
| 3 | on: |
| 4 | pull_request: |
| 5 | branches: ["main"] |
| 6 | paths-ignore: |
| 7 | - "packages/http-client-csharp/**" |
| 8 | - "packages/http-client-java/**" |
| 9 | - "packages/http-client-python/**" |
| 10 | - "website/**" |
| 11 | - "docs/**" |
| 12 | # Allow manual triggering |
| 13 | workflow_dispatch: |
| 14 | |
| 15 | permissions: |
| 16 | contents: read |
| 17 | |
| 18 | # This check is optional by default |
| 19 | concurrency: |
| 20 | group: ${{ github.workflow }}-${{ github.ref }} |
| 21 | cancel-in-progress: true |
| 22 | |
| 23 | jobs: |
| 24 | azure-integration-check: |
| 25 | name: Azure/typespec-azure |
| 26 | runs-on: ubuntu-latest |
| 27 | # Only run if not from dependabot, publish, backmerge, or revert branches |
| 28 | if: | |
| 29 | !startsWith(github.head_ref, 'dependabot/') && |
| 30 | !startsWith(github.head_ref, 'publish/') && |
| 31 | !startsWith(github.head_ref, 'backmerge/') && |
| 32 | !startsWith(github.head_ref, 'revert-') |
| 33 | |
| 34 | steps: |
| 35 | - name: Setup Node.js |
| 36 | uses: actions/setup-node@v6 |
| 37 | with: |
| 38 | node-version: lts/* |
| 39 | |
| 40 | - name: Checkout Azure/typespec-azure repo |
| 41 | uses: actions/checkout@v6 |
| 42 | with: |
| 43 | repository: Azure/typespec-azure |
| 44 | submodules: true |
| 45 | |
| 46 | - name: Install pnpm |
| 47 | uses: pnpm/action-setup@v6 |
| 48 | |
| 49 | - name: Update core submodule to PR commit |
| 50 | run: | |
| 51 | # Configure git to use the PR's repository as a remote for the submodule |
| 52 | cd core |
| 53 | git remote add pr https://github.com/${{ github.repository }}.git |
| 54 | git fetch pr ${{ github.event.pull_request.head.sha }} |
| 55 | # Update the submodule to point to the PR commit |
| 56 | git checkout ${{ github.event.pull_request.head.sha }} |
| 57 | |
| 58 | - name: Install |
| 59 | run: pnpm install --no-frozen-lockfile |
| 60 | |
| 61 | - name: Install Playwright |
| 62 | run: pnpm exec playwright install |
| 63 | |
| 64 | - name: Build |
| 65 | run: pnpm build |
| 66 | |
| 67 | - name: Test |
| 68 | run: pnpm test |
| 69 | |
| 70 | - name: E2E Test |
| 71 | run: pnpm test:e2e |
| 72 | |
| 73 | azure-rest-api-specs: |
| 74 | name: Azure REST API Specs |
| 75 | runs-on: ubuntu-latest |
| 76 | if: contains(github.event.pull_request.labels.*.name, 'int:azure-specs') || github.event_name == 'workflow_dispatch' |
| 77 | |
| 78 | steps: |
| 79 | - name: Checkout repository |
| 80 | uses: actions/checkout@v6 |
| 81 | with: |
| 82 | submodules: true |
| 83 | fetch-depth: 0 |
| 84 | ref: ${{ github.event.pull_request.head.sha || github.sha }} |
| 85 | |
| 86 | - name: Setup Node.js and pnpm |
| 87 | uses: ./.github/actions/setup |
| 88 | |
| 89 | - name: Install dependencies |
| 90 | run: pnpm install |
| 91 | |
| 92 | - name: Build and pack TypeSpec Azure packages |
| 93 | run: | |
| 94 | pnpm --filter "!@typespec/playground-website" --filter "!@typespec/website" -r build |
| 95 | |
| 96 | pnpm chronus pack --pack-destination ./tgz-packages --exclude standalone |
| 97 | |
| 98 | echo "Created tgz packages:" |
| 99 | ls -la ./tgz-packages/ |
| 100 | |
| 101 | cd packages/tsp-integration |
| 102 | npm link |
| 103 | |
| 104 | - name: Checkout |
| 105 | run: tsp-integration azure-specs --stage checkout |
| 106 | |
| 107 | - name: Patch package.json |
| 108 | run: tsp-integration azure-specs --stage patch --stage install --tgz-dir ./tgz-packages |
| 109 | |
| 110 | - name: Run TypeSpec validation in azure-rest-api-specs |
| 111 | run: tsp-integration azure-specs --stage validate |
| 112 | |
| 113 | - name: Check for git changes |
| 114 | if: success() || failure() # Still run this step even if validation fails to ensure as much information as possible |
| 115 | run: tsp-integration azure-specs --stage validate:clean |
| 116 | |