Skip to content

Commit

Permalink
add ci
Browse files Browse the repository at this point in the history
  • Loading branch information
btwonion committed Mar 29, 2024
1 parent 07e7a84 commit 876718d
Show file tree
Hide file tree
Showing 4 changed files with 110 additions and 0 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/build-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Used when a commit is pushed to the repository
# This makes use of caching for faster builds and uploads the resulting artifacts
name: build-commit

on: [ push ]

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Extract current branch name
shell: bash
# bash pattern expansion to grab branch name without slashes
run: ref="${GITHUB_REF#refs/heads/}" && echo "branch=${ref////-}" >> $GITHUB_OUTPUT
id: ref
- name: Checkout sources
uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 17
- name: Initialize caches
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/loom-cache
~/.gradle/wrapper
key: ${{ runner.os }}-build-commit-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-build-commit-
- name: Build artifacts
run: ./gradlew build
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: telekinesis-artifacts-${{ steps.ref.outputs.branch }}
path: build/libs/*.jar
29 changes: 29 additions & 0 deletions .github/workflows/build-pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Used when building external pull requests
# We don't want to publish build artifacts or expose our other caches to possibly untrusted code
name: build-pull-request

on: [ pull_request ]

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Initialize caches
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/loom-cache
~/.gradle/wrapper
key: ${{ runner.os }}-build-external-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-build-external-
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 17
- name: Build artifacts
run: ./gradlew build
22 changes: 22 additions & 0 deletions .github/workflows/ktlint-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: ktlint-commit

on: [ push ]

jobs:
ktlint:
name: Check Code Quality
runs-on: ubuntu-latest

steps:
- name: Clone repo
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: ktlint
uses: ScaCap/action-ktlint@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
reporter: github-check
filter_mode: nofilter
level: info
fail_on_error: true
20 changes: 20 additions & 0 deletions .github/workflows/ktlint-pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: ktlint-pull-request

on: [ pull_request ]

jobs:
ktlint:
name: Check Code Quality
runs-on: ubuntu-latest

steps:
- name: Clone repo
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: ktlint
uses: ScaCap/action-ktlint@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
reporter: github-pr-review
level: info

0 comments on commit 876718d

Please sign in to comment.