Skip to content
Snippets Groups Projects
Commit d1b27648 authored by Birk Øvstetun Narvhus's avatar Birk Øvstetun Narvhus
Browse files

Update .gitlab-ci.yml file

parent 5ef7c7bc
No related branches found
No related tags found
No related merge requests found
#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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment