Skip to content

Shorten display name for testGetKeyValuePairs #148

Shorten display name for testGetKeyValuePairs

Shorten display name for testGetKeyValuePairs #148

Workflow file for this run

# This workflow will build a Java project with Maven
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
name: Java CI with Maven
on: [ push, pull_request ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Checkout omero-test-infra
uses: actions/checkout@v3
with:
repository: openmicroscopy/omero-test-infra
submodules: true
path: .omero
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'adopt'
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
settings-path: ${{ github.workspace }} # location for the settings.xml file
- name: Cache SonarCloud packages
uses: actions/cache@v3
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache Maven packages
uses: actions/cache@v3
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Login to Docker Hub
if: ${{ github.event_name == 'push' }}
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Append 'SNAPSHOT' to version if 'push' happened on 'main'
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
run: |
mvn help:evaluate -N -Dexpression=project.version|grep -v '\['
VERSION=$(mvn help:evaluate -N -Dexpression=project.version|grep -v '\[')
mvn versions:set -DnewVersion=$VERSION-SNAPSHOT
- name: Append branch name to version if 'push' did not happen on 'main' or a tag
if: ${{ github.event_name == 'push' && github.ref != 'refs/heads/main' && !startsWith(github.ref, 'refs/tags/')}}
run: |
mvn help:evaluate -N -Dexpression=project.version|grep -v '\['
VERSION=$(mvn help:evaluate -N -Dexpression=project.version|grep -v '\[')
mvn versions:set -DnewVersion=$VERSION-${GITHUB_REF##*/}
- name: Test with Maven and omero-test-infra through Docker
run: $GITHUB_WORKSPACE/.omero/lib-docker
env:
DOCKER_ARGS: -v ${{ env.HOME }}/.m2:/root/.m2 -v ${{ github.workspace }}/target:/src/target -t
- name: Set folders ownership back to current user
run: sudo chown -R $(id -u):$(id -g) $GITHUB_WORKSPACE && sudo chown -R $(id -u):$(id -g) $HOME
- name: Upload to codecov after successful tests
if: ${{ success() }}
run: bash <(curl -s https://codecov.io/bash)
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: jars
path: |
target/*.jar
!target/*-with-dependencies.jar
- name: Install gpg secret key
if: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')) }}
run: cat <(echo -e "${{ secrets.GPG_KEY }}") | gpg --batch --import
- name: Publish to GitHub Packages Apache Maven
if: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')) }}
run: mvn deploy -Dgpg.passphrase="${{ secrets.GPG_PASSPHRASE }}" -DskipTests -s $GITHUB_WORKSPACE/settings.xml
env:
GITHUB_TOKEN: ${{ github.token }}