GitHub Actions #1064
Workflow file for this run
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
# | |
# Copyright (c) 2017 Angelo Zerr and other contributors as | |
# indicated by the @author tags. | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, | |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
# See the License for the specific language governing permissions and | |
# limitations under the License. | |
# | |
name: GitHub Actions | |
on: [push, pull_request] | |
env: | |
GRAALVM_VERSION: '20.2.0.java11' | |
jobs: | |
linux: | |
runs-on: ubuntu-18.04 | |
steps: | |
- uses: actions/checkout@v1 | |
- name: Set VERSION env var | |
run: echo "VERSION=$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV | |
- name: setup-graalvm-ce | |
uses: DeLaGuardo/setup-graalvm@3 | |
with: | |
graalvm-version: ${{ env.GRAALVM_VERSION }} | |
- name: gu install native-image | |
run: gu install native-image | |
- name: Skip tests when releasing from a tag | |
if: startsWith(github.ref, 'refs/tags') | |
shell: bash | |
run: echo "SKIP_TESTS_OPT=-DskipTests" >> $GITHUB_ENV | |
- name: mvn clean verify | |
run: ./mvnw clean verify -Pnative -Dmrm=false -B -ntp -e $SKIP_TESTS_OPT | |
- name: Upload daemon test logs | |
if: ${{ success() || failure() }} | |
uses: actions/upload-artifact@v2 | |
with: | |
name: daemon-test-logs-linux | |
path: dist/target/mvnd-${{ env.VERSION }}-linux-amd64/daemon | |
- name: Upload mvnd.zip | |
uses: actions/upload-artifact@v2 | |
with: | |
name: mvnd-linux-amd64.zip | |
path: dist/target/mvnd-*.zip | |
windows: | |
runs-on: windows-2019 | |
steps: | |
- name: setup-graalvm-ce | |
uses: DeLaGuardo/setup-graalvm@3 | |
with: | |
graalvm-version: ${{ env.GRAALVM_VERSION }} | |
- name: gu install native-image | |
shell: cmd | |
run: gu install native-image | |
- uses: actions/cache@v2 | |
with: | |
path: ${{ env.JAVA_HOME }}\bin\native-image.exe | |
key: ${{ runner.os }}-native-image-${{ env.GRAALVM_VERSION }} | |
- name: Check if native-image.exe exists | |
id: native_image_exe_exists | |
uses: andstor/file-existence-action@v1 | |
with: | |
files: ${{ env.JAVA_HOME }}\bin\native-image.exe | |
- name: Compile native-image.cmd to native-image.exe | |
if: ${{ steps.native_image_exe_exists.outputs.files_exists == 'false' }} | |
shell: cmd | |
run: | | |
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat" | |
"%JAVA_HOME%\bin\native-image.cmd" -jar "%JAVA_HOME%\lib\graalvm\svm-driver.jar" native-image | |
- name: move native-image.exe %JAVA_HOME%\bin\ | |
if: ${{ steps.native_image_exe_exists.outputs.files_exists == 'false' }} | |
shell: cmd | |
run: | | |
move native-image.exe "%JAVA_HOME%\bin\" | |
- uses: actions/checkout@v1 | |
- name: Set VERSION env var | |
shell: bash | |
run: echo "VERSION=$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV | |
- name: Skip tests when releasing from a tag | |
if: startsWith(github.ref, 'refs/tags') | |
shell: bash | |
run: echo "SKIP_TESTS_OPT=-DskipTests" >> $GITHUB_ENV | |
- name: mvn clean verify | |
shell: cmd | |
run: | | |
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat" | |
./mvnw clean verify -Pnative -Dmrm=false -B -ntp -e %SKIP_TESTS_OPT% | |
- name: Upload daemon test logs | |
if: ${{ success() || failure() }} | |
uses: actions/upload-artifact@v2 | |
with: | |
name: daemon-test-logs-windows | |
path: dist/target/mvnd-${{ env.VERSION }}-windows-amd64/daemon | |
- name: Upload mvnd.zip | |
uses: actions/upload-artifact@v2 | |
with: | |
name: mvnd-windows-amd64.zip | |
path: dist/target/mvnd-*.zip | |
darwin: | |
runs-on: macos-10.15 | |
steps: | |
- uses: actions/checkout@v1 | |
- name: Set VERSION env var | |
run: echo "VERSION=$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV | |
- name: setup-graalvm-ce | |
uses: DeLaGuardo/setup-graalvm@3 | |
with: | |
graalvm-version: ${{ env.GRAALVM_VERSION }} | |
- name: gu install native-image | |
run: gu install native-image | |
- name: Skip tests when releasing from a tag | |
if: startsWith(github.ref, 'refs/tags') | |
shell: bash | |
run: echo "SKIP_TESTS_OPT=-DskipTests" >> $GITHUB_ENV | |
- name: mvn clean verify | |
run: ./mvnw clean verify -Pnative -Dmrm=false -B -ntp -e $SKIP_TESTS_OPT | |
- name: Upload daemon test logs | |
if: ${{ success() || failure() }} | |
uses: actions/upload-artifact@v2 | |
with: | |
name: daemon-test-logs-darwin | |
path: dist/target/mvnd-${{ env.VERSION }}-darwin-amd64/daemon | |
- name: Upload mvnd.zip | |
uses: actions/upload-artifact@v2 | |
with: | |
name: mvnd-darwin-amd64.zip | |
path: dist/target/mvnd-*.zip | |
deploy: | |
runs-on: ubuntu-18.04 | |
needs: [linux, windows, darwin] | |
if: startsWith(github.ref, 'refs/tags') # deploy only for tags | |
steps: | |
- name: Download artifacts | |
uses: actions/download-artifact@v2 | |
- name: ls -R | |
run: ls -R | |
- name: Set environment | |
run: | | |
if [[ ${GITHUB_REF} = refs/heads/* ]] | |
then | |
VERSION=${GITHUB_REF##*/}-${GITHUB_SHA::8} | |
else | |
VERSION=${GITHUB_REF##*/} | |
fi | |
echo "Using VERSION=$VERSION" | |
echo "VERSION=$VERSION" >> $GITHUB_ENV | |
- name: Compute sha256 checksums | |
run: | | |
sha256sum mvnd-linux-amd64.zip/mvnd-${{ env.VERSION }}-linux-amd64.zip | cut -d ' ' -f 1 > mvnd-linux-amd64.zip/mvnd-${{ env.VERSION }}-linux-amd64.zip.sha256 | |
sha256sum mvnd-darwin-amd64.zip/mvnd-${{ env.VERSION }}-darwin-amd64.zip | cut -d ' ' -f 1 > mvnd-darwin-amd64.zip/mvnd-${{ env.VERSION }}-darwin-amd64.zip.sha256 | |
sha256sum mvnd-windows-amd64.zip/mvnd-${{ env.VERSION }}-windows-amd64.zip | cut -d ' ' -f 1 > mvnd-windows-amd64.zip/mvnd-${{ env.VERSION }}-windows-amd64.zip.sha256 | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ env.VERSION }} | |
release_name: ${{ env.VERSION }} | |
draft: false | |
prerelease: false | |
- name: Deploy mvnd-linux-amd64.zip | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: mvnd-linux-amd64.zip/mvnd-${{ env.VERSION }}-linux-amd64.zip | |
asset_name: mvnd-${{ env.VERSION }}-linux-amd64.zip | |
asset_content_type: application/zip | |
- name: Deploy mvnd-linux-amd64.zip.sha256 | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: mvnd-linux-amd64.zip/mvnd-${{ env.VERSION }}-linux-amd64.zip.sha256 | |
asset_name: mvnd-${{ env.VERSION }}-linux-amd64.zip.sha256 | |
asset_content_type: text/plain | |
- name: Deploy mvnd-darwin-amd64.zip | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: mvnd-darwin-amd64.zip/mvnd-${{ env.VERSION }}-darwin-amd64.zip | |
asset_name: mvnd-${{ env.VERSION }}-darwin-amd64.zip | |
asset_content_type: application/zip | |
- name: Deploy mvnd-darwin-amd64.zip.sha256 | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: mvnd-darwin-amd64.zip/mvnd-${{ env.VERSION }}-darwin-amd64.zip.sha256 | |
asset_name: mvnd-${{ env.VERSION }}-darwin-amd64.zip.sha256 | |
asset_content_type: text/plain | |
- name: Deploy mvnd-windows-amd64.zip | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: mvnd-windows-amd64.zip/mvnd-${{ env.VERSION }}-windows-amd64.zip | |
asset_name: mvnd-${{ env.VERSION }}-windows-amd64.zip | |
asset_content_type: application/zip | |
- name: Deploy mvnd-windows-amd64.zip.sha256 | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: mvnd-windows-amd64.zip/mvnd-${{ env.VERSION }}-windows-amd64.zip.sha256 | |
asset_name: mvnd-${{ env.VERSION }}-windows-amd64.zip.sha256 | |
asset_content_type: text/plain | |
- uses: actions/checkout@v1 | |
- name: Publish on sdkman.io | |
env: | |
SDKMAN_CONSUMER_KEY: ${{ secrets.SDKMAN_CONSUMER_KEY }} | |
SDKMAN_CONSUMER_TOKEN: ${{ secrets.SDKMAN_CONSUMER_TOKEN }} | |
run: ./build/publish-on-sdkman.sh "${{ env.VERSION }}" | |
- name: Update the mvnd Homebrew tap | |
env: | |
MVND_CI_TOKEN: ${{ secrets.MVND_CI_TOKEN }} | |
run: | | |
curl -u ":$MVND_CI_TOKEN" \ | |
-X POST \ | |
-H "Accept: application/vnd.github.v3+json" \ | |
https://api.github.com/repos/mvndaemon/homebrew-mvnd/actions/workflows/release.yaml/dispatches \ | |
-d '{"ref": "master"}' |