microsoft/TypeAgent

Public

mirrored fromhttps://github.com/microsoft/TypeAgentAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
copilot/remove-deprecated-dependencies

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

.github/workflows/smoke-tests.yml

163lines · modecode

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