|
8 | 8 | push:
|
9 | 9 |
|
10 | 10 | jobs:
|
11 |
| - unitTests: |
12 |
| - name: "🧪 Unit Tests" |
13 |
| - runs-on: ubuntu-latest |
14 |
| - strategy: |
15 |
| - matrix: |
16 |
| - shardIndex: [1, 2, 3, 4, 5] |
17 |
| - shardTotal: [5] |
18 |
| - env: |
19 |
| - DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} |
20 |
| - SHARD_INDEX: ${{ matrix.shardIndex }} |
21 |
| - SHARD_TOTAL: ${{ matrix.shardTotal }} |
22 |
| - steps: |
23 |
| - - name: 🔧 Disable IPv6 |
24 |
| - run: | |
25 |
| - sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1 |
26 |
| - sudo sysctl -w net.ipv6.conf.default.disable_ipv6=1 |
27 |
| - sudo sysctl -w net.ipv6.conf.lo.disable_ipv6=1 |
28 |
| -
|
29 |
| - - name: 🔧 Configure docker address pool |
30 |
| - run: | |
31 |
| - CONFIG='{ |
32 |
| - "default-address-pools" : [ |
33 |
| - { |
34 |
| - "base" : "172.17.0.0/12", |
35 |
| - "size" : 20 |
36 |
| - }, |
37 |
| - { |
38 |
| - "base" : "192.168.0.0/16", |
39 |
| - "size" : 24 |
40 |
| - } |
41 |
| - ] |
42 |
| - }' |
43 |
| - mkdir -p /etc/docker |
44 |
| - echo "$CONFIG" | sudo tee /etc/docker/daemon.json |
45 |
| -
|
46 |
| - - name: 🔧 Restart docker daemon |
47 |
| - run: sudo systemctl restart docker |
48 |
| - |
49 |
| - - name: ⬇️ Checkout repo |
50 |
| - uses: actions/checkout@v4 |
51 |
| - with: |
52 |
| - fetch-depth: 0 |
53 |
| - |
54 |
| - - name: ⎔ Setup pnpm |
55 |
| - uses: pnpm/action-setup@v4 |
56 |
| - with: |
57 |
| - version: 8.15.5 |
58 |
| - |
59 |
| - - name: ⎔ Setup node |
60 |
| - uses: buildjet/setup-node@v4 |
61 |
| - with: |
62 |
| - node-version: 20.11.1 |
63 |
| - cache: "pnpm" |
64 |
| - |
65 |
| - # ..to avoid rate limits when pulling images |
66 |
| - - name: 🐳 Login to DockerHub |
67 |
| - if: ${{ env.DOCKERHUB_USERNAME }} |
68 |
| - uses: docker/login-action@v3 |
69 |
| - with: |
70 |
| - username: ${{ secrets.DOCKERHUB_USERNAME }} |
71 |
| - password: ${{ secrets.DOCKERHUB_TOKEN }} |
72 |
| - - name: 🐳 Skipping DockerHub login (no secrets available) |
73 |
| - if: ${{ !env.DOCKERHUB_USERNAME }} |
74 |
| - run: echo "DockerHub login skipped because secrets are not available." |
75 |
| - |
76 |
| - - name: 📥 Download deps |
77 |
| - run: pnpm install --frozen-lockfile |
78 |
| - |
79 |
| - - name: 📀 Generate Prisma Client |
80 |
| - run: pnpm run generate |
81 |
| - |
82 |
| - - name: 🧪 Run Webapp Unit Tests |
83 |
| - run: pnpm run test:webapp --reporter=default --reporter=blob --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }} |
84 |
| - env: |
85 |
| - DATABASE_URL: postgresql://postgres:postgres@localhost:5432/postgres |
86 |
| - DIRECT_URL: postgresql://postgres:postgres@localhost:5432/postgres |
87 |
| - SESSION_SECRET: "secret" |
88 |
| - MAGIC_LINK_SECRET: "secret" |
89 |
| - ENCRYPTION_KEY: "secret" |
90 |
| - |
91 |
| - - name: 🧪 Run Package Unit Tests |
92 |
| - run: pnpm run test:packages --reporter=default --reporter=blob --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }} |
93 |
| - |
94 |
| - - name: 🧪 Run Internal Unit Tests |
95 |
| - run: pnpm run test:internal --reporter=default --reporter=blob --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }} |
96 |
| - |
97 |
| - - name: Gather all reports |
98 |
| - run: | |
99 |
| - mkdir -p .vitest-reports |
100 |
| - find . -type f -path '*/.vitest-reports/blob-*.json' \ |
101 |
| - -exec bash -c 'src="$1"; basename=$(basename "$src"); pkg=$(dirname "$src" | sed "s|^\./||;s|/\.vitest-reports$||;s|/|_|g"); cp "$src" ".vitest-reports/${pkg}-${basename}"' _ {} \; |
102 |
| -
|
103 |
| - - name: Upload blob reports to GitHub Actions Artifacts |
104 |
| - if: ${{ !cancelled() }} |
105 |
| - uses: actions/upload-artifact@v4 |
106 |
| - with: |
107 |
| - name: blob-report-${{ matrix.shardIndex }} |
108 |
| - path: .vitest-reports/* |
109 |
| - include-hidden-files: true |
110 |
| - retention-days: 1 |
111 |
| - |
112 |
| - merge-reports: |
113 |
| - if: ${{ !cancelled() }} |
114 |
| - needs: [unitTests] |
115 |
| - runs-on: ubuntu-latest |
116 |
| - steps: |
117 |
| - - name: ⬇️ Checkout repo |
118 |
| - uses: actions/checkout@v4 |
119 |
| - with: |
120 |
| - fetch-depth: 0 |
121 |
| - |
122 |
| - - name: ⎔ Setup pnpm |
123 |
| - uses: pnpm/action-setup@v4 |
124 |
| - with: |
125 |
| - version: 8.15.5 |
126 |
| - |
127 |
| - - name: ⎔ Setup node |
128 |
| - uses: buildjet/setup-node@v4 |
129 |
| - with: |
130 |
| - node-version: 20.11.1 |
131 |
| - cache: "pnpm" |
132 |
| - |
133 |
| - - name: 📥 Download deps |
134 |
| - run: pnpm install --frozen-lockfile |
135 |
| - |
136 |
| - - name: Download blob reports from GitHub Actions Artifacts |
137 |
| - uses: actions/download-artifact@v4 |
138 |
| - with: |
139 |
| - path: .vitest-reports |
140 |
| - pattern: blob-report-* |
141 |
| - merge-multiple: true |
142 |
| - |
143 |
| - - name: Merge reports |
144 |
| - run: npx vitest run --merge-reports |
| 11 | + webapp: |
| 12 | + uses: ./.github/workflows/unit-tests/webapp.yml |
| 13 | + secrets: inherit |
| 14 | + packages: |
| 15 | + uses: ./.github/workflows/unit-tests/packages.yml |
| 16 | + secrets: inherit |
| 17 | + internal: |
| 18 | + uses: ./.github/workflows/unit-tests/internal.yml |
| 19 | + secrets: inherit |
0 commit comments