Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 70607ff

Browse files
authoredAug 13, 2022
add license to class + dependency updates (#29)
1 parent 9d68494 commit 70607ff

35 files changed

+586
-146
lines changed
 

‎.github/workflows/auto-assign.yml

Lines changed: 0 additions & 14 deletions
This file was deleted.

‎.github/workflows/basic-checks.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: Basic checks
22

3-
on: [pull_request]
3+
on: [ pull_request ]
44

55
env:
66
JAVA_VERSION: 17

‎.github/workflows/codecov.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: Code Cov Workflow
22

3-
on: [push, pull_request]
3+
on: [ push, pull_request ]
44

55
jobs:
66
build:

‎.github/workflows/codeql-analysis.yml

Lines changed: 47 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,68 @@
1-
# For most projects, this workflow file will not need changing; you simply need
2-
# to commit it to your repository.
3-
#
4-
# You may wish to alter this file to override the set of languages analyzed,
5-
# or to provide custom queries or build logic.
6-
#
7-
# ******** NOTE ********
8-
# We have attempted to detect the languages in your repository. Please check
9-
# the `language` matrix defined below to confirm you have the correct set of
10-
# supported CodeQL languages.
11-
# ******** NOTE ********
12-
13-
name: "CodeQL"
1+
name: Code Analysis
142

153
on:
164
push:
17-
branches: [ master ]
5+
branches: [ "main" ]
186
pull_request:
19-
# The branches below must be a subset of the branches above
20-
branches: [ master ]
7+
branches: [ "main" ]
218
schedule:
22-
- cron: '36 19 * * 5'
9+
- cron: '0 20 * * 4'
10+
11+
env:
12+
JAVA_VERSION: 17
2313

2414
jobs:
2515
analyze:
2616
name: Analyze
2717
runs-on: ubuntu-latest
18+
permissions:
19+
actions: read
20+
contents: read
21+
security-events: write
2822

2923
strategy:
3024
fail-fast: false
3125
matrix:
26+
# Override automatic language detection by changing the below list
27+
# Supported options are ['csharp', 'cpp', 'go', 'java', 'javascript', 'python']
3228
language: [ 'java' ]
33-
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
34-
# Learn more:
35-
# https://docs.github.com/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
29+
# Learn more...
30+
# https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection
3631

3732
steps:
38-
- name: Checkout repository
39-
uses: actions/checkout@v2
40-
41-
# Initializes the CodeQL tools for scanning.
42-
- name: Initialize CodeQL
43-
uses: github/codeql-action/init@v1
44-
with:
45-
languages: ${{ matrix.language }}
46-
# If you wish to specify custom queries, you can do so here or in a config file.
47-
# By default, queries listed here will override any specified in a config file.
48-
# Prefix the list here with "+" to use these queries and those in the config file.
49-
# queries: ./path/to/local/query, your-org/your-repo/queries@main
50-
51-
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
52-
# If this step fails, then you should remove it and run the build manually (see below)
53-
- name: Autobuild
54-
uses: github/codeql-action/autobuild@v1
33+
- name: Set up JDK
34+
uses: actions/setup-java@v1
35+
with:
36+
java-version: ${{ env.JAVA_VERSION }}
37+
- name: Checkout repository
38+
uses: actions/checkout@v2
39+
with:
40+
# We must fetch at least the immediate parents so that if this is
41+
# a pull request then we can check out the head.
42+
fetch-depth: 2
5543

56-
# ℹ️ Command-line programs to run using the OS shell.
57-
# 📚 https://git.io/JvXDl
44+
# Initializes the CodeQL tools for scanning.
45+
- name: Initialize CodeQL
46+
uses: github/codeql-action/init@v1
47+
with:
48+
languages: ${{ matrix.language }}
49+
# If you wish to specify custom queries, you can do so here or in a config file.
50+
# By default, queries listed here will override any specified in a config file.
51+
# Prefix the list here with "+" to use these queries and those in the config file.
52+
# queries: ./path/to/local/query, your-org/your-repo/queries@main
5853

59-
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
60-
# and modify them (or add more) to build your code if your project
61-
# uses a compiled language
54+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
55+
# If this step fails, then you should remove it and run the build manually (see below)
56+
#- name: Autobuild
57+
# uses: github/codeql-action/autobuild@v1
6258

63-
#- run: |
64-
# make bootstrap
65-
# make release
59+
# ℹ️ Command-line programs to run using the OS shell.
60+
# 📚 https://git.io/JvXDl
6661

67-
- name: Perform CodeQL Analysis
68-
uses: github/codeql-action/analyze@v1
62+
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
63+
# and modify them (or add more) to build your code if your project
64+
# uses a compiled language
65+
- run: |
66+
./gradlew build
67+
- name: Perform CodeQL Analysis
68+
uses: github/codeql-action/analyze@v1

‎.github/workflows/gitgurdianscan.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: GitGuardian scan
22

3-
on: [push, pull_request]
3+
on: [ push, pull_request ]
44

55
jobs:
66
scanning:
@@ -16,6 +16,6 @@ jobs:
1616
env:
1717
GITHUB_PUSH_BEFORE_SHA: ${{ github.event.before }}
1818
GITHUB_PUSH_BASE_SHA: ${{ github.event.base }}
19-
GITHUB_PULL_BASE_SHA: ${{ github.event.pull_request.base.sha }}
19+
GITHUB_PULL_BASE_SHA: ${{ github.event.pull_request.base.sha }}
2020
GITHUB_DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
2121
GITGUARDIAN_API_KEY: ${{ secrets.GITGUARDIAN_API_KEY }}

‎.github/workflows/greetings.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: Greetings
22

3-
on: [pull_request, issues]
3+
on: [ pull_request, issues ]
44

55
jobs:
66
greeting:
@@ -9,8 +9,8 @@ jobs:
99
issues: write
1010
pull-requests: write
1111
steps:
12-
- uses: actions/first-interaction@v1
13-
with:
14-
repo-token: ${{ secrets.GITHUB_TOKEN }}
15-
issue-message: 'Hi/Hello Thank you for raising your first issue. Please make sure it is detailed so we know what it is about.'
16-
pr-message: 'Hi/Hello thank you for contributing to this project. Can you please run ./gradlew spotlessApply to make sure the code is tidy and clean. Thank you'
12+
- uses: actions/first-interaction@v1
13+
with:
14+
repo-token: ${{ secrets.GITHUB_TOKEN }}
15+
issue-message: 'Hi/Hello Thank you for raising your first issue. Please make sure it is detailed so we know what it is about.'
16+
pr-message: 'Hi/Hello thank you for contributing to this project. Can you please run ./gradlew spotlessApply to make sure the code is tidy and clean. Thank you'

‎.github/workflows/stale.yml

Lines changed: 0 additions & 29 deletions
This file was deleted.

‎build.gradle

Lines changed: 42 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
/*
2+
* Copyright 2022 Programming Org and other Programming Org contributors
3+
*
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
*
7+
* you may not use this file except in compliance with the License.
8+
*
9+
* You may obtain a copy of the License at
10+
*
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
*
13+
* Unless required by applicable law or agreed to in writing, software
14+
* distributed under the License is distributed on an "AS IS" BASIS,
15+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
* See the License for the specific language governing permissions and
17+
* limitations under the License.
18+
*/
119
import nu.studer.gradle.jooq.JooqEdition
220

321
buildscript {
@@ -8,7 +26,7 @@ buildscript {
826

927
plugins {
1028
id 'java'
11-
id "com.diffplug.spotless" version "6.6.1"
29+
id "com.diffplug.spotless" version "6.8.0"
1230
id "application"
1331
id "nu.studer.jooq" version "6.0.1"
1432
}
@@ -26,16 +44,12 @@ sourceCompatibility = 17
2644
targetCompatibility = 17
2745

2846
dependencies {
29-
implementation group: 'net.dv8tion', name: 'JDA', version: '5.0.0-alpha.12'
47+
implementation group: 'net.dv8tion', name: 'JDA', version: '5.0.0-alpha.17'
3048
//Logger
3149
implementation group: 'ch.qos.logback', name: 'logback-classic', version: '1.2.11'
3250
implementation group: 'ch.qos.logback', name: 'logback-core', version: '1.2.11'
3351
//config
3452
implementation group: 'io.github.yusufsdiscordbot', name: 'config', version: '1.0.4'
35-
//json
36-
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: '2.13.3'
37-
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-annotations', version: '2.13.3'
38-
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.13.3'
3953
//database
4054
implementation group: 'com.zaxxer', name: 'HikariCP', version: '5.0.0'
4155
implementation group: 'org.postgresql', name: 'postgresql', version: '42.4.0'
@@ -44,20 +58,18 @@ dependencies {
4458
implementation group: 'org.jooq', name: 'jooq-codegen', version: '3.16.6'
4559
implementation group: 'org.jooq', name: 'jooq-meta', version: '3.16.6'
4660
//test
47-
testImplementation 'org.junit.jupiter:junit-jupiter:5.8.2'
61+
testImplementation 'org.junit.jupiter:junit-jupiter:5.9.0'
4862
//jooq
4963
jooqGenerator "org.postgresql:postgresql:42.4.0"
5064
}
5165

5266
apply plugin: 'jacoco' // code coverage reports
5367

54-
5568
test {
5669
useJUnitPlatform()
5770
finalizedBy jacocoTestReport // report is always generated after tests run
5871
}
5972

60-
6173
jacocoTestReport {
6274
group = "Reporting"
6375
description = "Generate Jacoco coverage reports after running tests."
@@ -95,6 +107,26 @@ spotless {
95107
//No need to do spotless on generated code
96108
targetExclude("src/main/jooq/**")
97109
eclipse('4.21.0').configFile("${rootProject.rootDir}/meta/formatting/google-style-eclipse.xml")
110+
111+
licenseHeader("""/*
112+
* Copyright 2022 Programming Org and other Programming Org contributors
113+
*
114+
*
115+
* Licensed under the Apache License, Version 2.0 (the "License");
116+
*
117+
* you may not use this file except in compliance with the License.
118+
*
119+
* You may obtain a copy of the License at
120+
*
121+
* http://www.apache.org/licenses/LICENSE-2.0
122+
*
123+
* Unless required by applicable law or agreed to in writing, software
124+
* distributed under the License is distributed on an "AS IS" BASIS,
125+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
126+
* See the License for the specific language governing permissions and
127+
* limitations under the License.
128+
*/ """)
129+
98130
}
99131
}
100132

@@ -114,45 +146,13 @@ jar {
114146
archiveVersion.set("")
115147
}
116148

117-
/**
118-
* This task downloads all dependencies (with transitive dependencies) and puts them into the libraries folder.
119-
* Used instead of shadowJar to hopefully optimize build times.
120-
* Run the application jar with the downloaded library files in the classpath.
121-
*/
122-
task downloadDependencies {
123-
doLast {
124-
logger.info("===== Downloading dependencies =====")
125-
logger.info(" --- Cleaning up... ---")
126-
// delete superseded library jars
127-
Set<String> newFiles = sourceSets.main.runtimeClasspath.getFiles().stream().map(File::getName).toList()
128-
fileTree("libraries").files.stream().filter(file -> !newFiles.contains(file.getName())).forEach(file -> {
129-
logger.info(" -> Deleting leftover file: ${file.getName()}...")
130-
file.delete()
131-
})
132-
logger.info(" --- Cleanup complete. ---")
133-
134-
logger.info("\n --- Copying dependencies... ---")
135-
copy {
136-
from(sourceSets.main.runtimeClasspath) {
137-
include "*.jar"
138-
}
139-
into 'libraries/'
140-
eachFile {
141-
logger.info(" -> Copying ${it.name}...")
142-
}
143-
}
144-
logger.info(" --- Dependencies copied. ---")
145-
logger.info("===== Dependencies downloaded ======")
146-
}
147-
}
148149

149150
def props = new Properties()
150151
//if the file exists, load the properties
151152
if (file(".env").exists()) {
152153
file(".env").withInputStream { props.load(it) }
153154
}
154155

155-
156156
//create the build directory so no errors happen with the workflow
157157
task createBuildDir {
158158
doLast {
@@ -209,7 +209,4 @@ jooq {
209209
}
210210
}
211211
}
212-
}
213-
214-
215-
check.dependsOn jacocoTestReport
212+
}

‎src/main/java/io/github/org/programming/Bot.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
/*
2+
* Copyright 2022 Programming Org and other Programming Org contributors
3+
*
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
*
7+
* you may not use this file except in compliance with the License.
8+
*
9+
* You may obtain a copy of the License at
10+
*
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
*
13+
* Unless required by applicable law or agreed to in writing, software
14+
* distributed under the License is distributed on an "AS IS" BASIS,
15+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
* See the License for the specific language governing permissions and
17+
* limitations under the License.
18+
*/
119
package io.github.org.programming;
220

321
import io.github.org.programming.bot.ProgrammingBot;

0 commit comments

Comments
 (0)
Please sign in to comment.