From db60abeaec583b052e089e709ead9199c2e7707b Mon Sep 17 00:00:00 2001 From: Cesar Arata Date: Thu, 1 Dec 2022 15:45:17 +0100 Subject: [PATCH 1/5] feat: added java pull request action --- .github/workflows/java_app_pull_requests.yml | 38 ++++++++++++++++++++ README.md | 1 + 2 files changed, 39 insertions(+) create mode 100644 .github/workflows/java_app_pull_requests.yml diff --git a/.github/workflows/java_app_pull_requests.yml b/.github/workflows/java_app_pull_requests.yml new file mode 100644 index 0000000..6e9bf5c --- /dev/null +++ b/.github/workflows/java_app_pull_requests.yml @@ -0,0 +1,38 @@ +# +# File: ./.github/workflows/pull_requests.yml +# +name: Pull Request + +on: + pull_request: + +jobs: + commitlint: + # + # ensures commit messages follow conventional commits + # + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - uses: actions/setup-node@v1 + with: + node-version: 14 + - run: npm install --save-dev @commitlint/{config-conventional,cli} + - run: npx commitlint --from=${{ github.event.pull_request.base.sha }} + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set up JDK 8 + uses: actions/setup-java@v3 + with: + java-version: '8' + distribution: 'adopt' + - name: Validate Gradle wrapper + uses: gradle/wrapper-validation-action@e6e38bacfdf1a337459f332974bb2327a31aaf4b + - name: Build with Gradle + uses: gradle/gradle-build-action@67421db6bd0bf253fb4bd25b31ebb98943c375e1 + with: + arguments: build diff --git a/README.md b/README.md index cea499a..8b10a86 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,7 @@ This repo contains GitHub Action Workflow Templates for Kochava's various workfl | Go App | go_app | go/app/{version} | Used for Go application projects intended to be deployed as a Docker image. Tests/Lints on PRs, Creates a Release based on conventional commits when merged to main, Publishes Docker image on Release. | | Go Library | go_lib | go/lib/{version} | Used for Go library projects intended to be imported. Tests/Lints on PRs, Creates a Release based on conventional commits when merged to main. | | PHP Library | php_lib | php/lib/{version} | Used for PHP library projects intended to be imported. Tests/Lints on PRs, Creates a Release based on conventional commits when merged to main. | +| Java Library | java_lib | java/lib/{version} | Used for Java application projects intended to be deployed as a Jar file. Tests/Lints on PRs, Creates a Release based on conventional commits when merged to main. | ## Versioning From 3bb72fbe8cbedb1b489109cc682523ad8209862f Mon Sep 17 00:00:00 2001 From: Cesar Arata Date: Thu, 1 Dec 2022 15:48:53 +0100 Subject: [PATCH 2/5] fix: rename lib for app in the readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8b10a86..f03db8e 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ This repo contains GitHub Action Workflow Templates for Kochava's various workfl | Go App | go_app | go/app/{version} | Used for Go application projects intended to be deployed as a Docker image. Tests/Lints on PRs, Creates a Release based on conventional commits when merged to main, Publishes Docker image on Release. | | Go Library | go_lib | go/lib/{version} | Used for Go library projects intended to be imported. Tests/Lints on PRs, Creates a Release based on conventional commits when merged to main. | | PHP Library | php_lib | php/lib/{version} | Used for PHP library projects intended to be imported. Tests/Lints on PRs, Creates a Release based on conventional commits when merged to main. | -| Java Library | java_lib | java/lib/{version} | Used for Java application projects intended to be deployed as a Jar file. Tests/Lints on PRs, Creates a Release based on conventional commits when merged to main. | +| Java Library | java_app | java/app/{version} | Used for Java application projects intended to be deployed as a Jar file. Tests/Lints on PRs, Creates a Release based on conventional commits when merged to main. | ## Versioning From 416522a6f6d94fafbf8052a924870c737e3c7cbb Mon Sep 17 00:00:00 2001 From: Cesar Arata Date: Thu, 1 Dec 2022 16:44:47 +0100 Subject: [PATCH 3/5] fix: change the value for on so does not run on this repo and can be called by other repos --- .github/workflows/java_app_pull_requests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/java_app_pull_requests.yml b/.github/workflows/java_app_pull_requests.yml index 6e9bf5c..1681e7b 100644 --- a/.github/workflows/java_app_pull_requests.yml +++ b/.github/workflows/java_app_pull_requests.yml @@ -4,7 +4,7 @@ name: Pull Request on: - pull_request: + workflow_call: jobs: commitlint: From 499b10ce28a928fe04bad129145b848febd21ed7 Mon Sep 17 00:00:00 2001 From: Cesar Arata Date: Thu, 15 Dec 2022 14:17:00 +0100 Subject: [PATCH 4/5] chore: rename java app file to gradle app since we can generate java or kotlin builds with this --- ...quests.yml => gradle_app_pull_request.yml} | 28 +++++++++++++++++-- README.md | 2 +- 2 files changed, 26 insertions(+), 4 deletions(-) rename .github/workflows/{java_app_pull_requests.yml => gradle_app_pull_request.yml} (53%) diff --git a/.github/workflows/java_app_pull_requests.yml b/.github/workflows/gradle_app_pull_request.yml similarity index 53% rename from .github/workflows/java_app_pull_requests.yml rename to .github/workflows/gradle_app_pull_request.yml index 1681e7b..63b8577 100644 --- a/.github/workflows/java_app_pull_requests.yml +++ b/.github/workflows/gradle_app_pull_request.yml @@ -21,18 +21,40 @@ jobs: node-version: 14 - run: npm install --save-dev @commitlint/{config-conventional,cli} - run: npx commitlint --from=${{ github.event.pull_request.base.sha }} + lint: + # + # runs kotlin lint + # https://github.com/github/super-linter + # + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: Lint Code Base + uses: github/super-linter/slim@v4 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + FILTER_REGEX_INCLUDE: .*src/.* build: + # + # ensures build & tests pass + # + # gradle build task is included in the build task unless is explicitly excluded in you build.gradle + # runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - name: Checkout code + uses: actions/checkout@v3 - name: Set up JDK 8 uses: actions/setup-java@v3 with: java-version: '8' distribution: 'adopt' - name: Validate Gradle wrapper - uses: gradle/wrapper-validation-action@e6e38bacfdf1a337459f332974bb2327a31aaf4b + uses: gradle/wrapper-validation-action@v1 - name: Build with Gradle - uses: gradle/gradle-build-action@67421db6bd0bf253fb4bd25b31ebb98943c375e1 + uses: gradle/gradle-build-action@v1 with: arguments: build diff --git a/README.md b/README.md index f03db8e..898130f 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ This repo contains GitHub Action Workflow Templates for Kochava's various workfl | Go App | go_app | go/app/{version} | Used for Go application projects intended to be deployed as a Docker image. Tests/Lints on PRs, Creates a Release based on conventional commits when merged to main, Publishes Docker image on Release. | | Go Library | go_lib | go/lib/{version} | Used for Go library projects intended to be imported. Tests/Lints on PRs, Creates a Release based on conventional commits when merged to main. | | PHP Library | php_lib | php/lib/{version} | Used for PHP library projects intended to be imported. Tests/Lints on PRs, Creates a Release based on conventional commits when merged to main. | -| Java Library | java_app | java/app/{version} | Used for Java application projects intended to be deployed as a Jar file. Tests/Lints on PRs, Creates a Release based on conventional commits when merged to main. | +| Gradle Library | gradle_app | gradle/app/{version} | Used for Gradle Java/Kotlin application projects intended to be deployed as a Jar file. Tests/Lints on PRs, Creates a Release based on conventional commits when merged to main. | ## Versioning From 647e0ee6cde45035071958ab636bf559f12def6f Mon Sep 17 00:00:00 2001 From: Cesar Arata Date: Thu, 15 Dec 2022 14:19:35 +0100 Subject: [PATCH 5/5] chore: fix docs --- .github/workflows/gradle_app_pull_request.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/gradle_app_pull_request.yml b/.github/workflows/gradle_app_pull_request.yml index 63b8577..1a9780d 100644 --- a/.github/workflows/gradle_app_pull_request.yml +++ b/.github/workflows/gradle_app_pull_request.yml @@ -23,7 +23,7 @@ jobs: - run: npx commitlint --from=${{ github.event.pull_request.base.sha }} lint: # - # runs kotlin lint + # runs java/kotlin lint # https://github.com/github/super-linter # runs-on: ubuntu-latest