76 lines
1.6 KiB
YAML
76 lines
1.6 KiB
YAML
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: |
|
|
docker run -d --name postgres \
|
|
-e POSTGRES_DB=polympr_test \
|
|
-e POSTGRES_USER=test \
|
|
-e POSTGRES_PASSWORD=test \
|
|
-p 5432:5432 \
|
|
postgres:16
|
|
until docker exec postgres pg_isready -U test; do
|
|
echo "Waiting for postgres..."
|
|
sleep 2
|
|
done
|
|
|
|
- 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: 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
|