Skip to content

Commit

Permalink
Introduce a workflow for linting and building.
Browse files Browse the repository at this point in the history
  • Loading branch information
airxnoor committed May 8, 2024
1 parent 0370058 commit 5852d0a
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 25 deletions.
14 changes: 14 additions & 0 deletions .github/actions/clone/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: "Clone code and set up Java"

runs:
using: "composite"
steps:
- name: "Clone code"
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: "Set up Adopt OpenJDK 17"
uses: actions/setup-java@v3
with:
distribution: adopt
java-version: 17
11 changes: 11 additions & 0 deletions .github/actions/lint/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: "Lint code"

runs:
using: "composite"
steps:
- name: "Clone code and set up Java"
uses: ./.github/actions/clone
- name: "Detekt"
run: sh gradlew detekt
- name: "KtLint"
run: sh gradlew ktlintCheck
21 changes: 21 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: "Lint and build code"

on:
push:
branches:
- "**"
- "!main"

jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: "Lint code"
uses: ./.github/actions/lint

build:
needs: lint
runs-on: macos-latest
steps:
- name: "Validate Gradle wrapper"
uses: gradle/wrapper-validation-action@v1
31 changes: 6 additions & 25 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,41 +1,22 @@
name: Publish
name: "Lint and build code, and publish artifacts to repository"

on:
push:
branches:
- main
- "main"

jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: "Clone repo"
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: "Set up Adopt OpenJDK 17"
uses: actions/setup-java@v3
with:
distribution: adopt
java-version: 17
- name: "Detekt"
run: sh gradlew detekt
- name: "KtLint"
run: sh gradlew ktlintCheck
- name: "Lint code"
uses: ./.github/actions/lint

build:
needs: lint
runs-on: macos-latest
steps:
- name: "Clone repo"
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: "Set up Adopt OpenJDK 17"
uses: actions/setup-java@v3
with:
distribution: adopt
java-version: 17
- name: Validate Gradle wrapper
- name: "Validate Gradle wrapper"
uses: gradle/wrapper-validation-action@v1

publish:
Expand Down

0 comments on commit 5852d0a

Please sign in to comment.