Browse Source

Speed up build, make cache more efficient

Sebastian Stenzel 5 years ago
parent
commit
2902479fc1
1 changed files with 12 additions and 30 deletions
  1. 12 30
      .github/workflows/build.yml

+ 12 - 30
.github/workflows/build.yml

@@ -4,25 +4,24 @@ on:
   [push]
 
 jobs: 
-  test:
-    name: Run Tests
+  build:
+    name: Build and Test
     runs-on: ubuntu-latest
     steps:
       - uses: actions/checkout@v2
-      - name: Set up JDK 14
-        uses: actions/setup-java@v1
+      - uses: actions/setup-java@v1
         with:
           java-version: 14
       - uses: actions/cache@v1
         with:
           path: ~/.m2/repository
-          key: ${{ runner.os }}-maven-${{ github.run_id }}
+          key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
           restore-keys: |
             ${{ runner.os }}-maven-
       - name: Ensure to use tagged version
         run: mvn versions:set --file main/pom.xml -DnewVersion=${GITHUB_REF##*/} # use shell parameter expansion to strip of 'refs/tags'
         if: startsWith(github.ref, 'refs/tags/')
-      - name: Build with Maven
+      - name: Build and Test
         run: mvn -B install --file main/pom.xml -Pcoverage
       - name: Run Codacy Coverage Reporter
         run: |
@@ -34,25 +33,7 @@ jobs:
           $JAVA_HOME/bin/java -jar ~/codacy-coverage-reporter.jar final
         env:
           CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}
-          
-  assemble-build-kit:
-    name: Assemble Build Kit
-    runs-on: ubuntu-latest
-    needs: test
-    steps:
-      - uses: actions/checkout@v2
-      - name: Set up JDK 14
-        uses: actions/setup-java@v1
-        with:
-          java-version: 14
-      - uses: actions/cache@v1
-        with:
-          path: ~/.m2/repository
-          key: ${{ runner.os }}-maven-${{ github.run_id }}
-      - name: Ensure to use tagged version
-        run: mvn versions:set --file main/pom.xml -DnewVersion=${GITHUB_REF##*/} # use shell parameter expansion to strip of 'refs/tags'
-        if: startsWith(github.ref, 'refs/tags/')
-      - name: Build with Maven
+      - name: Assemble Buildkit
         run: mvn -B package -DskipTests --file main/pom.xml --resume-from=buildkit -Prelease
       - name: Upload buildkit-linux.zip
         uses: actions/upload-artifact@v1
@@ -70,10 +51,10 @@ jobs:
           name: buildkit-win.zip
           path: main/buildkit/target/buildkit-win.zip
           
-  github-release:
+  release:
     name: Draft a Release on GitHub Releases
     runs-on: ubuntu-latest
-    needs: assemble-build-kit
+    needs: build
     if: startsWith(github.ref, 'refs/tags/')
     steps:
       - name: Download buildkit-linux.zip
@@ -91,7 +72,8 @@ jobs:
         with:
           name: buildkit-win.zip
           path: .
-      - id: create_release
+      - name: Create Release
+        id: create_release
         uses: actions/create-release@v1
         env:
           GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -99,9 +81,9 @@ jobs:
           tag_name: ${{ github.ref }}
           release_name: ${{ github.ref }}
           body: |
-            TODO
+            :construction: Work in Progress
           draft: true
-          prerelease: true
+          prerelease: false
       - name: Upload buildkit-linux.zip to GitHub Releases
         uses: actions/upload-release-asset@v1.0.1
         env: