microsoft/TypeAgent

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
copilot/fix-github-actions-job-shell-and-cli

Branches

Tags

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

Clone

HTTPS

Download ZIP

.github/workflows/build-ts.yml

102lines · modecode

1# Copyright (c) Microsoft Corporation.
2# Licensed under the MIT License.
3
4# This workflow will build and test the TypeAgent TypeScript code
5
6name: build-ts
7
8on:
9 workflow_dispatch:
10 push:
11 branches: ["main"]
12 pull_request:
13 branches: ["main"]
14 merge_group:
15 branches: ["main"]
16
17concurrency:
18 group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
19 cancel-in-progress: true
20
21permissions:
22 pull-requests: read
23 contents: read
24 id-token: write
25
26env:
27 NODE_OPTIONS: --max_old_space_size=8192
28
29jobs:
30 build_ts:
31 strategy:
32 fail-fast: false
33 matrix:
34 os: ["ubuntu-latest", "windows-latest", "macos-latest"]
35 version: [22, 24]
36
37 runs-on: ${{ matrix.os }}
38 steps:
39 - if: runner.os == 'Linux'
40 run: |
41 sudo apt-get install -y libsecret-1-dev
42 - name: Setup Git LF
43 run: |
44 git config --global core.autocrlf false
45 - uses: actions/checkout@v4
46 with:
47 # Full history so the changed-files lint can diff against the base.
48 fetch-depth: 0
49 - uses: dorny/paths-filter@v3
50 id: filter
51 continue-on-error: true
52 with:
53 filters: |
54 ts:
55 - "ts/**"
56 - ".github/workflows/build-ts.yml"
57 - uses: pnpm/action-setup@v4
58 if: ${{ github.event_name != 'pull_request' || steps.filter.outputs.ts != 'false' }}
59 name: Install pnpm
60 with:
61 package_json_file: ts/package.json
62 - uses: actions/setup-node@v4
63 if: ${{ github.event_name != 'pull_request' || steps.filter.outputs.ts != 'false' }}
64 with:
65 node-version: ${{ matrix.version }}
66 cache: "pnpm"
67 cache-dependency-path: ts/pnpm-lock.yaml
68 - name: Install dependencies
69 if: ${{ github.event_name != 'pull_request' || steps.filter.outputs.ts != 'false' }}
70 working-directory: ts
71 run: |
72 pnpm install --frozen-lockfile --strict-peer-dependencies
73 - name: Build
74 if: ${{ github.event_name != 'pull_request' || steps.filter.outputs.ts != 'false' }}
75 working-directory: ts
76 run: |
77 npm run build
78 # On pull requests only changed files are checked (fast); the
79 # format-pr workflow auto-fixes them. Other events check the whole repo.
80 - name: Lint
81 if: ${{ github.event_name != 'pull_request' || steps.filter.outputs.ts != 'false' }}
82 working-directory: ts
83 shell: bash
84 run: |
85 if [ "${{ github.event_name }}" = "pull_request" ]; then
86 git fetch --no-tags origin "${{ github.base_ref }}"
87 node tools/scripts/prettier-changed.mjs --base "origin/${{ github.base_ref }}"
88 else
89 npm run lint
90 fi
91 - name: Test
92 if: ${{ github.event_name != 'pull_request' || steps.filter.outputs.ts != 'false' }}
93 working-directory: ts
94 run: |
95 npm run test:local
96 - name: UI tests (requires display)
97 if: ${{ (github.event_name != 'pull_request' || steps.filter.outputs.ts != 'false') && runner.os == 'Linux' }}
98 working-directory: ts
99 run: |
100 Xvfb :99 -screen 0 1600x1200x24 &
101 export DISPLAY=:99
102 npm run test:ui
103