|
| 1 | +name: "🧪 E2E Tests: Webapp" |
| 2 | + |
| 3 | +permissions: |
| 4 | + contents: read |
| 5 | + |
| 6 | +on: |
| 7 | + workflow_call: |
| 8 | + |
| 9 | +jobs: |
| 10 | + e2eTests: |
| 11 | + name: "🧪 E2E Tests: Webapp" |
| 12 | + runs-on: ubuntu-latest |
| 13 | + timeout-minutes: 20 |
| 14 | + env: |
| 15 | + DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} |
| 16 | + steps: |
| 17 | + - name: 🔧 Disable IPv6 |
| 18 | + run: | |
| 19 | + sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1 |
| 20 | + sudo sysctl -w net.ipv6.conf.default.disable_ipv6=1 |
| 21 | + sudo sysctl -w net.ipv6.conf.lo.disable_ipv6=1 |
| 22 | +
|
| 23 | + - name: 🔧 Configure docker address pool |
| 24 | + run: | |
| 25 | + CONFIG='{ |
| 26 | + "default-address-pools" : [ |
| 27 | + { |
| 28 | + "base" : "172.17.0.0/12", |
| 29 | + "size" : 20 |
| 30 | + }, |
| 31 | + { |
| 32 | + "base" : "192.168.0.0/16", |
| 33 | + "size" : 24 |
| 34 | + } |
| 35 | + ] |
| 36 | + }' |
| 37 | + mkdir -p /etc/docker |
| 38 | + echo "$CONFIG" | sudo tee /etc/docker/daemon.json |
| 39 | +
|
| 40 | + - name: 🔧 Restart docker daemon |
| 41 | + run: sudo systemctl restart docker |
| 42 | + |
| 43 | + - name: ⬇️ Checkout repo |
| 44 | + uses: actions/checkout@v4 |
| 45 | + with: |
| 46 | + fetch-depth: 0 |
| 47 | + |
| 48 | + - name: ⎔ Setup pnpm |
| 49 | + uses: pnpm/action-setup@v4 |
| 50 | + with: |
| 51 | + version: 10.23.0 |
| 52 | + |
| 53 | + - name: ⎔ Setup node |
| 54 | + uses: buildjet/setup-node@v4 |
| 55 | + with: |
| 56 | + node-version: 20.20.0 |
| 57 | + cache: "pnpm" |
| 58 | + |
| 59 | + # ..to avoid rate limits when pulling images |
| 60 | + - name: 🐳 Login to DockerHub |
| 61 | + if: ${{ env.DOCKERHUB_USERNAME }} |
| 62 | + uses: docker/login-action@v3 |
| 63 | + with: |
| 64 | + username: ${{ secrets.DOCKERHUB_USERNAME }} |
| 65 | + password: ${{ secrets.DOCKERHUB_TOKEN }} |
| 66 | + - name: 🐳 Skipping DockerHub login (no secrets available) |
| 67 | + if: ${{ !env.DOCKERHUB_USERNAME }} |
| 68 | + run: echo "DockerHub login skipped because secrets are not available." |
| 69 | + |
| 70 | + - name: 🐳 Pre-pull testcontainer images |
| 71 | + if: ${{ env.DOCKERHUB_USERNAME }} |
| 72 | + run: | |
| 73 | + echo "Pre-pulling Docker images with authenticated session..." |
| 74 | + docker pull postgres:14 |
| 75 | + docker pull redis:7.2 |
| 76 | + docker pull testcontainers/ryuk:0.11.0 |
| 77 | + echo "Image pre-pull complete" |
| 78 | +
|
| 79 | + - name: 📥 Download deps |
| 80 | + run: pnpm install --frozen-lockfile |
| 81 | + |
| 82 | + - name: 📀 Generate Prisma Client |
| 83 | + run: pnpm run generate |
| 84 | + |
| 85 | + - name: 🏗️ Build Webapp |
| 86 | + run: pnpm run build --filter webapp |
| 87 | + |
| 88 | + - name: 🧪 Run Webapp E2E Tests |
| 89 | + run: cd apps/webapp && pnpm exec vitest run --config vitest.e2e.config.ts --reporter=default |
| 90 | + env: |
| 91 | + WEBAPP_TEST_VERBOSE: "1" |
0 commit comments