try building once and sharing
@@ -6,8 +6,33 @@ name: Tests
on: [ push, pull_request ]
jobs:
- Morphia:
+ Build:
+ name: "Build Morphia"
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+ - name: Set up JDK ${{ matrix.java }}
+ uses: actions/setup-java@v1
+ with:
+ java-version: ${{ matrix.java }}
+ - name: Cache Maven packages
+ uses: actions/cache@v1
+ with:
+ path: ~/.m2
+ key: \${{ runner.os }}-m2-\${{ hashFiles('**/pom.xml') }}
+ restore-keys: \${{ runner.os }}-m2
+ - name: Build with Maven
+ env:
+ MONGODB: ${{ matrix.mongo }}
+ run: mvn -B install --file pom.xml -DskipTests
+ - name: Archive workspace
+ uses: actions/upload-artifact@v2
+ with:
+ name: workspace
+ path: *
+ Tests:
name: "Test Morphia"
+ needs: Build
runs-on: ubuntu-latest
strategy:
matrix:
@@ -15,7 +40,13 @@ jobs:
mongo: [ 4.4.2, 4.2.11, 4.0.21, 3.6.21 ]
driver: [ 4.1.1, 4.0.5 ]
steps:
- - uses: actions/checkout@v2
+ - name: Archive workspace
+ uses: actions/download-artifact@v2
+ with:
+ name: workspace
+ path: *
+ - name: Remove src tree
+ run: rm -rf core/src/java
- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v1
with:
@@ -29,7 +60,7 @@ jobs:
- name: Build with Maven
env:
MONGODB: ${{ matrix.mongo }}
- run: mvn -B verify --file pom.xml -Ddriver.version=${{ matrix.driver }}
+ run: mvn -B verify --file core/pom.xml -Ddriver.version=${{ matrix.driver }}
Quality:
name: Run code quality checks
needs: Morphia
