Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build workflow #3

Merged
merged 2 commits into from
Aug 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions .github/workflows/assemble-jobs.yaml
Original file line number Diff line number Diff line change
@@ -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
37 changes: 37 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -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 }}
39 changes: 39 additions & 0 deletions .github/workflows/test-jobs.yaml
Original file line number Diff line number Diff line change
@@ -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
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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)
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {
}

group = "com.github.makeitvsolo"
version = "0.1.0"
version = "0.2.0"

application {
mainClass = "com.github.makeitvsolo.jtemplate.Application"
Expand Down