Manual Maven CI #10
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Manual Maven CI | |
on: | |
workflow_dispatch: # This event allows triggering the workflow manually | |
jobs: | |
build: | |
runs-on: ubuntu-latest #container env called runner that runs our code | |
env: | |
MAVEN_OPTS: "-Dmaven.repo.local=${{ github.workspace }}/repository" | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up JDK 9 | |
uses: actions/setup-java@v2 | |
with: | |
java-version: '9' | |
distribution: 'adopt' | |
- name: Cache Maven dependencies | |
uses: actions/cache@v3 | |
with: | |
path: "${{ github.workspace }}/repository" | |
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
restore-keys: | | |
${{ runner.os }}-maven- | |
fail-on-cache-miss: false | |
- name: Debug Cache | |
run: | | |
ls -l ~/.m2/repository/ | |
echo "Cache directory contents:" | |
ls -l ~/.m2/repository/ | |
- name: Build with Maven | |
run: mvn -B package --file pom.xml | |
- name: Test with Maven | |
run: mvn test --file pom.xml |