mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-15 12:15:50 +00:00
[add] workflow for pull req
This commit is contained in:
parent
5eb70956ff
commit
979eaa74c6
2 changed files with 84 additions and 2 deletions
81
.github/workflows/pull-request.yml
vendored
Normal file
81
.github/workflows/pull-request.yml
vendored
Normal file
|
@ -0,0 +1,81 @@
|
|||
name: Merge request pipeline
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: [ main ]
|
||||
|
||||
jobs:
|
||||
checkstyle:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: maven:3.8.5-openjdk-17
|
||||
steps:
|
||||
-
|
||||
name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
-
|
||||
name: Run checkstyle w/ Gradle
|
||||
run: ./gradlew checkstyleMain
|
||||
|
||||
-
|
||||
name: Upload a Build Artifact
|
||||
uses: actions/upload-artifact@v4.6.0
|
||||
with:
|
||||
name: checkstyle-report
|
||||
path: build/reports/checkstyle/main/checkstyle.xml
|
||||
|
||||
test:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: maven:3.8.5-openjdk-17
|
||||
steps:
|
||||
-
|
||||
name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
-
|
||||
name: Run tests w/ Gradle
|
||||
run: ./gradlew test
|
||||
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: maven:3.8.5-openjdk-17
|
||||
steps:
|
||||
-
|
||||
name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
-
|
||||
name: Run build w/o tests
|
||||
run: ./gradlew build -x test
|
||||
|
||||
docker:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
-
|
||||
name: Checkout the code from main branch
|
||||
uses: actions/checkout@v4
|
||||
|
||||
-
|
||||
name: Login to Docker Hub
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
username: ${{ vars.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
||||
|
||||
-
|
||||
name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3.9.0
|
||||
|
||||
-
|
||||
name: Build and push Docker images
|
||||
uses: docker/build-push-action@v6.13.0
|
||||
with:
|
||||
push: true
|
||||
tags: ${{ vars.DOCKERHUB_USERNAME }}/mr:${{ github.sha }}
|
|
@ -1,10 +1,11 @@
|
|||
name: Create and push docker image to Docker Hub.
|
||||
name: Create and push docker image to Docker Hub on "push" event.
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main ]
|
||||
|
||||
|
||||
jobs:
|
||||
|
||||
docker:
|
||||
|
||||
runs-on: ubuntu-latest
|
Loading…
Reference in a new issue