Skip to content

Commit

Permalink
Update dependencies and workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
ogesaku committed Feb 6, 2024
1 parent ef94738 commit 0ae6a6a
Show file tree
Hide file tree
Showing 23 changed files with 384 additions and 374 deletions.
32 changes: 18 additions & 14 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Contributing

## Commit messages
Before writing a commit message read [this article](https://chris.beams.io/posts/git-commit/).

## Build
Before pushing any changes make sure project builds without errors with:
`./gradlew build`
Expand All @@ -15,20 +18,11 @@ It can be also generated in IDE or via command line with `./gradlew build covera

## Validate changes locally
Before submitting a pull request test your changes locally on a sample project.
You can test locally by publishing this library to maven local repository with
`./gradlew publishToMavenLocal -Pversion=...`.
There are few ways for local testing:

## Formatting
There are no enforced code style rules for Java and Groovy sources.
Just please use IntelliJ code styles from "Project scheme" (`.idea/codeStyles`).

Kotlin codestyle is enforced by [Ktlint](https://pinterest.github.io/ktlint/).
Ktlint rules are already propagated to `.idea/codeStyles`.
You can validate Kotlin code style in command line with
`./gradlew ktlintCheck`.

## Commit messages
Before writing a commit message read [this article](https://chris.beams.io/posts/git-commit/).
- simply use one of the [sample subprojects](https://github.com/coditory/quark-context/tree/master/samples)
- or publish library to maven local repository with `./gradlew publishToMavenLocal` and use it in any project
via [`mavenLocal()`](https://docs.gradle.org/current/userguide/declaring_repositories.html#sub:maven_local) repository

## Validating with snapshot release
Snapshot release is triggered manually by code owners.
Expand All @@ -42,4 +36,14 @@ repositories {
url = URI("https://oss.sonatype.org/content/repositories/snapshots")
}
}
```
```

The snapshot version can be found in GitHub Action build log.

## Formatting
There are no enforced code style rules for Java and Groovy sources.
Just please use IntelliJ code styles from "Project scheme" (`.idea/codeStyles`).

## Documentation
If change adds new feature or modifies a new one
update [documentation](https://github.com/coditory/quark-context/tree/master/samples).
1 change: 0 additions & 1 deletion .github/FUNDING.yml

This file was deleted.

3 changes: 1 addition & 2 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ labels: bug

## Your Environment
<!-- Include as many relevant details about the environment you experienced the bug in -->

* Library version:
* Java (and/or Kotlin) version:
* Gradle version:
* Gradle scan link (add `--scan` option when running the gradle task):
* Link to your project (if it's a public repository):
59 changes: 0 additions & 59 deletions .github/workflows/build-report.yml

This file was deleted.

112 changes: 94 additions & 18 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,37 +1,113 @@
name: Build

on: [push, pull_request, workflow_dispatch]
on:
pull_request:
workflow_dispatch:
push:
tags:
- 'v*'
branches-ignore:
- 'dependabot/**'
- 'gh-pages'

jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 15
if: |
github.event_name != 'pull_request' ||
github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
(github.event_name != 'pull_request' && ! github.event.pull_request.head.repo.fork)
|| (github.event_name == 'pull_request' && (github.event.pull_request.head.repo.fork || startsWith(github.head_ref, 'dependabot/')))
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Validate gradle wrapper
uses: gradle/wrapper-validation-action@v1
- name: Setup Gradle
uses: gradle/gradle-build-action@v2

- name: Setup jdk
uses: actions/setup-java@v3
- name: Setup JDK
uses: actions/setup-java@v4
with:
java-version: 17
java-version: 21
cache: gradle
distribution: temurin

- name: Build with gradle
- name: Build
run: ./gradlew build coverage

- name: Upload build reports
uses: actions/upload-artifact@v3
if: always()
- name: Publish Test Report
if: success() || failure() # run this step even if previous step failed
continue-on-error: true
uses: dorny/test-reporter@v1
with:
name: test report
path: ./**/build/test-results/test/*.xml
reporter: java-junit

- name: Publish Coverage Report
uses: codecov/codecov-action@v3
if: github.repository == 'coditory/quark-context' && github.ref == 'refs/heads/main'
continue-on-error: true
with:
token: ${{ secrets.CODECOV_TOKEN }}
override_commit: ${{ github.event.workflow_run.head_sha }}
override_branch: ${{ github.event.workflow_run.head_branch }}
override_build: ${{ github.event.workflow_run.id }}
files: 'build/reports/kover/report.xml'

- name: Import GPG Key
id: gpg
uses: crazy-max/ghaction-import-gpg@v6
if: |
github.repository == 'coditory/quark-context' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v'))
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}
git_user_signingkey: true
git_commit_gpgsign: true
git_committer_name: Coditory Bot
git_committer_email: [email protected]

- name: Publish Snapshot
if: github.repository == 'coditory/quark-context' && github.ref == 'refs/heads/main' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch')
env:
SIGNING_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
SIGNING_PASSWORD: ${{ secrets.GPG_PASSPHRASE }}
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
run: ./gradlew publishToSonatype version

- name: Publish Release
id: publish-release
if: github.repository == 'coditory/quark-context' && startsWith(github.ref, 'refs/tags/v') && (github.event_name == 'push' || github.event_name == 'release' || github.event_name == 'workflow_dispatch')
env:
SIGNING_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
SIGNING_PASSWORD: ${{ secrets.GPG_PASSPHRASE }}
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
OSSRH_STAGING_PROFILE_ID: ${{ secrets.OSSRH_STAGING_PROFILE_ID }}
run: ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository version -Pversion=${GITHUB_REF_NAME:1}

- name: Generate Release Notes
id: generate-release-notes
if: steps.publish-release.conclusion == 'success'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
declare -r NOTES="$(gh api \
--method POST \
-H "Accept: application/vnd.github+json" \
/repos/${{ github.repository }}/releases/generate-notes \
-f target_commitish='main' \
| jq -r '.body')"
declare -r ESCAPED="${NOTES//$'\n'/'%0A'}"
echo "notes=$ESCAPED" >> $GITHUB_OUTPUT
- name: Create github release
if: steps.generate-release-notes.conclusion == 'success'
uses: ncipollo/release-action@v1
with:
name: build-reports
retention-days: 7
path: |
**/build/test-results/*/TEST-*.xml
**/build/reports/jacoco/*/*.xml
allowUpdates: true
body: ${{ steps.notes.outputs.notes }}
token: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ jobs:
contents: read
pull-requests: write
steps:
- uses: actions/labeler@v4
- uses: actions/labeler@v5
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
Loading

0 comments on commit 0ae6a6a

Please sign in to comment.