Merge pull request #14 from rivet-dev/ralph/e2e-docker-testing #2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: E2E Docker Tests | |
| on: | |
| pull_request: | |
| push: | |
| branches: [main] | |
| jobs: | |
| e2e-docker: | |
| runs-on: ubuntu-latest | |
| services: | |
| postgres: | |
| image: postgres:16-alpine | |
| env: | |
| POSTGRES_USER: testuser | |
| POSTGRES_PASSWORD: testpass | |
| POSTGRES_DB: testdb | |
| ports: | |
| - 5432:5432 | |
| options: >- | |
| --health-cmd "pg_isready -U testuser -d testdb" | |
| --health-interval 5s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| mysql: | |
| image: mysql:8.0 | |
| env: | |
| MYSQL_ROOT_PASSWORD: rootpass | |
| MYSQL_DATABASE: testdb | |
| MYSQL_USER: testuser | |
| MYSQL_PASSWORD: testpass | |
| ports: | |
| - 3306:3306 | |
| options: >- | |
| --health-cmd "mysql -u testuser -ptestpass -e 'SELECT 1'" | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 10 | |
| --health-start-period 30s | |
| redis: | |
| image: redis:7-alpine | |
| ports: | |
| - 6379:6379 | |
| options: >- | |
| --health-cmd "redis-cli ping" | |
| --health-interval 5s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: 8.15.6 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: pnpm | |
| cache-dependency-path: pnpm-lock.yaml | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Build | |
| run: pnpm turbo build | |
| - name: Build SSH test image | |
| 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/ | |
| - name: Start SSH container | |
| run: | | |
| docker run -d --name test-sshd -p 2222:22 secure-exec-test-sshd | |
| for i in $(seq 1 30); do | |
| docker exec test-sshd sh -c "ss -tlnp | grep -q :22" && break || sleep 1 | |
| done | |
| - name: Run e2e Docker tests | |
| run: pnpm --filter secure-exec vitest run tests/e2e-docker.test.ts | |
| env: | |
| PG_HOST: 127.0.0.1 | |
| PG_PORT: "5432" | |
| MYSQL_HOST: 127.0.0.1 | |
| MYSQL_PORT: "3306" | |
| REDIS_HOST: 127.0.0.1 | |
| REDIS_PORT: "6379" | |
| SSH_HOST: 127.0.0.1 | |
| SSH_PORT: "2222" | |
| E2E_DOCKER_CI: "true" | |
| - name: Stop SSH container | |
| if: always() | |
| run: docker rm -f test-sshd || true |