From cfaa584a7d8564c5bc8f689ff665f45314e29a9e Mon Sep 17 00:00:00 2001 From: kristoffer Date: Sun, 30 Apr 2023 23:18:19 +0200 Subject: [PATCH] Add mvn test push workflow --- .github/workflows/create-release.yaml | 108 +++++++++++++------------- .github/workflows/run-tests.yaml | 18 +++++ 2 files changed, 72 insertions(+), 54 deletions(-) create mode 100644 .github/workflows/run-tests.yaml diff --git a/.github/workflows/create-release.yaml b/.github/workflows/create-release.yaml index d46e8ed..808c4fa 100644 --- a/.github/workflows/create-release.yaml +++ b/.github/workflows/create-release.yaml @@ -1,54 +1,54 @@ -name: Create Release - -on: - push: - tags: - - '[0-9]+.[0-9]+.[0-9]+*' - -jobs: - build-and-release: - runs-on: ubuntu-latest - - steps: - - name: Checkout code - uses: actions/checkout@v2 - - - name: Set up JDK - uses: actions/setup-java@v2 - with: - distribution: 'adopt' - java-version: '11' - - - name: Extract artifact ID and version from pom.xml - run: | - ARTIFACT_ID=$(mvn -q -Dexec.executable=echo -Dexec.args='${project.artifactId}' --non-recursive exec:exec) - VERSION=$(mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec) - echo "ARTIFACT_ID=$ARTIFACT_ID" >> $GITHUB_ENV - echo "VERSION=$VERSION" >> $GITHUB_ENV - - - name: Build with Maven - run: mvn clean install --settings settings.xml --batch-mode -Dmaven.wagon.http.ssl.insecure=true -Dmaven.wagon.http.ssl.allowall=true -Dmaven.wagon.http.ssl.ignore.validity.dates=true - - - name: Create GitHub Release - id: create_release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ github.ref }} - release_name: Release ${{ github.ref }} - body: | - Changes in this Release - - Add a summary of changes or refer to the changelog. - draft: false - prerelease: false - - - name: Upload JAR Artifact to Release - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./target/${{ env.ARTIFACT_ID }}-${{ env.VERSION }}.jar - asset_name: ${{ env.ARTIFACT_ID }}-${{ env.VERSION }}.jar - asset_content_type: application/java-archive +#name: Create Release +# +#on: +# push: +# tags: +# - '[0-9]+.[0-9]+.[0-9]+*' +# +#jobs: +# build-and-release: +# runs-on: ubuntu-latest +# +# steps: +# - name: Checkout code +# uses: actions/checkout@v2 +# +# - name: Set up JDK +# uses: actions/setup-java@v2 +# with: +# distribution: 'adopt' +# java-version: '11' +# +# - name: Extract artifact ID and version from pom.xml +# run: | +# ARTIFACT_ID=$(mvn -q -Dexec.executable=echo -Dexec.args='${project.artifactId}' --non-recursive exec:exec) +# VERSION=$(mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec) +# echo "ARTIFACT_ID=$ARTIFACT_ID" >> $GITHUB_ENV +# echo "VERSION=$VERSION" >> $GITHUB_ENV +# +# - name: Build with Maven +# run: mvn clean install --settings settings.xml --batch-mode -Dmaven.wagon.http.ssl.insecure=true -Dmaven.wagon.http.ssl.allowall=true -Dmaven.wagon.http.ssl.ignore.validity.dates=true +# +# - name: Create GitHub Release +# id: create_release +# uses: actions/create-release@v1 +# env: +# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} +# with: +# tag_name: ${{ github.ref }} +# release_name: Release ${{ github.ref }} +# body: | +# Changes in this Release +# - Add a summary of changes or refer to the changelog. +# draft: false +# prerelease: false +# +# - name: Upload JAR Artifact to Release +# uses: actions/upload-release-asset@v1 +# env: +# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} +# with: +# upload_url: ${{ steps.create_release.outputs.upload_url }} +# asset_path: ./target/${{ env.ARTIFACT_ID }}-${{ env.VERSION }}.jar +# asset_name: ${{ env.ARTIFACT_ID }}-${{ env.VERSION }}.jar +# asset_content_type: application/java-archive diff --git a/.github/workflows/run-tests.yaml b/.github/workflows/run-tests.yaml new file mode 100644 index 0000000..dc4c81f --- /dev/null +++ b/.github/workflows/run-tests.yaml @@ -0,0 +1,18 @@ +name: Maven Tests + +on: [push, pull_request] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Set up JDK 11 + uses: actions/setup-java@v1 + with: + java-version: 11 + + - name: Build and test with Maven + run: mvn test