Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
backend
Manage
Activity
Members
Plan
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
idatt2106-v23-03
backend
Commits
d1b27648
Commit
d1b27648
authored
2 years ago
by
Birk Øvstetun Narvhus
Browse files
Options
Downloads
Patches
Plain Diff
Update .gitlab-ci.yml file
parent
5ef7c7bc
Branches
Pipe-and-Filter
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
.gitlab-ci.yml
+30
-35
30 additions, 35 deletions
.gitlab-ci.yml
with
30 additions
and
35 deletions
.gitlab-ci.yml
+
30
−
35
View file @
d1b27648
#Workflow name
image
:
maven:3.9.0-eclipse-temurin-19-focal
name
:
CI/CD Pipeline
on
:
variables
:
#Manually trigger workflow runs
SPRING_PROFILES_ACTIVE
:
gitlab-ci
workflow_dispatch
:
#Trigger the workflow on push from the main branch
stages
:
push
:
-
build
branches
:
-
test
-
main
-
deploy
jobs
:
#Test's job
maven-build
:
tests
:
stage
:
build
name
:
Unit tests
script
:
#Run on Ubuntu using the latest version
-
mvn -v
runs-on
:
ubuntu-latest
-
mvn package
#Job's steps
steps
:
#Check-out your repository under $GITHUB_WORKSPACE, so your workflow can access it
run-tests
:
-
uses
:
actions/checkout@v1
stage
:
test
#Set up JDK 11
script
:
-
name
:
Set up JDK
-
mvn install
uses
:
actions/setup-java@v1
-
mvn test
with
:
java-version
:
'
20'
deploy-jar
:
#Set up Maven cache
stage
:
deploy
-
name
:
Cache Maven packages
script
:
#This action allows caching dependencies and build outputs to improve workflow execution time.
-
mvn install
uses
:
actions/cache@v1
artifacts
:
with
:
paths
:
path
:
~/.m2
-
target/*.jar
key
:
${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
\ No newline at end of file
restore-keys
:
${{ runner.os }}-m2
#Run Tests
-
name
:
Run Tests
run
:
mvn -B test
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment