|
| 1 | +name: Core CI |
| 2 | + |
| 3 | +permissions: |
| 4 | + contents: read |
| 5 | + |
| 6 | +on: |
| 7 | + push: |
| 8 | + branches: |
| 9 | + - main |
| 10 | + # Exclude isolated emitter packages and files already checked by dedicated CI workflows |
| 11 | + paths-ignore: |
| 12 | + - ".prettierignore" |
| 13 | + - ".prettierrc.json" |
| 14 | + - "cspell.yaml" |
| 15 | + - "eslint.config.json" |
| 16 | + - ".chronus/**" |
| 17 | + - "eng/emitters/**" |
| 18 | + - "packages/http-client-csharp/**" |
| 19 | + - "packages/http-client-java/**" |
| 20 | + - "packages/http-client-python/**" |
| 21 | + pull_request: |
| 22 | + branches: |
| 23 | + - main |
| 24 | + - "release/*" |
| 25 | + paths-ignore: |
| 26 | + - ".prettierignore" |
| 27 | + - ".prettierrc.json" |
| 28 | + - "cspell.yaml" |
| 29 | + - "eslint.config.json" |
| 30 | + - ".chronus/**" |
| 31 | + - "eng/emitters/**" |
| 32 | + - "packages/http-client-csharp/**" |
| 33 | + - "packages/http-client-java/**" |
| 34 | + - "packages/http-client-python/**" |
| 35 | + merge_group: |
| 36 | + |
| 37 | +concurrency: |
| 38 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 39 | + cancel-in-progress: true |
| 40 | + |
| 41 | +jobs: |
| 42 | + build: |
| 43 | + name: Build (${{ matrix.os }}, Node ${{ matrix.node-version }}) |
| 44 | + runs-on: ${{ matrix.os }} |
| 45 | + strategy: |
| 46 | + fail-fast: false |
| 47 | + matrix: |
| 48 | + os: [ubuntu-latest, windows-latest] |
| 49 | + node-version: ["20.x", "22.x", "24.x"] |
| 50 | + |
| 51 | + env: |
| 52 | + TYPESPEC_VS_CI_BUILD: true |
| 53 | + TYPESPEC_SKIP_WEBSITE_BUILD: true |
| 54 | + |
| 55 | + steps: |
| 56 | + - name: Enable git long paths (Windows) |
| 57 | + if: runner.os == 'Windows' |
| 58 | + run: git config --global core.longpaths true |
| 59 | + |
| 60 | + - uses: actions/checkout@v4 |
| 61 | + |
| 62 | + - uses: ./.github/actions/setup |
| 63 | + with: |
| 64 | + node-version: ${{ matrix.node-version }} |
| 65 | + |
| 66 | + - uses: actions/setup-dotnet@v5 |
| 67 | + with: |
| 68 | + dotnet-version: 8.0.x |
| 69 | + |
| 70 | + - name: Install dependencies |
| 71 | + run: pnpm install |
| 72 | + |
| 73 | + - name: Restore .NET dependencies |
| 74 | + run: dotnet restore |
| 75 | + working-directory: packages/typespec-vs |
| 76 | + |
| 77 | + - name: Build |
| 78 | + run: pnpm run build |
| 79 | + |
| 80 | + - name: Test |
| 81 | + run: pnpm vitest run --coverage --reporter=default --reporter=github-actions |
| 82 | + |
| 83 | + - name: Upload coverage artifacts |
| 84 | + uses: actions/upload-artifact@v4 |
| 85 | + if: always() |
| 86 | + with: |
| 87 | + name: coverage-${{ matrix.os }}-node${{ matrix.node-version }} |
| 88 | + path: packages/*/coverage/ |
| 89 | + retention-days: 5 |
| 90 | + |
| 91 | + - name: Check for changed files |
| 92 | + run: node eng/common/scripts/check-for-changed-files.js |
| 93 | + |
| 94 | + website: |
| 95 | + name: Website |
| 96 | + runs-on: ubuntu-latest |
| 97 | + |
| 98 | + steps: |
| 99 | + - uses: actions/checkout@v4 |
| 100 | + |
| 101 | + - uses: ./.github/actions/setup |
| 102 | + |
| 103 | + - name: Install dependencies |
| 104 | + run: pnpm install |
| 105 | + |
| 106 | + - name: Install Playwright browsers |
| 107 | + run: npx playwright install --with-deps |
| 108 | + |
| 109 | + - name: Build website |
| 110 | + run: pnpm --filter "@typespec/website..." run build |
| 111 | + |
| 112 | + - name: Check for changed files |
| 113 | + run: node eng/common/scripts/check-for-changed-files.js |
| 114 | + |
| 115 | + e2e: |
| 116 | + name: E2E Tests |
| 117 | + runs-on: ubuntu-latest |
| 118 | + |
| 119 | + env: |
| 120 | + TYPESPEC_VS_CI_BUILD: false |
| 121 | + TYPESPEC_SKIP_WEBSITE_BUILD: true |
| 122 | + DISPLAY: ":99" |
| 123 | + |
| 124 | + steps: |
| 125 | + - uses: actions/checkout@v4 |
| 126 | + |
| 127 | + - uses: ./.github/actions/setup |
| 128 | + |
| 129 | + - name: Install dependencies |
| 130 | + run: pnpm install |
| 131 | + |
| 132 | + - name: Install Playwright browsers |
| 133 | + run: | |
| 134 | + sudo dpkg --configure -a |
| 135 | + npx playwright install --with-deps |
| 136 | +
|
| 137 | + - name: Start Xvfb |
| 138 | + run: | |
| 139 | + /usr/bin/Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 & |
| 140 | + echo "Started xvfb" |
| 141 | +
|
| 142 | + - name: Build |
| 143 | + run: pnpm run build |
| 144 | + |
| 145 | + - name: E2E Tests |
| 146 | + run: pnpm run test:e2e |
| 147 | + |
| 148 | + - name: Upload UI test results |
| 149 | + uses: actions/upload-artifact@v4 |
| 150 | + if: always() |
| 151 | + with: |
| 152 | + name: uitestresults-e2e |
| 153 | + path: packages/playground-website/test-results/ |
| 154 | + retention-days: 5 |
| 155 | + |
| 156 | + - name: Upload screenshots |
| 157 | + uses: actions/upload-artifact@v4 |
| 158 | + if: always() |
| 159 | + with: |
| 160 | + name: screenshots |
| 161 | + path: packages/typespec-vscode/temp/images-linux/ |
| 162 | + retention-days: 5 |
| 163 | + |
| 164 | + - name: Upload trace results |
| 165 | + uses: actions/upload-artifact@v4 |
| 166 | + if: always() |
| 167 | + with: |
| 168 | + name: trace-results |
| 169 | + path: packages/typespec-vscode/test-results/ |
| 170 | + retention-days: 5 |
| 171 | + |
| 172 | + - name: Check for changed files |
| 173 | + run: node eng/common/scripts/check-for-changed-files.js |
| 174 | + |
| 175 | + docker: |
| 176 | + name: Docker Build |
| 177 | + runs-on: ubuntu-latest |
| 178 | + |
| 179 | + steps: |
| 180 | + - uses: actions/checkout@v4 |
| 181 | + |
| 182 | + - name: Build Docker image |
| 183 | + run: docker build -f ./docker/Dockerfile . |
0 commit comments