diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 681e088f851506db37f7b6c515b6c633dd389d63..871852aa10c51ef81fbae659d132ecb59255b27d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,35 +1,30 @@ -#Workflow name -name: CI/CD Pipeline -on: - #Manually trigger workflow runs - workflow_dispatch: - #Trigger the workflow on push from the main branch - push: - branches: - - main -jobs: - #Test's job - tests: - name: Unit tests - #Run on Ubuntu using the latest version - runs-on: ubuntu-latest - #Job's steps - steps: - #Check-out your repository under $GITHUB_WORKSPACE, so your workflow can access it - - uses: actions/checkout@v1 - #Set up JDK 11 - - name: Set up JDK - uses: actions/setup-java@v1 - with: - java-version: '20' - #Set up Maven cache - - name: Cache Maven packages - #This action allows caching dependencies and build outputs to improve workflow execution time. - uses: actions/cache@v1 - with: - path: ~/.m2 - key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} - restore-keys: ${{ runner.os }}-m2 - #Run Tests - - name: Run Tests - run: mvn -B test \ No newline at end of file +image: maven:3.9.0-eclipse-temurin-19-focal + +variables: + SPRING_PROFILES_ACTIVE: gitlab-ci + +stages: + - build + - test + - deploy + +maven-build: + stage: build + script: + - mvn -v + - mvn package + + +run-tests: + stage: test + script: + - mvn install + - mvn test + +deploy-jar: + stage: deploy + script: + - mvn install + artifacts: + paths: + - target/*.jar \ No newline at end of file