From 2ba3050ad15136de09e1e63275a3bd3619c67838 Mon Sep 17 00:00:00 2001 From: makeitvsolo Date: Sat, 17 Aug 2024 13:40:08 +0300 Subject: [PATCH 1/2] #1 build workflow --- .github/workflows/assemble-jobs.yaml | 39 ++++++++++++++++++++++++++++ .github/workflows/build.yaml | 37 ++++++++++++++++++++++++++ .github/workflows/test-jobs.yaml | 39 ++++++++++++++++++++++++++++ 3 files changed, 115 insertions(+) create mode 100644 .github/workflows/assemble-jobs.yaml create mode 100644 .github/workflows/build.yaml create mode 100644 .github/workflows/test-jobs.yaml diff --git a/.github/workflows/assemble-jobs.yaml b/.github/workflows/assemble-jobs.yaml new file mode 100644 index 0000000..8cf175b --- /dev/null +++ b/.github/workflows/assemble-jobs.yaml @@ -0,0 +1,39 @@ +name: Assemble jobs + +on: + workflow_call: + inputs: + jdk-version: + type: number + required: true + jdk-distribution: + type: string + required: true + +jobs: + assemble: + runs-on: ubuntu-latest + steps: + - id: checkout + name: Checkout repository + uses: actions/checkout@v4 + + - id: setup-jdk + name: Setup jdk ${{ inputs.jdk-version }}-${{ inputs.jdk-distribution }} + uses: actions/setup-java@v4 + with: + java-version: ${{ inputs.jdk-version }} + distribution: ${{ inputs.jdk-distribution }} + + - name: Restore Cache + uses: actions/cache@v4 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }} + restore-keys: ${{ runner.os }}-gradle- + + - id: gradle-assemble + name: Gradle assemble + run: ./gradlew assemble diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 0000000..df6ffb9 --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,37 @@ +name: Build + +on: + workflow_dispatch: + pull_request: + branches: + - main + types: + - opened + - reopened + +jobs: + assemble-jobs: + strategy: + fail-fast: true + matrix: + jdk-version: + - 21 + jdk-distribution: + - temurin + uses: ./.github/workflows/assemble-jobs.yaml + with: + jdk-version: ${{ matrix.jdk-version }} + jdk-distribution: ${{ matrix.jdk-distribution }} + + test-jobs: + strategy: + fail-fast: true + matrix: + jdk-version: + - 21 + jdk-distribution: + - temurin + uses: ./.github/workflows/test-jobs.yaml + with: + jdk-version: ${{ matrix.jdk-version }} + jdk-distribution: ${{ matrix.jdk-distribution }} diff --git a/.github/workflows/test-jobs.yaml b/.github/workflows/test-jobs.yaml new file mode 100644 index 0000000..9884323 --- /dev/null +++ b/.github/workflows/test-jobs.yaml @@ -0,0 +1,39 @@ +name: Test jobs + +on: + workflow_call: + inputs: + jdk-version: + type: number + required: true + jdk-distribution: + type: string + required: true + +jobs: + test: + runs-on: ubuntu-latest + steps: + - id: checkout + name: Checkout repository + uses: actions/checkout@v4 + + - id: setup-jdk + name: Setup jdk ${{ inputs.jdk-version }}-${{ inputs.jdk-distribution }} + uses: actions/setup-java@v4 + with: + java-version: ${{ inputs.jdk-version }} + distribution: ${{ inputs.jdk-distribution }} + + - name: Restore Cache + uses: actions/cache@v4 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }} + restore-keys: ${{ runner.os }}-gradle- + + - id: gradle-test + name: Gradle test + run: ./gradlew test From b3af334210feca70fb3c7601ff69c3f3178f0e51 Mon Sep 17 00:00:00 2001 From: makeitvsolo Date: Sat, 17 Aug 2024 13:40:17 +0300 Subject: [PATCH 2/2] update manifest files --- README.md | 14 ++++++++++++++ build.gradle.kts | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d1bb9e6..6bdebff 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,17 @@ # jtemplate Template repository for java projects. + +## Workflows + +Repository includes ready-to-use [GitHub-Workflows specs](https://docs.github.com/en/actions/writing-workflows). + +### Build workflow + +Build workflow triggers during the opening of the pull-request into main branch. +It checks that your project compiles successfully and passes all tests. + +Configuration: +- [build spec](https://github.com/makeitvsolo/jtemplate/blob/main/.github/workflows/build.yaml) +- [assemble job spec](https://github.com/makeitvsolo/jtemplate/blob/main/.github/workflows/assemble-job.yaml) +- [test job spec](https://github.com/makeitvsolo/jtemplate/blob/main/.github/workflows/test-job.yaml) diff --git a/build.gradle.kts b/build.gradle.kts index 72d4dd6..a665009 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -4,7 +4,7 @@ plugins { } group = "com.github.makeitvsolo" -version = "0.1.0" +version = "0.2.0" application { mainClass = "com.github.makeitvsolo.jtemplate.Application"