microsoft/TypeAgent
Publicmirrored fromhttps://github.com/microsoft/TypeAgentAvailable
.github/workflows/build-ts.yml
84lines · 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 | |
| 6 | name: build-ts |
| 7 | |
| 8 | on: |
| 9 | workflow_dispatch: |
| 10 | push: |
| 11 | branches: ["main"] |
| 12 | pull_request: |
| 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 | |
| 29 | jobs: |
| 30 | build_ts: |
| 31 | strategy: |
| 32 | fail-fast: false |
| 33 | matrix: |
| 34 | os: ["ubuntu-latest", "windows-latest", "macos-latest"] |
| 35 | version: [20, 22] |
| 36 | |
| 37 | runs-on: ${{ matrix.os }} |
| 38 | steps: |
| 39 | - if: runner.os == 'Linux' |
| 40 | run: | |
| 41 | sudo apt install libsecret-1-0 |
| 42 | - name: Setup Git LF |
| 43 | run: | |
| 44 | git config --global core.autocrlf false |
| 45 | - uses: actions/checkout@v4 |
| 46 | - uses: dorny/paths-filter@v3 |
| 47 | id: filter |
| 48 | continue-on-error: true |
| 49 | with: |
| 50 | filters: | |
| 51 | ts: |
| 52 | - "ts/**" |
| 53 | - ".github/workflows/build-ts.yml" |
| 54 | - uses: pnpm/action-setup@v4 |
| 55 | if: ${{ github.event_name != 'pull_request' || steps.filter.outputs.ts != 'false' }} |
| 56 | name: Install pnpm |
| 57 | with: |
| 58 | package_json_file: ts/package.json |
| 59 | - uses: actions/setup-node@v4 |
| 60 | if: ${{ github.event_name != 'pull_request' || steps.filter.outputs.ts != 'false' }} |
| 61 | with: |
| 62 | node-version: ${{ matrix.version }} |
| 63 | cache: "pnpm" |
| 64 | cache-dependency-path: ts/pnpm-lock.yaml |
| 65 | - name: Install dependencies |
| 66 | if: ${{ github.event_name != 'pull_request' || steps.filter.outputs.ts != 'false' }} |
| 67 | working-directory: ts |
| 68 | run: | |
| 69 | pnpm install --frozen-lockfile --strict-peer-dependencies |
| 70 | - name: Build |
| 71 | if: ${{ github.event_name != 'pull_request' || steps.filter.outputs.ts != 'false' }} |
| 72 | working-directory: ts |
| 73 | run: | |
| 74 | npm run build |
| 75 | - name: Lint |
| 76 | if: ${{ github.event_name != 'pull_request' || steps.filter.outputs.ts != 'false' }} |
| 77 | working-directory: ts |
| 78 | run: | |
| 79 | npm run lint |
| 80 | - name: Test |
| 81 | if: ${{ github.event_name != 'pull_request' || steps.filter.outputs.ts != 'false' }} |
| 82 | working-directory: ts |
| 83 | run: | |
| 84 | npm run test:local |
| 85 | |