diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml index 0402500..a90a966 100644 --- a/.github/workflows/actions.yml +++ b/.github/workflows/actions.yml @@ -8,11 +8,30 @@ on: branches: '*' jobs: + build-jar: + name: Build jar + runs-on: ubuntu-latest + steps: + - name: Checkout git + uses: actions/checkout@v3 + - name: Build + env: + ACCESS_KEY: ${{ secrets.TEAMSCALE_ACCESS_KEY }} + run: mvn clean verify -Pfailsafe -Pshaded + - name: 'Upload Artifact' + if: ${{ always() }} + uses: actions/upload-artifact@v3 + with: + name: target-jar + path: ./target + retention-days: 5 + build-linux: name: Linux Build runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - name: Checkout git + uses: actions/checkout@v3 - name: Set up GraalVM uses: ayltai/setup-graalvm@v1 with: @@ -22,15 +41,16 @@ jobs: - name: Build env: ACCESS_KEY: ${{ secrets.TEAMSCALE_ACCESS_KEY }} - run: mvn clean verify -Pfailsafe + run: mvn clean verify -Pfailsafe -Pnative - name: Reduce Image Size - uses: crazy-max/ghaction-upx@v1 + uses: crazy-max/ghaction-upx@v2 with: version: latest - file: ./target/teamscale-buildbreaker + files: | + ./target/teamscale-buildbreaker - name: 'Upload Artifact' if: ${{ always() }} - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: target-linux path: ./target @@ -40,7 +60,8 @@ jobs: name: Windows Build runs-on: windows-2019 steps: - - uses: actions/checkout@v2 + - name: Checkout git + uses: actions/checkout@v3 - name: Set up GraalVM uses: ayltai/setup-graalvm@v1 with: @@ -52,13 +73,14 @@ jobs: ACCESS_KEY: ${{ secrets.TEAMSCALE_ACCESS_KEY }} run: ./build-windows.bat - name: Reduce Image Size - uses: crazy-max/ghaction-upx@v1 + uses: crazy-max/ghaction-upx@v2 with: version: latest - file: ./target/teamscale-buildbreaker.exe + files: | + ./target/teamscale-buildbreaker.exe - name: 'Upload Artifact' if: ${{ always() }} - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: target-windows path: ./target @@ -69,6 +91,7 @@ jobs: needs: - build-windows - build-linux + - build-jar name: Create Release runs-on: ubuntu-latest steps: @@ -77,12 +100,13 @@ jobs: run: | (cd ./target-linux && zip ../teamscale-buildbreaker-linux.zip ./teamscale-buildbreaker) (cd ./target-windows && zip ../teamscale-buildbreaker-windows.zip ./teamscale-buildbreaker.exe) + (cd ./target-jar && cp ./teamscale-buildbreaker-*-shaded.jar ../teamscale-buildbreaker.jar) - name: Upload Release Assets id: create_release uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} tag: ${{ github.ref }} - file: teamscale-buildbreaker-*.zip + file: teamscale-buildbreaker*.{zip,jar} file_glob: true overwrite: true diff --git a/README.md b/README.md index c9ce83f..d05cfad 100644 --- a/README.md +++ b/README.md @@ -170,5 +170,5 @@ necessary. - Make sure that maven is executed with the graalvm JDK - In the command line, navigate to the root directory of the project -- Run ```mvn package``` +- Run ```mvn package -Pnative``` - if build was successful, the new native image is located in the ```target``` subfolder of the project diff --git a/build-windows.bat b/build-windows.bat index 665f973..54a57b3 100644 --- a/build-windows.bat +++ b/build-windows.bat @@ -2,4 +2,4 @@ rem calling this is required so cl.exe is on the path when native-image tries to rem we can't do this from the travis bash script as the env variables set by this bat file are not rem propagated to the shell environment call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x86_amd64 -./mvnw.cmd clean verify -Pfailsafe \ No newline at end of file +./mvnw.cmd clean verify -Pfailsafe -Pnative \ No newline at end of file diff --git a/pom.xml b/pom.xml index 5472332..7c4ad23 100644 --- a/pom.xml +++ b/pom.xml @@ -146,33 +146,15 @@ + + org.apache.maven.plugins + maven-shade-plugin + 3.2.0 + - - org.graalvm.nativeimage - native-image-maven-plugin - - ${project.name} - ${mainClass} - - -H:+AddAllCharsets - --no-fallback - --enable-http - --enable-https - --report-unsupported-elements-at-runtime - - - - - - native-image - - package - - - org.codehaus.mojo exec-maven-plugin @@ -287,5 +269,68 @@ + + native + + + + org.graalvm.nativeimage + native-image-maven-plugin + + ${project.name} + ${mainClass} + + -H:+AddAllCharsets + --no-fallback + --enable-http + --enable-https + --report-unsupported-elements-at-runtime + + + + + + native-image + + package + + + + + + + + shaded + + + + org.apache.maven.plugins + maven-shade-plugin + + + build-uber-jar + + shade + + package + + true + + + + + + + + + + + + + + + +