Skip to content

Move gitlab cicd to github actions #6

Move gitlab cicd to github actions

Move gitlab cicd to github actions #6

Workflow file for this run

name: Backend Lint and Unit Tests
on:
pull_request:
workflow_dispatch:
env:
TEST_COGNITO_JWT_URL: ${{ secrets.TEST_COGNITO_JWT_URL }}
jobs:
lint-backend:
runs-on: ubuntu-latest
container:
image: maven:3.9.9-amazoncorretto-21-alpine
defaults:
run:
working-directory: ./backend/application/
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Run backend linting (Checkstyle)
run: |
echo "Running backend linting..."
mvn -f ./backendService/pom.xml clean checkstyle:check
echo "Backend linting passed"
unit-test-backend:
runs-on: ubuntu-latest
needs: lint-backend
container:
image: maven:3.9.9-amazoncorretto-21-alpine
defaults:
run:
working-directory: ./backend/application/
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Prepare application.yml for tests
run: |
echo "Copying the test-application.yml into a application.yml file..."
cp ./backendService/src/main/resources/test-application.example.yml ./backendService/src/main/resources/application.yml
cp ./backendService/src/test/resources/application.example.yml ./backendService/src/test/resources/application.yml
echo "Copying completed"
- name: Run unit tests
run: |
echo "Running unit tests..."
mvn -f ./backendService/pom.xml clean test -DTEST_COGNITO_JWT_URL=$TEST_COGNITO_JWT_URL
echo "Unit tests passed"