Skip to content

Commit

Permalink
Merge pull request #1 from MelleB/feat/github-action
Browse files Browse the repository at this point in the history
Add github action
  • Loading branch information
MelleB authored Aug 18, 2024
2 parents 107ffcb + 56ca1c0 commit 9793198
Showing 1 changed file with 59 additions and 0 deletions.
59 changes: 59 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: CI Pipeline

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
test:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:latest
env:
POSTGRES_DB: test_db
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U postgres"
--health-interval 10s
--health-timeout 5s
--health-retries 5
env:
DATABASE_URL: postgres://postgres:postgres@localhost:5432/test_db

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 20

- name: Install dependencies
run: npm install

- name: Run linter
run: npm run lint

- name: Wait for Postgres to be ready
run: |
until pg_isready -h localhost -p 5432 -U postgres; do
echo "Waiting for postgres..."
sleep 1
done
- name: Run tests with coverage
run: npm run test:coverage

- name: Upload coverage report
uses: actions/upload-artifact@v3
with:
name: coverage-report
path: coverage

0 comments on commit 9793198

Please sign in to comment.