ci-cd-test/.github/workflows/maven.yml

38 lines
768 B
YAML
Raw Permalink Normal View History

2024-10-19 16:05:29 +02:00
name: Java CI with Maven
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 21
2024-10-19 16:48:17 +02:00
run: |
sudo apt-get update
sudo apt-get install -y openjdk-21-jdk
java -version
- name: Set up Maven
run: |
sudo apt-get install -y maven
mvn -version
- name: Cache Maven packages
uses: actions/cache@v3
2024-10-19 16:05:29 +02:00
with:
2024-10-19 16:48:17 +02:00
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
2024-10-19 16:05:29 +02:00
- name: Build with Maven
2024-10-19 16:17:59 +02:00
run: mvn -B compile
2024-10-19 16:05:29 +02:00
- name: Run tests
2024-10-19 16:17:59 +02:00
run: mvn -B test