From b8f78149e9a0cf0146c7a4213e6396f31768247b Mon Sep 17 00:00:00 2001 From: ogesaku Date: Wed, 18 Jan 2023 01:13:45 +0100 Subject: [PATCH] Update dependencies and pimp this repo with github community config files --- .github/CONTRIBUTING.md | 77 +++++++++++++++++++++++ .github/ISSUE_TEMPLATE/bug_report.md | 29 +++++++++ .github/ISSUE_TEMPLATE/config.yml | 1 + .github/ISSUE_TEMPLATE/feature-request.md | 18 ++++++ .github/PULL_REQUEST_TEMPLATE.md | 10 +++ .github/dependabot.yml | 7 ++- .github/labeler.yml | 29 +++++++++ .github/workflows/build.yml | 4 +- .github/workflows/pull-request.yml | 38 +++++++++++ .github/workflows/release.yml | 8 +-- .github/workflows/stale.yml | 27 ++++++++ .idea/codeStyles/Project.xml | 6 +- build.gradle.kts | 10 +-- settings.gradle.kts | 7 ++- 14 files changed, 254 insertions(+), 17 deletions(-) create mode 100644 .github/CONTRIBUTING.md create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md create mode 100644 .github/ISSUE_TEMPLATE/config.yml create mode 100644 .github/ISSUE_TEMPLATE/feature-request.md create mode 100644 .github/PULL_REQUEST_TEMPLATE.md create mode 100644 .github/labeler.yml create mode 100644 .github/workflows/pull-request.yml create mode 100644 .github/workflows/stale.yml diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md new file mode 100644 index 0000000..93b7e1b --- /dev/null +++ b/.github/CONTRIBUTING.md @@ -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("/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 +``` diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..07f5a1d --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,29 @@ +--- +name: Bug report +about: Reporting bugs and other issues +labels: bug +--- + + + +## Context + + + +## Expected Behavior + + +## Observed Behavior + + +## Steps to Reproduce + + + +## Your Environment + +* 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): diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000..3ba13e0 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1 @@ +blank_issues_enabled: false diff --git a/.github/ISSUE_TEMPLATE/feature-request.md b/.github/ISSUE_TEMPLATE/feature-request.md new file mode 100644 index 0000000..b07f07e --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature-request.md @@ -0,0 +1,18 @@ +--- +name: Feature request +about: Suggest new features/changes +labels: feature +--- + + + +## Context + + + +## Expected Behavior + + + +## Current Behavior + diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..783c3d4 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,10 @@ + +## Changes + + + +## 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 diff --git a/.github/dependabot.yml b/.github/dependabot.yml index dfa800a..9af0acf 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -3,4 +3,9 @@ updates: - package-ecosystem: "gradle" directory: "/" schedule: - interval: "monthly" + interval: "weekly" + + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" diff --git a/.github/labeler.yml b/.github/labeler.yml new file mode 100644 index 0000000..e7d2412 --- /dev/null +++ b/.github/labeler.yml @@ -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/**" diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8710bfe..a4a9914 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,8 +1,6 @@ name: Build -on: - workflow_dispatch: - push: +on: [pull_request, push, workflow_dispatch] jobs: build: diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml new file mode 100644 index 0000000..c9159c8 --- /dev/null +++ b/.github/workflows/pull-request.yml @@ -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 }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 02794ea..5f98859 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -38,7 +38,7 @@ jobs: fi - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v2 with: fetch-depth: 0 token: ${{ secrets.CI_TOKEN }} @@ -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 @@ -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' diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml new file mode 100644 index 0000000..80d3d6f --- /dev/null +++ b/.github/workflows/stale.yml @@ -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' diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml index c23569c..8130e52 100644 --- a/.idea/codeStyles/Project.xml +++ b/.idea/codeStyles/Project.xml @@ -10,9 +10,6 @@