Skip to content

Merge pull request #390 from usefulness/mateuszkwiecinski-patch-1 #521

Merge pull request #390 from usefulness/mateuszkwiecinski-patch-1

Merge pull request #390 from usefulness/mateuszkwiecinski-patch-1 #521

name: Build Project
on:
pull_request:
push:
branches:
- master
- main
- trunk
- develop
- maine
- mane
schedule:
- cron: '0 3 * * 1,4'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 21
- uses: gradle/actions/wrapper-validation@v3
- uses: gradle/actions/setup-gradle@v3
with:
dependency-graph: generate-and-submit
- run: ./gradlew projectCodestyle --scan
env:
GITHUB_DEPENDENCY_GRAPH_JOB_CORRELATOR: dependency-graph-codestyle
- run: ./gradlew assemble --scan
env:
GITHUB_DEPENDENCY_GRAPH_JOB_CORRELATOR: dependency-graph-assemble
- run: ./gradlew check --scan
env:
GITHUB_DEPENDENCY_GRAPH_JOB_CORRELATOR: dependency-graph-check
- run: ./gradlew projectCoverage --scan
env:
GITHUB_DEPENDENCY_GRAPH_JOB_CORRELATOR: dependency-graph-coverage
- run: ./gradlew publishToMavenLocal
env:
GITHUB_DEPENDENCY_GRAPH_JOB_CORRELATOR: dependency-graph-publish
- run: git diff --exit-code
- uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
- uses: actions/upload-artifact@v4
if: ${{ always() }}
with:
name: test-results
path: "${{ github.workspace }}/**/build/reports/tests"
- uses: actions/upload-artifact@v4
with:
name: jacoco-report
path: "${{ github.workspace }}/**/build/reports/jacoco"
- name: Unwrap GPG key
env:
GPG_KEY_CONTENTS: ${{ secrets.GPG_KEY_CONTENTS }}
SIGNING_SECRET_KEY_RING_FILE: ${{ secrets.SIGNING_SECRET_KEY_RING_FILE }}
run: sudo bash -c "echo '$GPG_KEY_CONTENTS' | base64 -d > '$SIGNING_SECRET_KEY_RING_FILE'"
- run: ./gradlew publishToMavenLocal
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }}
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
SIGNING_SECRET_KEY_RING_FILE: ${{ secrets.SIGNING_SECRET_KEY_RING_FILE }}
- run: git diff --exit-code
- uses: actions/cache@v4
name: Upload base
if: github.event_name != 'pull_request'
with:
path: diffuse-source-file
key: diffuse-${{ github.sha }}
- run: find . -regex ".*issuechecker/build/libs/issuechecker-[0-9SNAPSHOT\.-]*\.jar" -print | xargs -n 1 -I % cp % diffuse-source-file
if: github.event_name != 'pull_request'
shell: bash
- uses: actions/cache@v4
name: Download base
if: github.event_name == 'pull_request'
with:
path: diffuse-source-file
key: diffuse-${{ github.event.pull_request.base.sha }}
- run: find . -regex ".*issuechecker/build/libs/issuechecker-[0-9SNAPSHOT\.-]*\.jar" -print | xargs -n 1 -I % cp % pull-request-artifact.jar
if: github.event_name == 'pull_request'
shell: bash
- id: diffuse
if: github.event_name == 'pull_request'
uses: usefulness/diffuse-action@v0.10.1
with:
old-file-path: diffuse-source-file
new-file-path: pull-request-artifact.jar
- uses: peter-evans/find-comment@v3
if: github.event_name == 'pull_request'
id: find_comment
with:
issue-number: ${{ github.event.pull_request.number }}
body-includes: Diffuse output
- uses: peter-evans/create-or-update-comment@v4
if: ${{ steps.diffuse.outputs.diff-raw != null || steps.find_comment.outputs.comment-id != null }}
with:
body: |
### Jar size:
Jar size change: ${{ steps.diffuse.outputs.size-diff-comment_style_1 }}
### Diffuse output:
${{ steps.diffuse.outputs.diff-gh-comment }}
edit-mode: replace
comment-id: ${{ steps.find_comment.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/upload-artifact@v4
if: github.event_name == 'pull_request'
with:
name: diffuse-output
path: ${{ steps.diffuse.outputs.diff-file }}