Merge pull request #365 from xenit-eu/master #248
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
name: CI | |
on: | |
push: | |
workflow_dispatch: | |
env: | |
GRADLE_OPTS: >- | |
-Dorg.gradle.project.org.alfresco.maven.nexus.username=${{ secrets.ALFRESCO_NEXUS_USERNAME }} | |
-Dorg.gradle.project.org.alfresco.maven.nexus.password=${{ secrets.ALFRESCO_NEXUS_PASSWORD }} | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-java@v1 | |
with: | |
java-version: 11 | |
- name: Test | |
run: ./gradlew test | |
- name: Upload analysis to sonarcloud | |
env: | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
GITHUB_TOKEN: ${{ github.token }} | |
run: ./gradlew sonarqube | |
- name: 'Upload Artifact' | |
if: success() || failure() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: test-result | |
path: /home/runner/work/**/build/reports | |
retention-days: 2 | |
integration-test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
flavour: [ "community", "enterprise" ] | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-java@v1 | |
with: | |
java-version: 11 | |
- name: Login to CloudSmith docker registry | |
env: | |
DOCKER_USER: ${{ secrets.CLOUDSMITH_USER }} | |
DOCKER_PASSWORD: ${{ secrets.CLOUDSMITH_APIKEY }} | |
run: echo "$DOCKER_PASSWORD" | docker login private.docker.xenit.eu --username "$DOCKER_USER" --password-stdin | |
- name: Test | |
run: ./gradlew integrationTest -P${{ matrix.flavour }} | |
- name: 'Upload Artifact' | |
if: success() || failure() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: test-result-${{ matrix.flavour }} | |
path: /home/runner/work/**/build/reports | |
retention-days: 2 | |
publish: | |
needs: [test, integration-test] | |
runs-on: ubuntu-latest | |
if: ${{ startsWith(github.ref, 'refs/heads/master') || startswith(github.ref, 'refs/heads/release') }} | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-java@v1 | |
with: | |
java-version: 11 | |
- name: Publish | |
env: | |
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.MAVEN_CENTRAL_GPG_KEY }} | |
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.MAVEN_CENTRAL_GPG_PASSWORD }} | |
ORG_GRADLE_PROJECT_sonatype_username: ${{ secrets.SONATYPE_S01_USERNAME }} | |
ORG_GRADLE_PROJECT_sonatype_password: ${{ secrets.SONATYPE_S01_PASSWORD }} | |
run: ./gradlew publish -PsigningKeyId=CDE3528F | |
- name: Publish Gradle Plugin | |
if: ${{ startswith(github.ref, 'refs/heads/release') }} | |
env: | |
GRADLE_PUBLISH_KEY: ${{ secrets.GRADLE_PLUGINS_PUBLISH_KEY }} | |
GRADLE_PUBLISH_SECRET: ${{ secrets.GRADLE_PLUGINS_PUBLISH_SECRET }} | |
run: ./gradlew publishPlugins -Pgradle.publish.key=$GRADLE_PUBLISH_KEY -Pgradle.publish.secret=$GRADLE_PUBLISH_SECRET |