Skip to content

Commit

Permalink
Update run-tests.yml
Browse files Browse the repository at this point in the history
Signed-off-by: Mirage <[email protected]>
  • Loading branch information
ClementBobin authored Nov 6, 2024
1 parent f95cf86 commit a9de816
Showing 1 changed file with 43 additions and 13 deletions.
56 changes: 43 additions & 13 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,56 @@
name: Run Tests
name: Docker Compose PR Validation

on:
push:
branches: [ main, master ]
pull_request:
branches: [ main, master ]
branches:
- main

jobs:
test:
build-and-test:
runs-on: ubuntu-latest

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

- name: Setup Node.js
uses: actions/setup-node@v2
- name: Set up Docker
uses: docker/setup-buildx-action@v2

- name: Cache Docker layers
uses: actions/cache@v3
with:
node-version: '16' # Specify the Node.js version you are using
path: /tmp/.buildx-cache
key: ${{ runner.os }}-docker-${{ github.sha }}
restore-keys: |
${{ runner.os }}-docker-
- name: Set up Docker Compose
run: |
sudo apt-get update
sudo apt-get install -y docker-compose
- name: Run Docker Compose to validate
run: |
docker-compose -f ./infra/docker-compose-test.yml up -d
docker-compose -f ./infra/docker-compose-test.yml ps
- name: Wait for the database to be ready
run: |
echo "Waiting for the database to be ready..."
until docker-compose exec -T db pg_isready -U user -d laravel; do
echo "Waiting for database..."
sleep 5
done
- name: Run Dotnet Migrations
run: |
- name: Install dependencies
run: npm install
- name: Run Nextjs Tests
run: |
docker-compose exec -T nextjs_app npm run test
- name: Run Jest tests
run: npm run test
- name: Stop Docker containers
if: always()
run: |
docker-compose -f ./infra/docker-compose-test.yml down

0 comments on commit a9de816

Please sign in to comment.