Skip to content

AJ-1095: Publish Library and CLI #129

AJ-1095: Publish Library and CLI

AJ-1095: Publish Library and CLI #129

Workflow file for this run

name: Build and Test
on:
push:
branches: [ main ]
paths-ignore: [ '*.md' ]
pull_request:
branches: [ '**' ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: 'gradle'
- name: Build all projects without running tests
run: ./gradlew --build-cache build -x test
source-clear:
needs: [ build ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: 'gradle'
- name: SourceClear scan
env:
SRCCLR_API_TOKEN: ${{ secrets.SRCCLR_API_TOKEN }}
run: ./gradlew --build-cache srcclr
unit-tests-and-sonarqube:
needs: [ build ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
# Needed by sonar to get the git history for the branch the PR will be merged into.
with:
fetch-depth: 0
- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: 'gradle'
- name: Test with coverage
run: ./gradlew --build-cache test jacocoTestReport
- name: SonarQube scan for library
run: ./gradlew --build-cache :library:sonar --info
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: SonarQube scan for cli
run: ./gradlew --build-cache :cli:sonar --info
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
notify-slack-on-failure:
needs: [ build, unit-tests-and-sonarqube, source-clear ]
runs-on: ubuntu-latest
if: failure() && github.ref == 'refs/heads/main'
steps:
- name: Notify slack on failure
uses: broadinstitute/action-slack@v3.8.0
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
with:
channel: '#dsp-analysis-journeys-alerts'
status: failure
author_name: Build on dev
fields: job,message
text: 'Build failed :sadpanda:'
username: 'Java-PFB GitHub Action'
tag:
needs: [ build, unit-tests-and-sonarqube, source-clear ]
uses: ./.github/workflows/tag.yml
if: success() && github.ref == 'refs/heads/main'
publish-library:
needs: [ build, unit-tests-and-sonarqube, source-clear, tag ]
uses: ./.github/workflows/publish.yml
if: success() && github.ref == 'refs/heads/main'
release-cli:
needs: [ build, unit-tests-and-sonarqube, source-clear, tag, publish-library ]
uses: ./.github/workflows/release-cli.yml
if: success() && github.ref == 'refs/heads/main'