Skip to content

Instantly share code, notes, and snippets.

@dehidehidehi
Created January 11, 2023 23:28
Show Gist options
  • Save dehidehidehi/a8621c5de03b61a683dd23963295be9a to your computer and use it in GitHub Desktop.
Save dehidehidehi/a8621c5de03b61a683dd23963295be9a to your computer and use it in GitHub Desktop.
Github workflow: execute Maven tests with pom.xml cached-dependencies (.github/workflows/main.yml)
name: 'Test PRs'
on:
pull_request:
types: [ opened, synchronize, reopened ]
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Java
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '19'
- name: Cache local Maven repository
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Maven test
run: mvn test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment