Skip to content

Commit 3f4bd23

Browse files
authored
Improve GHA and usual repository boilerplate (#12)
Refactoring GHA for code quality
1 parent 37ddeb1 commit 3f4bd23

11 files changed

+78
-59
lines changed

.gitattributes

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* text eol=lf

.github/dependabot.yml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "gradle"
4+
directory: "/"
5+
schedule:
6+
interval: "weekly"

.github/pull_request_template.md

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
[contributing]: https://github.com/Together-Java/TJ-Bot/wiki/Contributing
2+
[code_guidelines]: https://github.com/Together-Java/TJ-Bot/wiki/Code-Guidelines
3+
[new_issue]: https://github.com/Together-Java/TJ-Bot/issues/new/choose
4+
5+
## Pull-request
6+
7+
- [ ] I have read the [contributing guidelines][contributing].
8+
- [ ] I have read the [code guidelines][code_guidelines].
9+
- [ ] I have created a relating [issue][new_issue].
10+
11+
### Changes
12+
13+
- [ ] Existing code
14+
- [ ] New feature
15+
16+
<!--
17+
While an issue isn't required, this is preferred for most changes.
18+
It helps make it maintainable for us, and will save you from possibly recoding everything :p
19+
If there's no relating issue, keep it NaN
20+
-->
21+
22+
Closes Issue: NaN
23+
24+
## Description
25+
26+
Replace this sentence with general description of what your Pull Request does.

.github/workflows/docker-publish.yaml

+14-19
Original file line numberDiff line numberDiff line change
@@ -2,33 +2,28 @@ name: Docker Publish
22

33
on:
44
push:
5-
branches:
6-
- 'master'
7-
- 'feature/cicd-workflows'
8-
9-
env:
10-
JAVA_VERSION: 19
5+
branches: [ master ]
6+
workflow_dispatch:
117

128
jobs:
139
docker:
1410
runs-on: ubuntu-latest
1511
steps:
16-
- name: Set up JDK
17-
uses: actions/setup-java@v1
18-
with:
19-
java-version: ${{ env.JAVA_VERSION }}
20-
- name: Extract branch name
21-
shell: bash
22-
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
23-
id: extract_branch
24-
- uses: actions/checkout@v2
12+
- name: Check out code
13+
uses: actions/checkout@v4
14+
15+
- name: Install Java
16+
uses: actions/setup-java@v3
2517
with:
26-
fetch-depth: 0
27-
- name: Build and Publish Docker Image
18+
java-version: '21'
19+
distribution: 'corretto'
20+
21+
- name: Build Docker image and publish
2822
env:
2923
ORG_REGISTRY_USER: ${{ secrets.ORG_REGISTRY_USER }}
3024
ORG_REGISTRY_PASSWORD: ${{ secrets.ORG_REGISTRY_PASSWORD }}
31-
BRANCH_NAME: ${{ steps.extract_branch.outputs.branch }}
25+
BRANCH_NAME: ${{ github.ref_name }}
3226
run: ./gradlew jib
33-
- name: Re-Deploy
27+
28+
- name: Trigger deployment
3429
run: "curl -H 'Authorization: Bearer ${{ secrets.ORG_WATCHTOWER_TOKEN }}' https://togetherjava.org:5003/v1/update"

.github/workflows/docker-verify.yaml

+12-12
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
name: Docker Verify
2-
3-
on: [pull_request]
4-
5-
env:
6-
JAVA_VERSION: 19
2+
on:
3+
pull_request:
4+
workflow_dispatch:
75

86
jobs:
97
docker:
108
name: Docker Verify
119
runs-on: ubuntu-latest
1210
steps:
13-
- name: Set up JDK
14-
uses: actions/setup-java@v1
15-
with:
16-
java-version: ${{ env.JAVA_VERSION }}
17-
- uses: actions/checkout@v2
11+
- name: Check out code
12+
uses: actions/checkout@v4
13+
14+
- name: Install Java
15+
uses: actions/setup-java@v3
1816
with:
19-
fetch-depth: 0
20-
- name: Docker Verify
17+
java-version: 21
18+
distribution: 'corretto'
19+
20+
- name: Build Docker image
2121
run: ./gradlew jibDockerBuild

.github/workflows/releases.yaml

+10-11
Original file line numberDiff line numberDiff line change
@@ -9,28 +9,27 @@ defaults:
99
run:
1010
shell: bash
1111

12-
env:
13-
JAVA_VERSION: 19
14-
1512
jobs:
1613

1714
release:
1815
name: Build and release
1916
runs-on: ubuntu-latest
2017
steps:
21-
- name: Set up JDK
22-
uses: actions/setup-java@v1
23-
with:
24-
java-version: ${{ env.JAVA_VERSION }}
18+
- name: Check out code
19+
uses: actions/checkout@v4
2520

26-
- uses: actions/checkout@v2
21+
- name: Install Java
22+
uses: actions/setup-java@v3
23+
with:
24+
java-version: 21
25+
distribution: 'corretto'
2726

28-
- name: Build shadow jar
27+
- name: Generate FAT Jar
2928
run: ./gradlew shadowJar
3029

3130
- name: Create release
32-
uses: softprops/action-gh-release@v1
31+
uses: softprops/action-gh-release@v2
3332
env:
3433
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3534
with:
36-
files: app/build/libs/TJ-Plays.jar
35+
files: app/build/libs/TJ-JShell-Backend.jar

Insomnia_2023-01-09.json

-1
This file was deleted.

JShellAPI/build.gradle

+1-7
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,6 @@ plugins {
1111
group 'org.togetherjava'
1212
version '1.0-SNAPSHOT'
1313

14-
java {
15-
toolchain {
16-
languageVersion = JavaLanguageVersion.of(19)
17-
}
18-
}
19-
2014
repositories {
2115
mavenCentral()
2216
}
@@ -34,7 +28,7 @@ dependencies {
3428
var outputImage = 'togetherjava.org:5001/togetherjava/jshellbackend:master' ?: 'latest'
3529

3630
jib {
37-
from.image = 'eclipse-temurin:19'
31+
from.image = 'eclipse-temurin:21'
3832
to {
3933
image = outputImage
4034
auth {

JShellWrapper/build.gradle

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ group 'org.togetherjava'
88
version '1.0-SNAPSHOT'
99

1010
mainClassName = 'Main' // Debugging only
11-
sourceCompatibility = 19
1211

1312
run { // Debugging only
1413
standardInput = System.in

gradle/wrapper/gradle-wrapper.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

gradlew

+7-7
Original file line numberDiff line numberDiff line change
@@ -145,15 +145,15 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
145145
case $MAX_FD in #(
146146
max*)
147147
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
148-
# shellcheck disable=SC3045
148+
# shellcheck disable=SC2039,SC3045
149149
MAX_FD=$( ulimit -H -n ) ||
150150
warn "Could not query maximum file descriptor limit"
151151
esac
152152
case $MAX_FD in #(
153153
'' | soft) :;; #(
154154
*)
155155
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
156-
# shellcheck disable=SC3045
156+
# shellcheck disable=SC2039,SC3045
157157
ulimit -n "$MAX_FD" ||
158158
warn "Could not set maximum file descriptor limit to $MAX_FD"
159159
esac
@@ -202,11 +202,11 @@ fi
202202
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
203203
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
204204

205-
# Collect all arguments for the java command;
206-
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
207-
# shell script including quotes and variable substitutions, so put them in
208-
# double quotes to make sure that they get re-expanded; and
209-
# * put everything else in single quotes, so that it's not re-expanded.
205+
# Collect all arguments for the java command:
206+
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
207+
# and any embedded shellness will be escaped.
208+
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
209+
# treated as '${Hostname}' itself on the command line.
210210

211211
set -- \
212212
"-Dorg.gradle.appname=$APP_BASE_NAME" \

0 commit comments

Comments
 (0)