Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Deftu committed Jun 18, 2024
0 parents commit 0f26612
Show file tree
Hide file tree
Showing 24 changed files with 1,112 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto
9 changes: 9 additions & 0 deletions .github/assets/build-pr-failure.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<!-- workflow comment -->

## 🔴 Failed to build artifacts!
Please check the logs below for issues.

| Name | Link |
|--------| -------------------------------- |
| Commit | {{ .commit }} |
| Logs | {{ .logs | mdlink "View logs" }} |
11 changes: 11 additions & 0 deletions .github/assets/build-pr-success.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!-- workflow comment -->

## 🟢 Successfully built artifacts!

File expires: `{{ .expire | date "01 Sep 2006 20:00:00" }}`

| Name | Link |
|----------|------------------------|
| Commit | {{ .commit }} |
| Logs | {{ .logs | "View logs" }} |
| Download | {{ .download | mdlink "Download" }} |
3 changes: 3 additions & 0 deletions .github/assets/build-pr.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<!-- workflow comment -->

## 🟠 Running workflows for Pull Request...
121 changes: 121 additions & 0 deletions .github/workflows/build-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
name: Build and Comment on Pull Request

on:
pull_request_target:
types: [opened, reopened, synchronize]
branches:
- '*'
paths-ignore:
- 'README'
- 'README.md'
- 'LICENSE'
- 'LICENSE.md'

concurrency:
group: '${{ github.workflow }}-${{ github.head_ref }}'
cancel-in-progress: false

permissions:
issues: write
pull-requests: write

jobs:
build-and-comment:
runs-on: ubuntu-latest
outputs:
comment_id: ${{ steps.comment.outputs.comment-id }}
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
ref: refs/pull/${{ github.event.pull_request.number }}/merge

- name: Find comment
uses: peter-evans/find-comment@v2
id: find-comment
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: '<!-- workflow comment -->'

- name: Post/Update comment
uses: peter-evans/create-or-update-comment@v3
id: comment
with:
issue-number: ${{ github.event.pull_request.number }}
comment-id: ${{ steps.find-comment.outputs.comment-id }}
edit-mode: replace
body-path: '.github/assets/build-pr.md'

- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: 21
distribution: 'temurin'

- name: Grant execute permissions for gradlew
run: chmod +x gradlew

- name: Build with Gradle
run: ./gradlew build --no-daemon

- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: build
path: |
build/libs/*.jar
versions/*/build/libs/*.jar
if-no-files-found: error

- name: Render Markdown Template
id: render
uses: chuhlomin/[email protected]
env:
JOB_PATH: "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ env.PREVIOUS_JOB_ID }}"
ARTIFACT_URL: "${{ github.server_url }}/${{ github.repository }}/suites/${{ env.SUITE_ID }}/artifacts/${{ env.ARTIFACT_ID }}"
ARTIFACT_EXPIRE_DATE: "${{ env.ARTIFACT_EXPIRE_DATE }}"
HEAD_SHA: "${{ env.HEAD_SHA }}"
with:
template: './.github/assets/build-pr-success.md'
vars: |
commit: ${{ env.HEAD_SHA }}
logs: ${{ env.JOB_PATH }}
download: ${{ env.ARTIFACT_URL }}
expire: ${{ env.ARTIFACT_EXPIRE_DATE }}
- name: Post/Update comment
uses: peter-evans/create-or-update-comment@v3
id: comment
with:
issue-number: ${{ github.event.pull_request.number }}
comment-id: ${{ steps.find-comment.outputs.comment-id }}
edit-mode: replace
body: ${{ steps.template.outputs.result }}

comment-if-failed:
needs: [build-and-comment]
if: failure()
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
ref: refs/pull/${{ github.event.pull_request.number }}/merge

- name: Render Markdown template
id: render
uses: chuhlomin/render-template@b7365ae850d49de8fbbc9af02f333f0150bdcc59
with:
template: './.github/assets/pr-comments/failed.md'
vars: |
commit: ${{ github.event.pull_request.head.sha }}
logs: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
- name: Update comment (Failure)
uses: peter-evans/create-or-update-comment@v3
with:
issue-number: ${{ github.event.pull_request.number }}
comment-id: ${{ needs.build-and-comment.outputs.comment_id }}
edit-mode: replace
body: ${{ steps.render.outputs.result }}
50 changes: 50 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Build

on:
push:
branches:
- '*'
paths-ignore:
- 'README'
- 'README.md'
- 'LICENSE'
- 'LICENSE.md'
pull_request:
branches:
- '*'
paths-ignore:
- 'README'
- 'README.md'
- 'LICENSE'
- 'LICENSE.md'
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
name: Build and test with gradle

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: 21
distribution: 'temurin'

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Build with Gradle
run: ./gradlew build --no-daemon

- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: build
path: |
build/libs/*.jar
versions/*/build/libs/*.jar
if-no-files-found: error
34 changes: 34 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
## Eclipse ##
eclipse
bin
*.launch
.settings
.metadata
.classpath
.project

## IntelliJ IDEA ##
out
classes
*.ipr
*.iws
*.iml
/.idea/*
!/.idea/gradle.xml

## Netbeans ##
.nb-gradle
.nb-gradle-properties

## VSCode ##
.vscode

## Gradle ##
build
.gradle

## Other ##
.kotlin
run
.DS_Store
Thumbs.db
40 changes: 40 additions & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 0f26612

Please sign in to comment.