name: "Tests" on: pull_request: branches: - main - develop push: branches: - develop jobs: unit: name: "Unit tests" runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: denoland/setup-deno@v2 with: deno-version: v2.x - name: Install dependencies run: deno install - name: Run unit tests run: deno task test:unit integration: name: "Integration tests" runs-on: ubuntu-latest services: postgres: image: postgres:16 env: POSTGRES_DB: polympr_test POSTGRES_USER: test POSTGRES_PASSWORD: test ports: - 5432:5432 steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: node-version: "20" - uses: denoland/setup-deno@v2 with: deno-version: v2.x - name: Install dependencies run: npm install --ignore-scripts && deno install - name: Wait for postgres run: | until bash -c 'echo > /dev/tcp/localhost/5432' 2>/dev/null; do echo "Waiting for postgres..." sleep 2 done - name: Apply migrations env: POSTGRES_HOST: localhost POSTGRES_PORT: 5432 POSTGRES_USER: test POSTGRES_PASS: test POSTGRES_DB: polympr_test run: deno task migrate - name: Run integration tests env: POSTGRES_HOST: localhost POSTGRES_PORT: 5432 POSTGRES_USER: test POSTGRES_PASS: test POSTGRES_DB: polympr_test run: deno task test:integration