ci.yml 16.3 KB
Newer Older
E
Edward Thomson 已提交
1 2
name: CI

J
João Moreno 已提交
3 4
on:
  push:
5 6 7 8 9 10 11
    branches:
      - master
      - release/*
  pull_request:
    branches:
      - master
      - release/*
E
Edward Thomson 已提交
12 13

jobs:
14
  hygiene:
A
Alexandru Dima 已提交
15
    name: Hygiene and Layering
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
    runs-on: ubuntu-latest
    env:
      GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
    steps:
      - uses: actions/checkout@v2

      - uses: actions/setup-node@v2-beta
        with:
          node-version: 12

      - name: Cache node modules
        id: cacheNodeModules
        uses: actions/cache@v2
        with:
          path: '**/node_modules'
          key: ${{ runner.os }}-cacheNodeModules-${{ hashFiles('.yarnrc', 'remote/.yarnrc', '**/yarn.lock', '!**/node_modules/**/yarn.lock', '!**/.*/**/yarn.lock') }}
          restore-keys: ${{ runner.os }}-cacheNodeModules-
      - name: Execute yarn
34
        if: ${{ steps.cacheNodeModules.outputs.cache-hit != 'true' }}
35 36
        env:
          PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
37 38 39 40 41
        run: yarn --frozen-lockfile

      - name: Run Hygiene Checks
        run: yarn gulp hygiene

42 43 44
      - name: Run Valid Layers Checks
        run: yarn valid-layers-check

A
Alexandru Dima 已提交
45 46
  build-compile:
    name: "Build: Compile"
A
Alexandru Dima 已提交
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
    runs-on: ubuntu-latest
    env:
      GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
    steps:
      - uses: actions/checkout@v2

      - uses: actions/setup-node@v2-beta
        with:
          node-version: 12

      - name: Cache node modules
        id: cacheNodeModules
        uses: actions/cache@v2
        with:
          path: '**/node_modules'
          key: ${{ runner.os }}-cacheNodeModules-${{ hashFiles('.yarnrc', 'remote/.yarnrc', '**/yarn.lock', '!**/node_modules/**/yarn.lock', '!**/.*/**/yarn.lock') }}
          restore-keys: ${{ runner.os }}-cacheNodeModules-
      - name: Execute yarn
65
        if: ${{ steps.cacheNodeModules.outputs.cache-hit != 'true' }}
A
Alexandru Dima 已提交
66 67 68 69 70 71 72 73 74 75 76 77
        env:
          PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
        run: yarn --frozen-lockfile

      - name: Cache compiled code
        id: cacheCompiledCode
        uses: actions/cache@v2
        with:
          path: |
            .build
            out-build
            out-vscode-min
A
Alexandru Dima 已提交
78
          key: cacheCompiledCode-${{ github.sha }}
A
Alexandru Dima 已提交
79 80

      - name: Compile Core
81
        if: ${{ steps.cacheCompiledCode.outputs.cache-hit != 'true' }}
A
Alexandru Dima 已提交
82 83 84
        run: yarn gulp compile-build

      - name: Compile Extensions
85
        if: ${{ steps.cacheCompiledCode.outputs.cache-hit != 'true' }}
A
Alexandru Dima 已提交
86 87 88
        run: yarn gulp compile-extensions-build

      - name: Minify VS Code
89
        if: ${{ steps.cacheCompiledCode.outputs.cache-hit != 'true' }}
A
Alexandru Dima 已提交
90 91
        run: yarn gulp minify-vscode

A
Alexandru Dima 已提交
92 93 94
  build-linux-unit-tests:
    name: "Build: Linux Unit Tests"
    needs: build-compile
A
Alexandru Dima 已提交
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130
    runs-on: ubuntu-latest
    env:
      GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
    steps:
      - uses: actions/checkout@v2

      # TODO: rename azure-pipelines/linux/xvfb.init to github-actions
      - name: Setup Build Environment
        run: |
          sudo apt-get update
          sudo apt-get install -y libxkbfile-dev pkg-config libsecret-1-dev libxss1 dbus xvfb libgtk-3-0 libgbm1
          sudo cp build/azure-pipelines/linux/xvfb.init /etc/init.d/xvfb
          sudo chmod +x /etc/init.d/xvfb
          sudo update-rc.d xvfb defaults
          sudo service xvfb start

      - uses: actions/setup-node@v2-beta
        with:
          node-version: 12

      - name: Restore cached node modules
        id: cacheNodeModules
        uses: actions/cache@v2
        with:
          path: '**/node_modules'
          key: ${{ runner.os }}-cacheNodeModules-${{ hashFiles('.yarnrc', 'remote/.yarnrc', '**/yarn.lock', '!**/node_modules/**/yarn.lock', '!**/.*/**/yarn.lock') }}
          restore-keys: ${{ runner.os }}-cacheNodeModules-

      - name: Restore cached compiled code
        id: cacheCompiledCode
        uses: actions/cache@v2
        with:
          path: |
            .build
            out-build
            out-vscode-min
A
Alexandru Dima 已提交
131
          key: cacheCompiledCode-${{ github.sha }}
A
Alexandru Dima 已提交
132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147

      - name: Build VS Code
        run: yarn gulp vscode-linux-x64-min-ci

      - name: Download Electron
        run: yarn electron x64

      - name: Run Unit Tests (Electron)
        run: DISPLAY=:10 ./scripts/test.sh --build

      - name: Download Playwright
        run: node ./node_modules/playwright/install.js

      - name: Run Unit Tests (Browser)
        run: DISPLAY=:10 yarn test-browser --build --browser chromium

A
Alexandru Dima 已提交
148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186
  build-linux-integration-tests:
    name: "Build: Linux Integration Tests"
    needs: build-compile
    runs-on: ubuntu-latest
    env:
      GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
    steps:
      - uses: actions/checkout@v2

      # TODO: rename azure-pipelines/linux/xvfb.init to github-actions
      - name: Setup Build Environment
        run: |
          sudo apt-get update
          sudo apt-get install -y libxkbfile-dev pkg-config libsecret-1-dev libxss1 dbus xvfb libgtk-3-0 libgbm1
          sudo cp build/azure-pipelines/linux/xvfb.init /etc/init.d/xvfb
          sudo chmod +x /etc/init.d/xvfb
          sudo update-rc.d xvfb defaults
          sudo service xvfb start

      - uses: actions/setup-node@v2-beta
        with:
          node-version: 12

      - name: Restore cached node modules
        id: cacheNodeModules
        uses: actions/cache@v2
        with:
          path: '**/node_modules'
          key: ${{ runner.os }}-cacheNodeModules-${{ hashFiles('.yarnrc', 'remote/.yarnrc', '**/yarn.lock', '!**/node_modules/**/yarn.lock', '!**/.*/**/yarn.lock') }}
          restore-keys: ${{ runner.os }}-cacheNodeModules-

      - name: Restore cached compiled code
        id: cacheCompiledCode
        uses: actions/cache@v2
        with:
          path: |
            .build
            out-build
            out-vscode-min
A
Alexandru Dima 已提交
187
          key: cacheCompiledCode-${{ github.sha }}
A
Alexandru Dima 已提交
188 189 190 191 192 193 194

      - name: Build VS Code
        run: yarn gulp vscode-linux-x64-min-ci

      - name: Download Electron
        run: yarn electron x64

A
Alexandru Dima 已提交
195 196
      - name: Run Integration Tests (Electron)
        run: DISPLAY=:10 ./scripts/test-integration.sh --build
197

A
Alexandru Dima 已提交
198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218
  build-darwin-unit-tests:
    name: "Build: macOS Unit Tests"
    needs: build-compile
    runs-on: macos-latest
    env:
      GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
    steps:
      - uses: actions/checkout@v2

      - uses: actions/setup-node@v2-beta
        with:
          node-version: 12

      - name: Cache node modules
        id: cacheNodeModules
        uses: actions/cache@v2
        with:
          path: '**/node_modules'
          key: ${{ runner.os }}-cacheNodeModules-${{ hashFiles('.yarnrc', 'remote/.yarnrc', '**/yarn.lock', '!**/node_modules/**/yarn.lock', '!**/.*/**/yarn.lock') }}
          restore-keys: ${{ runner.os }}-cacheNodeModules-
      - name: Execute yarn
219
        if: ${{ steps.cacheNodeModules.outputs.cache-hit != 'true' }}
A
Alexandru Dima 已提交
220 221 222 223 224 225 226 227 228 229 230 231
        env:
          PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
        run: yarn --frozen-lockfile

      - name: Restore cached compiled code
        id: cacheCompiledCode
        uses: actions/cache@v2
        with:
          path: |
            .build
            out-build
            out-vscode-min
A
Alexandru Dima 已提交
232
          key: cacheCompiledCode-${{ github.sha }}
A
Alexandru Dima 已提交
233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269

      - name: Build VS Code
        run: yarn gulp vscode-darwin-x64-min-ci

      - name: Download Electron
        run: yarn electron x64

      - name: Run Unit Tests (Electron)
        run: ./scripts/test.sh --build

      - name: Download Playwright
        run: node ./node_modules/playwright/install.js

      - name: Run Unit Tests (Browser)
        run: yarn test-browser --build --browser chromium --browser webkit --browser firefox

  build-darwin-integration-tests:
    name: "Build: macOS Integration Tests"
    needs: build-compile
    runs-on: macos-latest
    env:
      GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
    steps:
      - uses: actions/checkout@v2

      - uses: actions/setup-node@v2-beta
        with:
          node-version: 12

      - name: Cache node modules
        id: cacheNodeModules
        uses: actions/cache@v2
        with:
          path: '**/node_modules'
          key: ${{ runner.os }}-cacheNodeModules-${{ hashFiles('.yarnrc', 'remote/.yarnrc', '**/yarn.lock', '!**/node_modules/**/yarn.lock', '!**/.*/**/yarn.lock') }}
          restore-keys: ${{ runner.os }}-cacheNodeModules-
      - name: Execute yarn
270
        if: ${{ steps.cacheNodeModules.outputs.cache-hit != 'true' }}
A
Alexandru Dima 已提交
271 272 273 274 275 276 277 278 279 280 281 282
        env:
          PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
        run: yarn --frozen-lockfile

      - name: Restore cached compiled code
        id: cacheCompiledCode
        uses: actions/cache@v2
        with:
          path: |
            .build
            out-build
            out-vscode-min
A
Alexandru Dima 已提交
283
          key: cacheCompiledCode-${{ github.sha }}
A
Alexandru Dima 已提交
284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314

      - name: Build VS Code
        run: yarn gulp vscode-darwin-x64-min-ci

      - name: Download Electron
        run: yarn electron x64

      - name: Run Integration Tests (Electron)
        run: ./scripts/test-integration.sh --build

  build-darwin-smoke-tests:
    name: "Build: macOS Smoke Tests"
    needs: build-compile
    runs-on: macos-latest
    env:
      GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
    steps:
      - uses: actions/checkout@v2

      - uses: actions/setup-node@v2-beta
        with:
          node-version: 12

      - name: Cache node modules
        id: cacheNodeModules
        uses: actions/cache@v2
        with:
          path: '**/node_modules'
          key: ${{ runner.os }}-cacheNodeModules-${{ hashFiles('.yarnrc', 'remote/.yarnrc', '**/yarn.lock', '!**/node_modules/**/yarn.lock', '!**/.*/**/yarn.lock') }}
          restore-keys: ${{ runner.os }}-cacheNodeModules-
      - name: Execute yarn
315
        if: ${{ steps.cacheNodeModules.outputs.cache-hit != 'true' }}
A
Alexandru Dima 已提交
316 317 318 319 320 321 322 323 324 325 326 327
        env:
          PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
        run: yarn --frozen-lockfile

      - name: Restore cached compiled code
        id: cacheCompiledCode
        uses: actions/cache@v2
        with:
          path: |
            .build
            out-build
            out-vscode-min
A
Alexandru Dima 已提交
328
          key: cacheCompiledCode-${{ github.sha }}
A
Alexandru Dima 已提交
329 330 331 332 333 334 335 336 337 338 339 340

      - name: Build VS Code
        run: yarn gulp vscode-darwin-x64-min-ci

      - name: Run Smoke Tests (Electron)
        continue-on-error: true
        run: |
          set -e
          APP_ROOT=$(GITHUB_WORKSPACE)/VSCode-darwin-x64
          APP_NAME="`ls $APP_ROOT | head -n 1`"
          yarn smoketest --build "$APP_ROOT/$APP_NAME"

341
  linux:
342
    name: Linux
343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363
    runs-on: ubuntu-latest
    env:
      GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
    steps:
      - uses: actions/checkout@v2

      # TODO: rename azure-pipelines/linux/xvfb.init to github-actions
      - name: Setup Build Environment
        run: |
          sudo apt-get update
          sudo apt-get install -y libxkbfile-dev pkg-config libsecret-1-dev libxss1 dbus xvfb libgtk-3-0 libgbm1
          sudo cp build/azure-pipelines/linux/xvfb.init /etc/init.d/xvfb
          sudo chmod +x /etc/init.d/xvfb
          sudo update-rc.d xvfb defaults
          sudo service xvfb start

      - uses: actions/setup-node@v2-beta
        with:
          node-version: 12

      - name: Cache node modules
A
Alexandru Dima 已提交
364
        id: cacheNodeModules
365 366
        uses: actions/cache@v2
        with:
A
Alexandru Dima 已提交
367 368 369 370
          path: '**/node_modules'
          key: ${{ runner.os }}-cacheNodeModules-${{ hashFiles('.yarnrc', 'remote/.yarnrc', '**/yarn.lock', '!**/node_modules/**/yarn.lock', '!**/.*/**/yarn.lock') }}
          restore-keys: ${{ runner.os }}-cacheNodeModules-
      - name: Execute yarn
371
        if: ${{ steps.cacheNodeModules.outputs.cache-hit != 'true' }}
372 373
        env:
          PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
A
Alexandru Dima 已提交
374
        run: yarn --frozen-lockfile
375

A
Alexandru Dima 已提交
376
      - name: Compile and Download
A
Alexandru Dima 已提交
377
        run: yarn concurrently --max_old_space_size=4095 --names "compile,electron,playwright,builtin-extensions" "node --max_old_space_size=4095 ./node_modules/gulp/bin/gulp.js compile" "yarn electron x64" "node ./node_modules/playwright/install.js" "yarn download-builtin-extensions"
378

A
Alexandru Dima 已提交
379
      - name: Run Unit Tests (Electron)
A
Alexandru Dima 已提交
380
        id: electron-unit-tests
A
Alexandru Dima 已提交
381
        run: DISPLAY=:10 ./scripts/test.sh
382

A
Alexandru Dima 已提交
383
      - name: Run Unit Tests (Browser)
A
Alexandru Dima 已提交
384
        id: browser-unit-tests
A
Alexandru Dima 已提交
385 386 387
        run: DISPLAY=:10 yarn test-browser --browser chromium

      - name: Run Integration Tests (Electron)
A
Alexandru Dima 已提交
388
        id: electron-integration-tests
A
Alexandru Dima 已提交
389 390
        run: DISPLAY=:10 ./scripts/test-integration.sh

A
Alexandru Dima 已提交
391 392
      - name: Create Issue on Unit Test Failure
        uses: nashmaniac/create-issue-action@v1.1
393
        if: ${{ failure() }}
A
Alexandru Dima 已提交
394
        with:
395
          title: "CI: Test Failure"
A
Alexandru Dima 已提交
396
          token: ${{secrets.GITHUB_TOKEN}}
397
          assignees: alexdima #${{github.actor}}
398
          labels: unit-test-failure linux
A
Alexandru Dima 已提交
399
          body: Running tests failed for commit ${{github.sha}}. Please see https://github.com/microsoft/vscode/actions/runs/${{github.run_id}}
A
Alexandru Dima 已提交
400

A
Alexandru Dima 已提交
401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425
  windows:
    name: Windows
    runs-on: windows-latest
    env:
      CHILD_CONCURRENCY: "1"
      GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
    steps:
      - uses: actions/checkout@v2

      - uses: actions/setup-node@v2-beta
        with:
          node-version: 12

      - uses: actions/setup-python@v2
        with:
          python-version: '2.x'

      - name: Cache node modules
        id: cacheNodeModules
        uses: actions/cache@v2
        with:
          path: '**/node_modules'
          key: ${{ runner.os }}-cacheNodeModules-${{ hashFiles('.yarnrc', 'remote/.yarnrc', '**/yarn.lock', '!**/node_modules/**/yarn.lock', '!**/.*/**/yarn.lock') }}
          restore-keys: ${{ runner.os }}-cacheNodeModules-
      - name: Execute yarn
426
        if: ${{ steps.cacheNodeModules.outputs.cache-hit != 'true' }}
A
Alexandru Dima 已提交
427 428 429 430 431 432 433 434 435 436 437 438 439 440 441
        env:
          PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
        run: yarn --frozen-lockfile

      - name: Compile and Download
        run: yarn concurrently --max_old_space_size=4095 --names "compile,electron,playwright,builtin-extensions" "node --max_old_space_size=4095 ./node_modules/gulp/bin/gulp.js compile" "yarn electron x64" "node ./node_modules/playwright/install.js" "yarn download-builtin-extensions"

      - name: Run Unit Tests (Electron)
        run: .\scripts\test.bat

      - name: Run Unit Tests (Browser)
        run: yarn test-browser --browser chromium

      - name: Run Integration Tests (Electron)
        run: .\scripts\test-integration.bat
E
Edward Thomson 已提交
442

A
Alexandru Dima 已提交
443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462
  darwin:
    name: macOS
    runs-on: macos-latest
    env:
      GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
    steps:
      - uses: actions/checkout@v2

      - uses: actions/setup-node@v2-beta
        with:
          node-version: 12

      - name: Cache node modules
        id: cacheNodeModules
        uses: actions/cache@v2
        with:
          path: '**/node_modules'
          key: ${{ runner.os }}-cacheNodeModules-${{ hashFiles('.yarnrc', 'remote/.yarnrc', '**/yarn.lock', '!**/node_modules/**/yarn.lock', '!**/.*/**/yarn.lock') }}
          restore-keys: ${{ runner.os }}-cacheNodeModules-
      - name: Execute yarn
463
        if: ${{ steps.cacheNodeModules.outputs.cache-hit != 'true' }}
A
Alexandru Dima 已提交
464 465 466 467 468 469 470
        env:
          PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
        run: yarn --frozen-lockfile

      - name: Compile and Download
        run: yarn concurrently --max_old_space_size=4095 --names "compile,electron,playwright,builtin-extensions" "yarn compile" "yarn electron x64" "node ./node_modules/playwright/install.js" "yarn download-builtin-extensions"

A
Alexandru Dima 已提交
471 472 473 474 475 476 477 478
      - name: Run Unit Tests (Electron)
        run: DISPLAY=:10 ./scripts/test.sh

      - name: Run Unit Tests (Browser)
        run: DISPLAY=:10 yarn test-browser --browser chromium

      - name: Run Integration Tests (Electron)
        run: DISPLAY=:10 ./scripts/test-integration.sh
479 480

  monaco:
A
Alexandru Dima 已提交
481
    name: Monaco Editor
482
    runs-on: ubuntu-latest
483 484 485
    env:
      GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
    steps:
A
Alex Dima 已提交
486
      - uses: actions/checkout@v2
487

A
Alex Dima 已提交
488
      - uses: actions/setup-node@v2-beta
J
João Moreno 已提交
489
        with:
A
Alex Dima 已提交
490
          node-version: 12
491

492 493 494 495 496 497 498 499
      - name: Cache node modules
        id: cacheNodeModules
        uses: actions/cache@v2
        with:
          path: '**/node_modules'
          key: ${{ runner.os }}-cacheNodeModules-${{ hashFiles('.yarnrc', 'remote/.yarnrc', '**/yarn.lock', '!**/node_modules/**/yarn.lock', '!**/.*/**/yarn.lock') }}
          restore-keys: ${{ runner.os }}-cacheNodeModules-
      - name: Execute yarn
500
        if: ${{ steps.cacheNodeModules.outputs.cache-hit != 'true' }}
501 502 503
        env:
          PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
        run: yarn --frozen-lockfile
504

505 506 507 508 509
      - name: Run Monaco Editor Checks
        run: yarn monaco-compile-check

      - name: Editor Distro & ESM Bundle
        run: yarn gulp editor-esm-bundle