|
| 1 | +name: "🐳 Testcontainers" |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_call: |
| 5 | + workflow_dispatch: |
| 6 | + push: |
| 7 | + |
| 8 | +jobs: |
| 9 | + unitTests: |
| 10 | + name: "🧪 Unit Tests (run ${{ matrix.run }})" |
| 11 | + runs-on: ubuntu-latest |
| 12 | + strategy: |
| 13 | + fail-fast: false |
| 14 | + matrix: |
| 15 | + run: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20] |
| 16 | + steps: |
| 17 | + - name: 🔧 Configure docker address pool |
| 18 | + run: | |
| 19 | + CONFIG='{ |
| 20 | + "default-address-pools" : [ |
| 21 | + { |
| 22 | + "base" : "172.17.0.0/12", |
| 23 | + "size" : 20 |
| 24 | + }, |
| 25 | + { |
| 26 | + "base" : "192.168.0.0/16", |
| 27 | + "size" : 24 |
| 28 | + } |
| 29 | + ] |
| 30 | + }' |
| 31 | + mkdir -p /etc/docker |
| 32 | + echo "$CONFIG" | sudo tee /etc/docker/daemon.json |
| 33 | + sudo systemctl restart docker |
| 34 | +
|
| 35 | + - name: ⬇️ Checkout repo |
| 36 | + uses: actions/checkout@v4 |
| 37 | + with: |
| 38 | + fetch-depth: 0 |
| 39 | + |
| 40 | + - name: ⎔ Setup pnpm |
| 41 | + uses: pnpm/action-setup@v4 |
| 42 | + with: |
| 43 | + version: 8.15.5 |
| 44 | + |
| 45 | + - name: ⎔ Setup node |
| 46 | + uses: buildjet/setup-node@v4 |
| 47 | + with: |
| 48 | + node-version: 20.11.1 |
| 49 | + cache: "pnpm" |
| 50 | + |
| 51 | + # ..to avoid rate limits when pulling images |
| 52 | + - name: 🐳 Login to DockerHub |
| 53 | + uses: docker/login-action@v3 |
| 54 | + with: |
| 55 | + username: ${{ secrets.DOCKERHUB_USERNAME }} |
| 56 | + password: ${{ secrets.DOCKERHUB_TOKEN }} |
| 57 | + |
| 58 | + - name: 📥 Download deps |
| 59 | + run: pnpm install --frozen-lockfile |
| 60 | + |
| 61 | + - name: 📀 Generate Prisma Client |
| 62 | + run: pnpm run generate |
| 63 | + |
| 64 | + - name: 🧪 Run Webapp Unit Tests |
| 65 | + run: pnpm run test:webapp |
| 66 | + env: |
| 67 | + DATABASE_URL: postgresql://postgres:postgres@localhost:5432/postgres |
| 68 | + DIRECT_URL: postgresql://postgres:postgres@localhost:5432/postgres |
| 69 | + SESSION_SECRET: "secret" |
| 70 | + MAGIC_LINK_SECRET: "secret" |
| 71 | + ENCRYPTION_KEY: "secret" |
| 72 | + |
| 73 | + - name: 🧪 Run Package Unit Tests |
| 74 | + run: pnpm run test:packages |
| 75 | + |
| 76 | + - name: 🧪 Run Internal Unit Tests |
| 77 | + run: pnpm run test:internal |
0 commit comments