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