mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-20 14:55:50 +00:00
Added artifacts
This commit is contained in:
parent
291086370b
commit
3f9db9d81e
1 changed files with 27 additions and 26 deletions
53
.github/workflows/ci.yml
vendored
53
.github/workflows/ci.yml
vendored
|
@ -2,11 +2,9 @@ name: CI Pipeline
|
|||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
branches: [ main ]
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
branches: [ main ]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
@ -14,37 +12,40 @@ jobs:
|
|||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up JDK 17
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
distribution: 'adopt'
|
||||
java-version: '17'
|
||||
|
||||
- name: Cache Maven dependencies
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ~/.m2/repository
|
||||
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-maven-
|
||||
|
||||
- name: Set up PostgreSQL
|
||||
uses: harmon758/postgresql-action@v1.0.0
|
||||
with:
|
||||
postgresql version: '13'
|
||||
postgresql db: 'petclinic'
|
||||
postgresql user: 'postgres'
|
||||
postgresql password: 'password'
|
||||
|
||||
- name: Build with Maven
|
||||
run: mvn clean install
|
||||
|
||||
- name: Run tests
|
||||
- name: Upload Build Artifacts
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: build-artifacts
|
||||
path: target/**
|
||||
|
||||
- name: Run Unit Tests
|
||||
run: mvn test
|
||||
|
||||
- name: Build Docker image
|
||||
run: docker build -t petclinic-app .
|
||||
- name: Upload Test Reports
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: test-reports
|
||||
path: target/surefire-reports/**
|
||||
|
||||
- name: Push Docker image
|
||||
run: docker push your-dockerhub-username/petclinic-app
|
||||
- name: Generate Code Coverage Report
|
||||
run: mvn jacoco:report
|
||||
|
||||
- name: Upload Code Coverage Report
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: code-coverage-report
|
||||
path: target/site/jacoco/**
|
||||
|
||||
- name: Run Deployment
|
||||
run: java -jar target/your-app.jar
|
||||
|
|
Loading…
Reference in a new issue