Adding PAT to the central contract repo URL in specmatic.json, settin… #178
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: Java CI with Gradle | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
repository_dispatch: | |
types: contracts changed | |
jobs: | |
build: | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
java: [17] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: { fetch-depth: 0 } | |
- name: Set up JDK ${{ matrix.java }} | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'oracle' | |
java-version: ${{ matrix.java }} | |
- name: Checkout Specmatic Kafka Repo | |
uses: actions/checkout@v4 | |
with: | |
repository: znsio/specmatic-kafka | |
path: specmatic-kafka | |
token: ${{ secrets.ACTIONS_GITHUB_TOKEN }} | |
- name: Grant execute permission for gradlew | |
working-directory: specmatic-kafka | |
run: chmod +x gradlew | |
- name: Publish Specmatic Kafka to Local Maven Repo | |
working-directory: specmatic-kafka | |
run: ./gradlew publishToMavenLocal | |
- name: Grant execute permission for gradlew on BFF repo | |
run: chmod +x gradlew | |
- name: Build BFF project with Gradle | |
env: | |
CENTRAL_CONTRACT_REPO_PAT: ${{ secrets.CENTRAL_CONTRACT_REPO_ACCESS_TOKEN }} | |
run: ./gradlew build | |
- name: Run coverage report | |
run: ./gradlew jacocoTestReport | |
- name: Generate JaCoCo Badge | |
id: jacoco | |
uses: cicirello/jacoco-badge-generator@v2 | |
with: | |
generate-branches-badge: true | |
jacoco-csv-file: build/reports/jacoco/test/jacocoTestReport.csv | |
if: matrix.os == 'ubuntu-latest' | |
- name: Log coverage percentage | |
run: | | |
echo "coverage = ${{ steps.jacoco.outputs.coverage }}" | |
echo "branch coverage = ${{ steps.jacoco.outputs.branches }}" | |
- name: Install Specmatic Insights Github Build Reporter | |
run: npm install -g specmatic-insights-github-build-reporter | |
- name: Run Specmatic Insights Github Build Reporter | |
working-directory: . | |
run: | | |
npx specmatic-insights-github-build-reporter --specmatic-insights-host https://insights.specmatic.in --specmatic-coverage ./build/reports/specmatic/coverage_report.json --specmatic-stub-usage ./build/reports/specmatic/stub_usage_report.json | |
env: | |
SPECMATIC_ORG_ID: ${{ secrets.SPECMATIC_ORG_ID }} | |
GITHUB_TOKEN: ${{ secrets.SPECMATIC_INSIGHTS_ACCESS_TOKEN }} | |
GITHUB_REF: ${{ github.ref }} | |
GITHUB_REF_NAME: ${{ github.ref_name }} | |
GITHUB_REPOSITORY: ${{ github.repository }} | |
GITHUB_RUN_ID: ${{ github.run_id }} | |
GITHUB_REPOSITORY_OWNER: ${{ github.repository_owner }} | |
GITHUB_REPOSITORY_ID: ${{ github.repository_id }} | |
GITHUB_SERVER_URL: ${{ github.server_url }} | |