microsoft/TypeAgent
Publicmirrored fromhttps://github.com/microsoft/TypeAgentAvailable
.github/workflows/smoke-tests.yml
161lines · modecode
| 1 | # Copyright (c) Microsoft Corporation. |
| 2 | # Licensed under the MIT License. |
| 3 | |
| 4 | # This workflow runs live/smoke sanity tests |
| 5 | |
| 6 | name: smoke-tests |
| 7 | |
| 8 | on: |
| 9 | workflow_dispatch: |
| 10 | push: |
| 11 | branches: ["main"] |
| 12 | pull_request_target: |
| 13 | branches: ["main"] |
| 14 | merge_group: |
| 15 | branches: ["main"] |
| 16 | |
| 17 | concurrency: |
| 18 | group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} |
| 19 | cancel-in-progress: true |
| 20 | |
| 21 | permissions: |
| 22 | pull-requests: read |
| 23 | contents: read |
| 24 | id-token: write |
| 25 | |
| 26 | env: |
| 27 | NODE_OPTIONS: --max_old_space_size=8192 |
| 28 | # DEBUG: pw:browser* # PlayWright debug messages |
| 29 | # ELECTRON_ENABLE_LOGGING: true # Electron debug messages |
| 30 | # DEBUG: typeagent:* # TypeAgent debug messages |
| 31 | |
| 32 | jobs: |
| 33 | shell_and_cli: |
| 34 | #environment: ${{ github.event_name == 'pull_request_target' && 'development-fork' || 'development' }} # required for federated credentials |
| 35 | environment: development-fork |
| 36 | strategy: |
| 37 | fail-fast: false |
| 38 | matrix: |
| 39 | os: ["ubuntu-latest", "windows-latest"] |
| 40 | version: [22] |
| 41 | |
| 42 | runs-on: ${{ matrix.os }} |
| 43 | |
| 44 | steps: |
| 45 | # The following two steps (permissions checks) ensure that only users with write access can run this workflow on a PR (except the merge queue bot) |
| 46 | # PRs from forks we check the permissions of the user that triggered the workflow (github.triggering_actor) |
| 47 | # This means that if a user without write access opens a PR from a fork, they cannot run this workflow |
| 48 | # Users with write access can still run this workflow on a PR from a fork |
| 49 | # For PRs from the same repo, we allow the workflow to run as normal |
| 50 | - name: Get User Permission |
| 51 | if: ${{ github.event_name == 'pull_request_target' || github.triggering_actor != 'github-merge-queue[bot]' }} |
| 52 | id: checkAccess |
| 53 | uses: actions-cool/check-user-permission@v2 |
| 54 | with: |
| 55 | require: write |
| 56 | username: ${{ github.triggering_actor }} |
| 57 | env: |
| 58 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 59 | - name: Check User Permission |
| 60 | if: ${{ (github.event_name == 'pull_request_target' || github.triggering_actor != 'github-merge-queue[bot]') && steps.checkAccess.outputs.require-result == 'false' }} |
| 61 | run: | |
| 62 | echo "${{ github.triggering_actor }} does not have permissions on this repo." |
| 63 | echo "Current permission level is ${{ steps.checkAccess.outputs.user-permission }}" |
| 64 | echo "Job originally triggered by ${{ github.actor }}" |
| 65 | exit 1 |
| 66 | |
| 67 | - if: runner.os == 'Linux' |
| 68 | run: | |
| 69 | sudo apt install libsecret-1-0 |
| 70 | |
| 71 | - name: Setup Git LF |
| 72 | run: | |
| 73 | git config --global core.autocrlf false |
| 74 | |
| 75 | - name: Checkout code |
| 76 | uses: actions/checkout@v4 |
| 77 | with: |
| 78 | ref: ${{ github.event.pull_request.head.sha }} |
| 79 | |
| 80 | - uses: dorny/paths-filter@v3 |
| 81 | id: filter |
| 82 | continue-on-error: true |
| 83 | with: |
| 84 | filters: | |
| 85 | ts: |
| 86 | - "ts/**" |
| 87 | - ".github/workflows/build-ts.yml" |
| 88 | |
| 89 | - uses: pnpm/action-setup@v4 |
| 90 | name: Install pnpm |
| 91 | with: |
| 92 | package_json_file: ts/package.json |
| 93 | |
| 94 | - uses: actions/setup-node@v4 |
| 95 | with: |
| 96 | node-version: ${{ matrix.version }} |
| 97 | cache: "pnpm" |
| 98 | cache-dependency-path: ts/pnpm-lock.yaml |
| 99 | |
| 100 | - name: Install dependencies |
| 101 | working-directory: ts |
| 102 | run: | |
| 103 | pnpm install --frozen-lockfile --strict-peer-dependencies |
| 104 | |
| 105 | - name: Install Playwright Browsers |
| 106 | run: pnpm exec playwright install --with-deps |
| 107 | working-directory: ts/packages/shell |
| 108 | |
| 109 | - name: Build |
| 110 | working-directory: ts |
| 111 | run: | |
| 112 | npm run build |
| 113 | |
| 114 | - name: Login to Azure |
| 115 | uses: azure/login@v2.2.0 |
| 116 | with: |
| 117 | client-id: ${{ secrets.AZUREAPPSERVICE_CLIENTID_5B0D2D6BA40F4710B45721D2112356DD }} |
| 118 | tenant-id: ${{ secrets.AZUREAPPSERVICE_TENANTID_39BB903136F14B6EAD8F53A8AB78E3AA }} |
| 119 | subscription-id: ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_F36C1F2C4B2C49CA8DD5C52FAB98FA30 }} |
| 120 | |
| 121 | - name: Get Keys |
| 122 | run: | |
| 123 | node tools/scripts/getKeys.mjs --vault build-pipeline-kv |
| 124 | working-directory: ts |
| 125 | |
| 126 | - name: Test CLI - smoke |
| 127 | run: | |
| 128 | npm run start:dev 'prompt' 'why is the sky blue' |
| 129 | working-directory: ts/packages/cli |
| 130 | continue-on-error: true |
| 131 | |
| 132 | - name: Shell Tests - smoke (windows) |
| 133 | if: ${{ runner.os == 'windows' }} |
| 134 | timeout-minutes: 60 |
| 135 | run: | |
| 136 | npm run shell:smoke |
| 137 | working-directory: ts/packages/shell |
| 138 | continue-on-error: true |
| 139 | |
| 140 | - name: Shell Tests - smoke (linux) |
| 141 | if: ${{ runner.os == 'Linux' }} |
| 142 | timeout-minutes: 60 |
| 143 | run: | |
| 144 | Xvfb :99 -screen 0 1600x1200x24 & export DISPLAY=:99 |
| 145 | npm run shell:smoke |
| 146 | working-directory: ts/packages/shell |
| 147 | continue-on-error: true |
| 148 | |
| 149 | - name: Live Tests |
| 150 | if: ${{ runner.os == 'windows' }} |
| 151 | timeout-minutes: 60 |
| 152 | run: | |
| 153 | npm run test:live |
| 154 | working-directory: ts |
| 155 | continue-on-error: true |
| 156 | |
| 157 | - name: Clean up Keys |
| 158 | run: | |
| 159 | rm ./.env |
| 160 | working-directory: ts |
| 161 | if: always() |
| 162 | |