Skip to content

Implementing CI pipeline #1

Implementing CI pipeline

Implementing CI pipeline #1

Workflow file for this run

# This is the name of the GitHub Actions workflow.
name: Java and Node.js CI
# This workflow will run on every push to the 'main' branch.
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
# A workflow run is made up of one or more jobs that can run sequentially or in parallel.
jobs:
# This job is named 'build-and-test'
build-and-test:
# The type of runner that the job will run on
runs-on: ubuntu-latest
steps:
# Step 1: Checks out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout code
uses: actions/checkout@v3
# Step 2: Set up the Java environment (JDK 21) for the backend tests
- name: Set up JDK 21
uses: actions/setup-java@v3
with:
java-version: '21'
distribution: 'temurin'
cache: maven
# Step 3: Run the backend Maven tests
- name: Run backend tests
# We need to give execution permissions to the mvnw script first
run: |
chmod +x backend/mvnw
cd backend
./mvnw test
# Step 4: Set up the Node.js environment for the frontend tests
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '14'
cache: 'npm'
cache-dependency-path: frontend/package-lock.json
# Step 5: Install frontend dependencies and run frontend tests
- name: Install dependencies and run frontend tests
run: |
cd frontend
npm install
npm test