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 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: Start postgres run: | sudo apt-get update -qq && sudo apt-get install -y -qq postgresql > /dev/null PG_VER=$(ls /etc/postgresql/) sudo pg_ctlcluster $PG_VER main start sudo -u postgres psql -c "CREATE USER test WITH PASSWORD 'test';" sudo -u postgres psql -c "CREATE DATABASE polympr_test OWNER test;" sudo -u postgres psql -d polympr_test -c "GRANT ALL ON SCHEMA public TO test;" - name: Install dependencies run: npm install --ignore-scripts && deno install - name: Apply migrations env: POSTGRES_HOST: localhost POSTGRES_PORT: 5432 POSTGRES_USER: test POSTGRES_PASS: test POSTGRES_DB: polympr_test run: node_modules/.bin/drizzle-kit 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