Skip to content

Commit

Permalink
Update dependencies and pimp this repo with github community config f…
Browse files Browse the repository at this point in the history
…iles
  • Loading branch information
ogesaku committed Jan 18, 2023
1 parent 57aae4f commit b8f7814
Show file tree
Hide file tree
Showing 14 changed files with 254 additions and 17 deletions.
77 changes: 77 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# 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
```

## Code conventions
This repository follows the [Kotlin coding conventions](https://kotlinlang.org/docs/reference/coding-conventions.html).
That are enforced by ktlint and [.editorconfig](../.editorconfig).

You can check style with:
```
./gradlew ktlintCheck
```

## Unit tests
We use [JUnit 5](https://junit.org/junit5/docs/current/user-guide/) for testing.
Please use the `Spec.kt` suffix on new test classes.

## Validate changes locally
Before submitting a pull request test your changes on a local project.
There are few ways for testing locally a gradle plugin:

**Publish plugin to the local maven repository**
Publish plugin to local repository with:
```sh
./gradlew publishToMavenLocal
```

...and add section to `settings.gradle.kts` to the sample project (that uses the tested plugin):
```kt
// Instruct a sample project to use maven local to find the plugin
pluginManagement {
repositories {
mavenLocal()
gradlePluginPortal()
}
}
```

**Import plugin jar**
Add plugin jar to the sample project (that uses the tested plugin):

```kt
buildscript {
dependencies {
classpath(files("<PLUGIN_PROJECT_PATH>/build/libs/manifest-plugin.jar"))
}
}

apply(plugin = "com.coditory.build")
```

## Validating plugin module metadata
The easiest way to validate plugin's module metadata is to publish the plugin to a dummy local repository.

Add to `build.gradle.kts`:
```
publishing {
repositories {
maven {
name = "localPluginRepository"
url = uri("./local-plugin-repository")
}
}
}
```

...and publish the plugin with:
```
./gradlew publish -Pversion=0.0.1
```
29 changes: 29 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
name: Bug report
about: Reporting bugs and other issues
labels: bug
---
<!-- The bug you're experiencing might have already be reported! -->
<!-- Please search in the [issues](https://github.com/coditory/gradle-manifest-plugin/issues) before creating one. -->

## Context
<!-- How has this issue affected you? What are you trying to accomplish? -->
<!-- Providing context helps us come up with a solution that is most useful in the real world -->

## Expected Behavior
<!-- Tell us what should happen -->

## Observed Behavior
<!-- Tell us what happens instead of the expected behavior -->

## Steps to Reproduce
<!-- Provide a link to a live example, or an unambiguous set of steps to -->
<!-- reproduce this bug. Include code to reproduce, if relevant -->

## Your Environment
<!-- Include as many relevant details about the environment you experienced the bug in -->
* Plugin 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):
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
blank_issues_enabled: false
18 changes: 18 additions & 0 deletions .github/ISSUE_TEMPLATE/feature-request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
name: Feature request
about: Suggest new features/changes
labels: feature
---
<!-- Your feature request may already be reported! -->
<!-- Please search in the [issues](https://github.com/coditory/gradle-manifest-plugin/issues) before creating a new one. -->

## Context
<!--- What are you trying to accomplish? -->
<!--- Providing context helps us come up with a solution that is most useful in the real world -->

## Expected Behavior
<!--- If you're suggesting a change/improvement, tell us how it should work -->
<!--- Propose a solution -->

## Current Behavior
<!--- If suggesting a change/improvement, explain the difference from the current behavior if it exists -->
10 changes: 10 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!-- Thanks for submitting a pull request! -->
## Changes
<!-- Shortly describe what you want to accomplish with this PR -->
<!-- Add a link to the issue if available -->

## Checklist
- [ ] I have tested that there is no similar [pull request](https://github.com/coditory/gradle-manifest-plugin/pulls) already submitted
- [ ] I have read [contributing.md](https://github.com/coditory/gradle-manifest-plugin/blob/master/.github/CONTRIBUTING.md) and applied to the rules
- [ ] I have unit tested code changes and performed a self-review
- [ ] I have [tested plugin change locally](https://github.com/coditory/gradle-manifest-plugin/blob/master/.github/CONTRIBUTING.md#validate-changes-locally) on a sample project
7 changes: 6 additions & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,9 @@ updates:
- package-ecosystem: "gradle"
directory: "/"
schedule:
interval: "monthly"
interval: "weekly"

- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
29 changes: 29 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
source:
- "src/**"

build:
- "**/*.gradle"
- "**/*.gradle.kts"

ci:
- ".github/**"

documentation:
- "**/*.md"
- "docs/**"

license:
- "LICENSE"

gradle:
- "gradlew"
- "gradlew.bat"
- ".gradle/**"
- "gradle/**"

git:
- ".gitignore"

style:
- ".editorconfig"
- ".idea/codeStyles/**"
4 changes: 1 addition & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
name: Build

on:
workflow_dispatch:
push:
on: [pull_request, push, workflow_dispatch]

jobs:
build:
Expand Down
38 changes: 38 additions & 0 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: "Pull Request"

on: [pull_request_target]

jobs:
label-pr:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- uses: actions/labeler@v4
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"

dependabot:
runs-on: ubuntu-latest
if: ${{ github.event.pull_request.user.login == 'dependabot[bot]' }}
permissions:
pull-requests: write
contents: write
steps:
- name: Dependabot metadata
id: dependabot-metadata
uses: dependabot/fetch-metadata@v1.3.1

- name: Enable auto-merge for Dependabot PRs
run: gh pr merge --auto --rebase "$PR_URL"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Approve patch and minor updates
if: ${{ steps.dependabot-metadata.outputs.update-type != 'version-update:semver-major' }}
run: gh pr review $PR_URL --approve -b "Pull request **approved** because **it includes a patch or minor update**"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8 changes: 4 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
fi
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v2
with:
fetch-depth: 0
token: ${{ secrets.CI_TOKEN }}
Expand All @@ -60,8 +60,8 @@ jobs:
declare -r NEXT_MANUAL_VERSION="${NEXT_INPUT_VERSION:-$NEXT_TAG_VERSION}"
declare -r NEXT_PATCH_VERSION="$MAJOR.$MINOR.$(( $PATCH + 1 ))"
declare -r NEXT_VERSION="${NEXT_MANUAL_VERSION:-$NEXT_PATCH_VERSION}"
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "next_version=$NEXT_VERSION" >> $GITHUB_OUTPUT
echo ::set-output name=version::$VERSION
echo ::set-output name=next_version::$NEXT_VERSION
echo -e "VERSION: $VERSION\nNEXT_VERSION: $NEXT_VERSION"
- name: Import GPG key
Expand Down Expand Up @@ -136,7 +136,7 @@ jobs:
-f previous_tag_name="v$PREV_VERSION" \
| jq -r '.body')"
declare -r ESCAPED="${NOTES//$'\n'/'%0A'}"
echo "notes=$ESCAPED" >> $GITHUB_OUTPUT
echo ::set-output name=notes::$ESCAPED
- name: Create github release (master only)
if: steps.notes.conclusion == 'success'
Expand Down
27 changes: 27 additions & 0 deletions .github/workflows/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: 'Stale issues and PRs'
on:
schedule:
- cron: '30 1 * * *'

jobs:
stale:
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v7
with:
# PRs
stale-pr-message: 'This PR is stale because it has been open 120 days with no activity. Remove stale label or comment or this will be closed in 10 days.'
days-before-pr-stale: 120
close-pr-message: 'This PR was closed because it has been stalled for 10 days with no activity.'
days-before-pr-close: 10
exempt-all-pr-assignees: true
exempt-pr-labels: 'awaiting-approval,work-in-progress'
stale-pr-label: 'stale'
# Issues
stale-issue-message: 'This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 5 days.'
days-before-issue-stale: 60
close-issue-message: 'This issue was closed because it has been stalled for 5 days with no activity.'
days-before-issue-close: 5
exempt-issue-assignees: true
exempt-issue-labels: 'awaiting-approval,work-in-progress'
stale-issue-label: 'stale'
6 changes: 3 additions & 3 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
kotlin("jvm") version "1.6.20"
kotlin("jvm") version "1.8.0"
id("jacoco")
id("com.github.kt3k.coveralls") version "2.12.0"
id("com.gradle.plugin-publish") version "1.0.0"
Expand All @@ -22,10 +22,10 @@ dependencies {
implementation(gradleApi())
implementation("org.eclipse.jgit:org.eclipse.jgit:6.4.0.202211300538-r")

testImplementation("org.assertj:assertj-core:3.23.1")
testImplementation("org.junit.jupiter:junit-jupiter-api:5.9.1")
testImplementation("org.junit.jupiter:junit-jupiter-params:5.9.1")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.9.1")
testImplementation("org.assertj:assertj-core:3.24.2")
testImplementation("org.junit.jupiter:junit-jupiter-api:5.9.2")
testImplementation("org.junit.jupiter:junit-jupiter-params:5.9.2")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.9.2")
}

group = "com.coditory.gradle"
Expand Down
7 changes: 6 additions & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
plugins {
id("com.gradle.enterprise").version("3.11.1")
id("com.gradle.enterprise").version("3.12.2")
}

gradleEnterprise {
buildScan {
termsOfServiceUrl = "https://gradle.com/terms-of-service"
termsOfServiceAgree = "yes"

if (!System.getenv("CI").isNullOrEmpty()) {
publishAlways()
tag("CI")
}
}
}

Expand Down

0 comments on commit b8f7814

Please sign in to comment.