Skip to content

Commit

Permalink
add ci
Browse files Browse the repository at this point in the history
  • Loading branch information
makeevrserg committed May 25, 2024
1 parent 8cb49e4 commit 42c7746
Show file tree
Hide file tree
Showing 6 changed files with 115 additions and 2 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/build-project.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: "detekt-validation"
on:
workflow_call:
jobs:
build:
name: Build project with gradle
runs-on: ubuntu-latest
strategy:
matrix:
target: [ "fabric", "forge", "velocity", "plugin" ]
steps:
- name: Checkout Git repo
uses: actions/checkout@v4
- name: Set up JDK 1.21
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21'
- name: Give gradle permission
run: chmod +x gradlew
- name: Build with Gradle
uses: gradle/gradle-build-action@v3
with:
arguments: ${{ matrix.target }}:build --stacktrace
20 changes: 20 additions & 0 deletions .github/workflows/detekt-validation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: "detekt-validation"
on:
workflow_call:
jobs:
detekt:
name: "Check project by detekt"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 1.21
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21'
- name: Give gradle permission
run: chmod +x gradlew
- name: detekt
uses: gradle/gradle-build-action@v3
with:
arguments: detekt
12 changes: 12 additions & 0 deletions .github/workflows/gradle-wrapper-validation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: "gradle-wrapper-validation"
on:
workflow_call:

jobs:
validation:
name: "Gradle Wrapper Validation"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v3
36 changes: 36 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Pull request
on:
pull_request:
branches:
- 'develop'
- 'master'
- 'prerelease/*'

# Concurrency strategy:
# github.workflow: distinguish this workflow from others
# github.event_name: distinguish `push` event from `pull_request` event
# github.ref_name: distinguish branch
# github.repository: distinguish owner+repository
#
# Reference:
# https://docs.github.com/en/actions/using-jobs/using-concurrency
# https://docs.github.com/en/actions/learn-github-actions/contexts#github-context
concurrency:
group: ${{ github.workflow }}-${{ github.event_name }}-${{github.ref_name}}-${{github.repository}}
cancel-in-progress: true

jobs:
gradle_validation:
name: Validate gradle wrapper
uses: ./.github/workflows/gradle-wrapper-validation.yml
detekt_validation:
name: Check by detekt
needs: gradle_validation
uses: ./.github/workflows/detekt-validation.yml
tests_validation:
needs: gradle_validation
uses: ./.github/workflows/tests-validation.yml
build:
name: Build project
needs: [ gradle_validation, detekt_validation, tests_validation ]
uses: ./.github/workflows/build-project.yml
21 changes: 21 additions & 0 deletions .github/workflows/tests-validation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: "tests"
on:
workflow_call:

jobs:
tests:
name: "Run tests"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 1.21
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21'
- name: Give gradle permission
run: chmod +x gradlew
- name: Run tests
uses: gradle/gradle-build-action@v3
with:
arguments: test
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ kotlin.code.style=official
org.gradle.jvmargs=-Xmx4000m
# Java
makeevrserg.java.source=8
makeevrserg.java.target=17
makeevrserg.java.ktarget=17
makeevrserg.java.target=21
makeevrserg.java.ktarget=21
# Project
makeevrserg.project.name=AstraTemplate
makeevrserg.project.group=ru.astrainteractive.astratemplate
Expand Down

0 comments on commit 42c7746

Please sign in to comment.