End-To-End Test Pipeline #15
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
name: End-To-End Test Pipeline | |
on: | |
workflow_dispatch: | |
inputs: | |
PIPELINE_TYPE: | |
required: true | |
default: 'multi-project-pipeline' | |
pull_request: | |
branches: [ main ] | |
jobs: | |
build-and-test-backend: | |
runs-on: ubuntu-latest | |
services: | |
mysql-service: | |
image: mysql:8.0.36 | |
env: | |
MYSQL_ROOT_PASSWORD: password | |
MYSQL_DATABASE: QuizopiaDB_Test | |
ports: | |
- 3306:3306 | |
options: >- | |
--health-cmd="mysqladmin ping -h localhost -ppassword" | |
--health-interval=10s | |
--health-timeout=5s | |
--health-retries=5 | |
steps: | |
- name: Checkout Repository Code | |
uses: actions/checkout@v4 | |
with: | |
repository: 'heikkkk/IDATT2105-Semester-Project-Backend' | |
- name: Setup JDK 17 for Java Build | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
cache: maven | |
- name: Build and Run Tests with Maven | |
run: mvn -B -Dspring.profiles.active=test package --file pom.xml | |
env: | |
SPRING_DATASOURCE_URL: jdbc:mysql://localhost:3306/QuizopiaDB_Test?allowPublicKeyRetrieval=true&useSSL=false | |
SPRING_DATASOURCE_USERNAME: root | |
SPRING_DATASOURCE_PASSWORD: password | |
- name: Start Backend Service | |
run: mvn spring-boot:run & | |
env: | |
SPRING_DATASOURCE_URL: jdbc:mysql://localhost:3306/QuizopiaDB_Test?allowPublicKeyRetrieval=true&useSSL=false | |
SPRING_DATASOURCE_USERNAME: root | |
SPRING_DATASOURCE_PASSWORD: password | |
- name: Wait for Backend to be ready | |
run: sleep 5 | |
- name: Checkout Frontend Code | |
uses: actions/checkout@v2 | |
with: | |
repository: 'heikkkk/IDATT2105-Semester-Project-Frontend' | |
path: 'frontend' | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '20' | |
- name: Install Frontend Dependencies | |
run: npm install | |
working-directory: ./frontend | |
- name: Run Cypress E2E Tests | |
run: npm run test:e2e:ci | |
working-directory: ./frontend | |
env: | |
BACKEND_URL: 'http://localhost:8080' |