Skip to content

[AJ-1783]: Bump org.jfrog.buildinfo:build-info-extractor-gradle from … #265

[AJ-1783]: Bump org.jfrog.buildinfo:build-info-extractor-gradle from …

[AJ-1783]: Bump org.jfrog.buildinfo:build-info-extractor-gradle from … #265

name: Build, Test and Publish
on:
workflow_dispatch:
inputs:
publish:
description: 'If true, run the tag and publish jobs'
required: true
type: boolean
default: false
push:
branches: [ main ]
paths-ignore:
- '*.md'
- 'settings.gradle' # Avoid running workflows on version bumps
pull_request:
branches: [ '**' ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v4
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@v4
- name: Set up JDK
uses: actions/setup-java@v4
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@v4
# 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@v4
with:
java-version: '17'
distribution: 'temurin'
cache: 'gradle'
- name: Test with coverage
run: ./gradlew --build-cache test jacocoTestReport --scan
- 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 }}
tag:
needs: [ build, unit-tests-and-sonarqube, source-clear ]
uses: ./.github/workflows/tag.yml
if: success() && ((github.ref == 'refs/heads/main' && github.event_name != 'workflow_dispatch') || (github.event_name == 'workflow_dispatch' && inputs.publish))
secrets: inherit
publish-library:
needs: [ tag ]
uses: ./.github/workflows/publish.yml
if: success() && ((github.ref == 'refs/heads/main' && github.event_name != 'workflow_dispatch') || (github.event_name == 'workflow_dispatch' && inputs.publish))
secrets: inherit
with:
tag: ${{ needs.tag.outputs.tag }}
release-cli:
needs: [ tag ]
uses: ./.github/workflows/release-cli.yml
secrets: inherit
if: success() && ((github.ref == 'refs/heads/main' && github.event_name != 'workflow_dispatch') || (github.event_name == 'workflow_dispatch' && inputs.publish))
with:
tag: ${{ needs.tag.outputs.tag }}
notify-slack-on-failure:
needs: [ build, unit-tests-and-sonarqube, source-clear, tag, publish-library, release-cli ]
runs-on: ubuntu-latest
if: failure() && github.ref == 'refs/heads/main'
steps:
- name: Notify slack on failure
uses: broadinstitute/action-slack@v3.15.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'