|
1 | 1 | name: CI |
| 2 | +permissions: |
| 3 | + contents: read |
2 | 4 |
|
3 | 5 | on: |
4 | 6 | push: |
5 | | - branches: |
6 | | - - main |
| 7 | + branches: [main] |
7 | 8 | pull_request: |
| 9 | + branches: [main] |
8 | 10 |
|
9 | | -permissions: |
10 | | - actions: read |
11 | | - contents: read |
| 11 | +env: |
| 12 | + NX_NON_NATIVE_HASHER: true |
12 | 13 |
|
13 | 14 | jobs: |
14 | | - main: |
| 15 | + format: |
15 | 16 | runs-on: ubuntu-latest |
| 17 | + name: Format check |
16 | 18 | steps: |
17 | | - - uses: actions/checkout@v4 |
| 19 | + - name: Checkout repository |
| 20 | + uses: actions/checkout@v4 |
18 | 21 | with: |
19 | 22 | fetch-depth: 0 |
| 23 | + - name: Set up Node.js |
| 24 | + uses: actions/setup-node@v4 |
| 25 | + with: |
| 26 | + node-version-file: .node-version |
| 27 | + cache: npm |
| 28 | + - name: Set base and head for Nx affected commands |
| 29 | + uses: nrwl/nx-set-shas@v4 |
| 30 | + - name: Install dependencies |
| 31 | + run: npm ci |
| 32 | + - name: Check formatting of affected files |
| 33 | + run: npx nx format:check |
20 | 34 |
|
21 | | - # Connect your workspace on nx.app and uncomment this to enable task distribution. |
22 | | - # The "--stop-agents-after" is optional, but allows idle agents to shut down once the "build" targets have been requested |
23 | | - # - run: npx nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build" |
| 35 | + lint: |
| 36 | + runs-on: ubuntu-latest |
| 37 | + name: Linter |
| 38 | + steps: |
| 39 | + - name: Checkout repository |
| 40 | + uses: actions/checkout@v4 |
| 41 | + with: |
| 42 | + fetch-depth: 0 |
| 43 | + - name: Set up Node.js |
| 44 | + uses: actions/setup-node@v4 |
| 45 | + with: |
| 46 | + node-version-file: .node-version |
| 47 | + cache: npm |
| 48 | + - name: Set base and head for Nx affected commands |
| 49 | + uses: nrwl/nx-set-shas@v4 |
| 50 | + - name: Install dependencies |
| 51 | + run: npm ci |
| 52 | + - name: Lint affected projects |
| 53 | + run: npx nx affected -t lint --parallel=3 |
24 | 54 |
|
25 | | - # Cache node_modules |
26 | | - - uses: actions/setup-node@v3 |
| 55 | + unit-test: |
| 56 | + strategy: |
| 57 | + fail-fast: false |
| 58 | + matrix: |
| 59 | + os: [ubuntu-latest, windows-latest, macos-latest] |
| 60 | + name: Unit tests |
| 61 | + runs-on: ${{ matrix.os }} |
| 62 | + steps: |
| 63 | + - name: Checkout repository |
| 64 | + uses: actions/checkout@v4 |
27 | 65 | with: |
28 | | - node-version: 20 |
29 | | - cache: 'npm' |
30 | | - - run: npm ci |
31 | | - - uses: nrwl/nx-set-shas@v4 |
| 66 | + fetch-depth: 0 |
| 67 | + - name: Set up Node.js |
| 68 | + uses: actions/setup-node@v4 |
| 69 | + with: |
| 70 | + node-version-file: .node-version |
| 71 | + cache: npm |
| 72 | + - name: Set base and head for Nx affected commands |
| 73 | + uses: nrwl/nx-set-shas@v4 |
| 74 | + - name: Install dependencies |
| 75 | + run: npm ci |
| 76 | + - name: Unit test affected projects |
| 77 | + run: npx nx affected -t unit-test --parallel=3 |
32 | 78 |
|
33 | | - - run: git branch --track main origin/main |
34 | | - if: ${{ github.event_name == 'pull_request' }} |
| 79 | + integration-test: |
| 80 | + strategy: |
| 81 | + fail-fast: false |
| 82 | + matrix: |
| 83 | + os: [ubuntu-latest, windows-latest, macos-latest] |
| 84 | + name: Integration tests |
| 85 | + runs-on: ${{ matrix.os }} |
| 86 | + steps: |
| 87 | + - name: Checkout repository |
| 88 | + uses: actions/checkout@v4 |
| 89 | + with: |
| 90 | + fetch-depth: 0 |
| 91 | + - name: Set up Node.js |
| 92 | + uses: actions/setup-node@v4 |
| 93 | + with: |
| 94 | + node-version-file: .node-version |
| 95 | + cache: npm |
| 96 | + - name: Set base and head for Nx affected commands |
| 97 | + uses: nrwl/nx-set-shas@v4 |
| 98 | + - name: Install dependencies |
| 99 | + run: npm ci |
| 100 | + - name: Integration test affected projects |
| 101 | + run: npx nx affected -t int-test --parallel=3 |
35 | 102 |
|
36 | | - - run: npx nx format:check |
37 | | - - run: npx nx affected -t lint unit-test int-test e2e-test build |
| 103 | + e2e: |
| 104 | + strategy: |
| 105 | + fail-fast: false |
| 106 | + matrix: |
| 107 | + os: [ubuntu-latest, windows-latest, macos-latest] |
| 108 | + name: E2E tests |
| 109 | + runs-on: ${{ matrix.os }} |
| 110 | + steps: |
| 111 | + - name: Checkout repository |
| 112 | + uses: actions/checkout@v4 |
| 113 | + with: |
| 114 | + fetch-depth: 0 |
| 115 | + - name: Set up Node.js |
| 116 | + uses: actions/setup-node@v4 |
| 117 | + with: |
| 118 | + node-version-file: .node-version |
| 119 | + cache: npm |
| 120 | + - name: Set base and head for Nx affected commands |
| 121 | + uses: nrwl/nx-set-shas@v4 |
| 122 | + - name: Install dependencies |
| 123 | + run: npm ci |
| 124 | + - name: E2E test affected projects |
| 125 | + run: npx nx affected -t e2e-test --parallel=1 |
| 126 | + |
| 127 | + build: |
| 128 | + runs-on: ubuntu-latest |
| 129 | + name: Build |
| 130 | + steps: |
| 131 | + - name: Checkout repository |
| 132 | + uses: actions/checkout@v4 |
| 133 | + with: |
| 134 | + fetch-depth: 0 |
| 135 | + - name: Set up Node.js |
| 136 | + uses: actions/setup-node@v4 |
| 137 | + with: |
| 138 | + node-version-file: .node-version |
| 139 | + cache: npm |
| 140 | + - name: Set base and head for Nx affected commands |
| 141 | + uses: nrwl/nx-set-shas@v4 |
| 142 | + - name: Install dependencies |
| 143 | + run: npm ci |
| 144 | + - name: Build all projects # affected is not used to be able to test-release packages |
| 145 | + run: npx nx run-many --target=build --parallel=3 |
| 146 | + #- name: Test-release packages |
| 147 | + # run: npx pkg-pr-new publish "packages/**/dist" |
0 commit comments