-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Mirage <[email protected]>
- Loading branch information
1 parent
f95cf86
commit a9de816
Showing
1 changed file
with
43 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |