-
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.
Merge pull request #358 from vaskocuturilo/dv000298_improve_github_ac…
…tions_yaml_files DV-000298: Improve the GitHub action file.
- Loading branch information
Showing
3 changed files
with
118 additions
and
117 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -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 |