Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve GHA and usual repository boilerplate #12

Merged
merged 8 commits into from
May 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text eol=lf
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "gradle"
directory: "/"
schedule:
interval: "weekly"
26 changes: 26 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[contributing]: https://github.com/Together-Java/TJ-Bot/wiki/Contributing
[code_guidelines]: https://github.com/Together-Java/TJ-Bot/wiki/Code-Guidelines
[new_issue]: https://github.com/Together-Java/TJ-Bot/issues/new/choose

## Pull-request

- [ ] I have read the [contributing guidelines][contributing].
- [ ] I have read the [code guidelines][code_guidelines].
- [ ] I have created a relating [issue][new_issue].

### Changes

- [ ] Existing code
- [ ] New feature

<!--
While an issue isn't required, this is preferred for most changes.
It helps make it maintainable for us, and will save you from possibly recoding everything :p
If there's no relating issue, keep it NaN
-->

Closes Issue: NaN

## Description

Replace this sentence with general description of what your Pull Request does.
33 changes: 14 additions & 19 deletions .github/workflows/docker-publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,28 @@ name: Docker Publish

on:
push:
branches:
- 'master'
- 'feature/cicd-workflows'

env:
JAVA_VERSION: 19
branches: [ master ]
workflow_dispatch:

jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Set up JDK
uses: actions/setup-java@v1
with:
java-version: ${{ env.JAVA_VERSION }}
- name: Extract branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: extract_branch
- uses: actions/checkout@v2
- name: Check out code
uses: actions/checkout@v4

- name: Install Java
uses: actions/setup-java@v3
with:
fetch-depth: 0
- name: Build and Publish Docker Image
java-version: '21'
distribution: 'corretto'

- name: Build Docker image and publish
env:
ORG_REGISTRY_USER: ${{ secrets.ORG_REGISTRY_USER }}
ORG_REGISTRY_PASSWORD: ${{ secrets.ORG_REGISTRY_PASSWORD }}
BRANCH_NAME: ${{ steps.extract_branch.outputs.branch }}
BRANCH_NAME: ${{ github.ref_name }}
run: ./gradlew jib
- name: Re-Deploy

- name: Trigger deployment
run: "curl -H 'Authorization: Bearer ${{ secrets.ORG_WATCHTOWER_TOKEN }}' https://togetherjava.org:5003/v1/update"
24 changes: 12 additions & 12 deletions .github/workflows/docker-verify.yaml
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
name: Docker Verify

on: [pull_request]

env:
JAVA_VERSION: 19
on:
pull_request:
workflow_dispatch:

jobs:
docker:
name: Docker Verify
runs-on: ubuntu-latest
steps:
- name: Set up JDK
uses: actions/setup-java@v1
with:
java-version: ${{ env.JAVA_VERSION }}
- uses: actions/checkout@v2
- name: Check out code
uses: actions/checkout@v4

- name: Install Java
uses: actions/setup-java@v3
with:
fetch-depth: 0
- name: Docker Verify
java-version: 21
distribution: 'corretto'

- name: Build Docker image
run: ./gradlew jibDockerBuild
21 changes: 10 additions & 11 deletions .github/workflows/releases.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,27 @@ defaults:
run:
shell: bash

env:
JAVA_VERSION: 19

jobs:

release:
name: Build and release
runs-on: ubuntu-latest
steps:
- name: Set up JDK
uses: actions/setup-java@v1
with:
java-version: ${{ env.JAVA_VERSION }}
- name: Check out code
uses: actions/checkout@v4

- uses: actions/checkout@v2
- name: Install Java
uses: actions/setup-java@v3
with:
java-version: 21
distribution: 'corretto'

- name: Build shadow jar
- name: Generate FAT Jar
run: ./gradlew shadowJar

- name: Create release
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: app/build/libs/TJ-Plays.jar
files: app/build/libs/TJ-JShell-Backend.jar
1 change: 0 additions & 1 deletion Insomnia_2023-01-09.json

This file was deleted.

8 changes: 1 addition & 7 deletions JShellAPI/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,6 @@ plugins {
group 'org.togetherjava'
version '1.0-SNAPSHOT'

java {
toolchain {
languageVersion = JavaLanguageVersion.of(19)
}
}

repositories {
mavenCentral()
}
Expand All @@ -34,7 +28,7 @@ dependencies {
var outputImage = 'togetherjava.org:5001/togetherjava/jshellbackend:master' ?: 'latest'

jib {
from.image = 'eclipse-temurin:19'
from.image = 'eclipse-temurin:21'
to {
image = outputImage
auth {
Expand Down
1 change: 0 additions & 1 deletion JShellWrapper/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ group 'org.togetherjava'
version '1.0-SNAPSHOT'

mainClassName = 'Main' // Debugging only
sourceCompatibility = 19

run { // Debugging only
standardInput = System.in
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
14 changes: 7 additions & 7 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -145,15 +145,15 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down Expand Up @@ -202,11 +202,11 @@ fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

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

set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
Expand Down
Loading