-
-
Notifications
You must be signed in to change notification settings - Fork 863
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Maven workflow to validate pull requests and commits (#4432)
* Create maven workflow * Also run it when the workflow file was modified * Added local Maven cache * I know how to count 👀
- Loading branch information
1 parent
f9144e6
commit b893280
Showing
1 changed file
with
51 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# This workflow automatically tests new commits and pull requests as they come in. | ||
# Note that this does not upload any artifacts, you will need to compile mcMMO manually | ||
# if you wish to create the actual jar. | ||
name: Compile and test | ||
|
||
on: | ||
# We run our tests whenever the pom or a source file was touched. | ||
# There is no need to run Maven when only the changelog was touched. | ||
# We may also want to re-run this workflow when the workflow file itself | ||
# was updated too. | ||
push: | ||
paths: | ||
- 'src/**' | ||
- 'pom.xml' | ||
- '.github/workflows/maven.yml' | ||
|
||
# Whenever someone submits a new pull request which modified the pom or a source file, | ||
# we want to ensure it compiles successfully and that all tests will pass. | ||
pull_request: | ||
paths: | ||
- 'src/**' | ||
- 'pom.xml' | ||
|
||
jobs: | ||
compile: | ||
name: Maven compiler | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
# 1. Check out the current working tree | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
# 2. Setup Java 1.8 JDK | ||
- name: Java 1.8 setup | ||
uses: actions/setup-java@v1.4.3 | ||
with: | ||
java-package: jdk | ||
java-version: 1.8 | ||
|
||
# 3. Setup local Maven package cache to speed up building | ||
- name: Cache Maven packages | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/.m2 | ||
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} | ||
restore-keys: ${{ runner.os }}-m2 | ||
|
||
# 4. Build via Maven | ||
- name: Build via Maven | ||
run: mvn verify -B --file pom.xml |