Skip to content

Merge pull request #73 from SolaceProducts/stage-3.0.1 #100

Merge pull request #73 from SolaceProducts/stage-3.0.1

Merge pull request #73 from SolaceProducts/stage-3.0.1 #100

Workflow file for this run

# This workflow will build and test a Java project with Gradle
name: build
on:
pull_request:
push:
workflow_dispatch:
jobs:
dupe_check:
name: Check for Duplicate Workflow Run
runs-on: ubuntu-latest
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/[email protected]
with:
concurrent_skipping: same_content
do_not_skip: '["pull_request", "workflow_dispatch", "schedule"]'
build:
needs:
- dupe_check
if: needs.dupe_check.outputs.should_skip != 'true' || (github.event_name == 'push' && github.ref == 'refs/heads/master' && github.repository_owner == 'SolaceProducts')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Cache Gradle
uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-build-test-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-build-test-
- name: Setup JDK 11
uses: actions/setup-java@v2
with:
distribution: zulu
java-version: 11
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v1
- name: Install Test Support
working-directory: solace-integration-test-support
run: ./mvnw clean install -DskipTests -Dchangelist=
- name: Build and test with Gradle
run: ./gradlew clean test integrationTest jacocoFullReport --info
- name: Upload Test Artifacts
if: always()
uses: actions/upload-artifact@v2
with:
name: Test Results
path: |
**/build/jacoco/*.exec
**/build/reports/
**/build/test-results/**/*.xml
- name: Publish artifacts
# Security Measure: Do not publish artifacts from dependabot builds
if: github.event_name == 'push' && (github.actor != 'dependabot[bot]' || !contains(github.ref, 'dependabot'))
run: |
if [ ${{ github.ref }} == 'refs/heads/master' ] && [ ${{ github.repository_owner }} == 'SolaceProducts' ] ; then
echo "Using master on SolaceProducts"
git config --global user.name "GitHub Actions Automation"
git config --global user.email "<>"
mkdir gh-pages; # Now update gh-pages
git clone --quiet --branch=gh-pages https://${{ secrets.GH_TOKEN }}@github.com/SolaceProducts/pubsubplus-connector-kafka-sink gh-pages > /dev/null 2>&1;
rm gh-pages/downloads/pubsubplus-connector-kafka-sink*
mv build/distributions/pubsubplus-connector-kafka-sink* gh-pages/downloads
cd gh-pages;
pushd downloads
cp index.template index.html; FILENAME=`find . | grep *.zip | cut -d'/' -f2 | sed 's/.\{4\}$//'`; sed -i "s/CONNECTOR_NAME/$FILENAME/g" index.html;
popd;
git add -f .;
git commit -m "Latest connector distribution on successful build ${{ github.run_number }} auto-pushed to gh-pages";
git remote add origin-pages https://${{ secrets.GH_TOKEN }}@github.com/SolaceProducts/pubsubplus-connector-kafka-sink.git > /dev/null 2>&1;
git push --quiet --set-upstream origin-pages gh-pages;
echo "Updated and pushed GH pages!";
elif [ ${{ github.ref }} != 'refs/heads/gh-pages' ] && [ ${{ github.repository_owner }} != 'SolaceProducts' ] ; then
echo "Using ${{ github.ref }} on ${{ github.repository_owner }}"
git config --global user.name "GitHub Actions Automation"
git config --global user.email "<>"
mkdir gh-pages; # Now update gh-pages
git clone --quiet --branch=gh-pages https://${{ secrets.GH_TOKEN }}@github.com/${{ github.repository }} gh-pages > /dev/null 2>&1;
rm gh-pages/downloads/pubsubplus-connector-kafka-sink*
mv build/distributions/pubsubplus-connector-kafka-sink* gh-pages/downloads
cd gh-pages;
pushd downloads
cp index.template index.html; FILENAME=`find . | grep *.zip | cut -d'/' -f2 | sed 's/.\{4\}$//'`; sed -i "s/CONNECTOR_NAME/$FILENAME/g" index.html;
popd;
git add -f .;
git commit -m "Latest connector distribution on successful build ${{ github.run_number }} auto-pushed to gh-pages";
git remote add origin-pages https://${{ secrets.GH_TOKEN }}@github.com/${{ github.repository }}.git > /dev/null 2>&1;
git push --quiet --set-upstream origin-pages gh-pages;
echo "Updated and pushed GH pages!";
fi
- name: Cleanup Gradle Cache
# Remove some files from the Gradle cache, so they aren't cached by GitHub Actions.
# Restoring these files from a GitHub Actions cache might cause problems for future builds.
run: |
rm -f ~/.gradle/caches/modules-2/modules-2.lock
rm -f ~/.gradle/caches/modules-2/gc.properties
- name: Publish Unit Test Results
if: github.actor != 'dependabot[bot]' || (github.event_name == 'push' && !contains(github.ref, 'dependabot'))
uses: EnricoMi/publish-unit-test-result-action@v1
continue-on-error: true
with:
check_name: Unit Test Results
comment_mode: create new
fail_on: nothing
hide_comments: orphaned commits
files: |
**/build/test-results/**/*.xml
- name: Publish Test Coverage Results
if: github.event_name == 'pull_request' && github.actor != 'dependabot[bot]' && github.event.pull_request.head.repo.full_name == github.repository
uses: madrapps/[email protected]
with:
paths: build/reports/jacoco/jacocoFullReport/jacocoFullReport.xml
token: ${{ secrets.GITHUB_TOKEN }}