Skip to content

Commit

Permalink
Merge pull request #358 from vaskocuturilo/dv000298_improve_github_ac…
Browse files Browse the repository at this point in the history
…tions_yaml_files

DV-000298: Improve the GitHub action file.
  • Loading branch information
vaskocuturilo authored Aug 13, 2024
2 parents 2ab38a8 + 0908bc8 commit c63863c
Show file tree
Hide file tree
Showing 3 changed files with 118 additions and 117 deletions.
54 changes: 0 additions & 54 deletions .github/workflows/backend_ci.yml

This file was deleted.

63 changes: 0 additions & 63 deletions .github/workflows/frontend_ci.yml

This file was deleted.

118 changes: 118 additions & 0 deletions .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
name: CI Pipeline

on:
pull_request:
branches:
- main

jobs:
backend:
runs-on: ubuntu-latest
services:
mariadb:
image: mariadb:10.8.2
ports:
- 3306:3306
env:
MYSQL_USER: ${{ secrets.MYSQL_USER }}
MYSQL_PASSWORD: ${{ secrets.MYSQL_PASSWORD }}
MYSQL_DATABASE: ${{ secrets.MYSQL_DATABASE }}
MYSQL_ROOT_PASSWORD: ${{ secrets.MYSQL_ROOT_PASSWORD }}
options: --health-cmd="mysqladmin ping --silent" --health-interval=5s --health-timeout=2s --health-retries=3

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

- name: Wait for MariaDB to be ready
run: |
for i in {1..30}; do
if mysqladmin ping -h127.0.0.1 --silent; then
echo "MariaDB is up!";
break;
fi
echo "Waiting for MariaDB...";
sleep 1;
done
- name: Setup Java 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: gradle

- name: Setup Gradle
uses: gradle/gradle-build-action@v2
with:
gradle-version: 7.4.2

- name: Build and Test Backend
env:
MYSQL_USER: ${{ secrets.MYSQL_USER }}
MYSQL_PASSWORD: ${{ secrets.MYSQL_PASSWORD }}
REACT_APP_API_KEY: ${{ secrets.REACT_APP_API_KEY }}
REACT_APP_TOKEN: ${{ secrets.REACT_APP_TOKEN }}
run: gradle clean build test

frontend:
runs-on: ubuntu-latest
needs: backend
strategy:
matrix:
node-version: [ 18.x ]
os: [ ubuntu-latest ]
browser: [ chrome, firefox ]

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

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}

- name: Install Dependencies
run: npm ci --force

- name: Install Compose
uses: ndeloof/[email protected]
with:
legacy: true
version: v2.1.0

- name: Start Docker Containers
run: |
docker-compose up --detach --build
docker-compose exec -T app wait-for-it localhost
- name: Run Cypress Smoke Tests
uses: cypress-io/github-action@v4
with:
command: npm run cypress:run:smoke:test -- --browser ${{ matrix.browser }}
parallel: true

- name: Run Cypress Sanity Tests
uses: cypress-io/github-action@v4
with:
command: npm run cypress:run:sanity:test -- --browser ${{ matrix.browser }}
parallel: true

- name: Generate Allure Report
uses: simple-elf/allure-report-action@master
if: always()
with:
allure_results: allure-results

- name: Deploy Allure Report to GitHub Pages
if: always()
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_branch: gh-pages
publish_dir: allure-report

- name: Stop Docker Containers
if: always()
run: docker-compose down

0 comments on commit c63863c

Please sign in to comment.