|
| 1 | +name: E2E Docker Tests |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + push: |
| 6 | + branches: [main] |
| 7 | + |
| 8 | +jobs: |
| 9 | + e2e-docker: |
| 10 | + runs-on: ubuntu-latest |
| 11 | + services: |
| 12 | + postgres: |
| 13 | + image: postgres:16-alpine |
| 14 | + env: |
| 15 | + POSTGRES_USER: testuser |
| 16 | + POSTGRES_PASSWORD: testpass |
| 17 | + POSTGRES_DB: testdb |
| 18 | + ports: |
| 19 | + - 5432:5432 |
| 20 | + options: >- |
| 21 | + --health-cmd "pg_isready -U testuser -d testdb" |
| 22 | + --health-interval 5s |
| 23 | + --health-timeout 5s |
| 24 | + --health-retries 5 |
| 25 | + mysql: |
| 26 | + image: mysql:8.0 |
| 27 | + env: |
| 28 | + MYSQL_ROOT_PASSWORD: rootpass |
| 29 | + MYSQL_DATABASE: testdb |
| 30 | + MYSQL_USER: testuser |
| 31 | + MYSQL_PASSWORD: testpass |
| 32 | + ports: |
| 33 | + - 3306:3306 |
| 34 | + options: >- |
| 35 | + --health-cmd "mysql -u testuser -ptestpass -e 'SELECT 1'" |
| 36 | + --health-interval 10s |
| 37 | + --health-timeout 5s |
| 38 | + --health-retries 10 |
| 39 | + --health-start-period 30s |
| 40 | + redis: |
| 41 | + image: redis:7-alpine |
| 42 | + ports: |
| 43 | + - 6379:6379 |
| 44 | + options: >- |
| 45 | + --health-cmd "redis-cli ping" |
| 46 | + --health-interval 5s |
| 47 | + --health-timeout 5s |
| 48 | + --health-retries 5 |
| 49 | + steps: |
| 50 | + - uses: actions/checkout@v4 |
| 51 | + |
| 52 | + - name: Set up pnpm |
| 53 | + uses: pnpm/action-setup@v4 |
| 54 | + with: |
| 55 | + version: 8.15.6 |
| 56 | + |
| 57 | + - name: Set up Node.js |
| 58 | + uses: actions/setup-node@v4 |
| 59 | + with: |
| 60 | + node-version: 22 |
| 61 | + cache: pnpm |
| 62 | + cache-dependency-path: pnpm-lock.yaml |
| 63 | + |
| 64 | + - name: Install dependencies |
| 65 | + run: pnpm install --frozen-lockfile |
| 66 | + |
| 67 | + - name: Build |
| 68 | + run: pnpm turbo build |
| 69 | + |
| 70 | + - name: Build SSH test image |
| 71 | + run: docker build -t secure-exec-test-sshd -f packages/secure-exec/tests/e2e-docker/dockerfiles/sshd.Dockerfile packages/secure-exec/tests/e2e-docker/dockerfiles/ |
| 72 | + |
| 73 | + - name: Start SSH container |
| 74 | + run: | |
| 75 | + docker run -d --name test-sshd -p 2222:22 secure-exec-test-sshd |
| 76 | + for i in $(seq 1 30); do |
| 77 | + docker exec test-sshd sh -c "ss -tlnp | grep -q :22" && break || sleep 1 |
| 78 | + done |
| 79 | +
|
| 80 | + - name: Run e2e Docker tests |
| 81 | + run: pnpm --filter secure-exec vitest run tests/e2e-docker.test.ts |
| 82 | + env: |
| 83 | + PG_HOST: 127.0.0.1 |
| 84 | + PG_PORT: "5432" |
| 85 | + MYSQL_HOST: 127.0.0.1 |
| 86 | + MYSQL_PORT: "3306" |
| 87 | + REDIS_HOST: 127.0.0.1 |
| 88 | + REDIS_PORT: "6379" |
| 89 | + SSH_HOST: 127.0.0.1 |
| 90 | + SSH_PORT: "2222" |
| 91 | + E2E_DOCKER_CI: "true" |
| 92 | + |
| 93 | + - name: Stop SSH container |
| 94 | + if: always() |
| 95 | + run: docker rm -f test-sshd || true |
0 commit comments