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

ATDT-268: Fork KSU API #2

Merged
merged 3 commits into from
Apr 10, 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
32 changes: 0 additions & 32 deletions .classpath

This file was deleted.

7 changes: 7 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# These owners will be the default owners for everything in
# the repo. Unless a later match takes precedence,
# @global-owner1 and @global-owner2 will be requested for
# review when someone opens a pull request.
# * @global-owner1 @global-owner2

* @quang-do-se @MakotoTheKnight @ahmanwoods
8 changes: 8 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: 2
updates:

# Maintain dependencies for gradle
- package-ecosystem: "gradle"
directory: "/"
schedule:
interval: "weekly"
39 changes: 39 additions & 0 deletions .github/workflows/build-and-publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Run tests and Publish Artifacts

on:
push:
paths-ignore:
- "ansible/**"
- ".github/**"
workflow_dispatch:

jobs:
build:
name: Test, build and publish all projects
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Fetch Tags for Reckon usage
run: git fetch --unshallow --tags

- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 17
cache: 'gradle'

- name: Test and Compile with Gradle
run: |
./gradlew \
-PartifactoryUsername="${{ secrets.ARTIFACTORY_USERNAME }}" \
-PartifactoryPassword="${{ secrets.ARTIFACTORY_API_KEY }}" \
clean check --parallel

- name: Publish JARs to Artifactory
run: |
./gradlew \
-PartifactoryUsername="${{ secrets.ARTIFACTORY_USERNAME }}" \
-PartifactoryPassword="${{ secrets.ARTIFACTORY_API_KEY }}" \
publish --parallel -x check
30 changes: 30 additions & 0 deletions .github/workflows/dependency-reporter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Submit dependency graph
on:
schedule:
- cron: "0 0 * * *"
- cron: "0 12 * * *"
workflow_dispatch:

permissions:
contents: write

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 17
cache: 'gradle'
- name: Setup Gradle to generate and submit dependency graphs
uses: gradle/gradle-build-action@v2
with:
dependency-graph: generate-and-submit
- name: Run a build and generate the dependency graph which will be submitted post-job
run: |
./gradlew \
-PartifactoryUsername="${{ secrets.ARTIFACTORY_USERNAME }}" \
-PartifactoryPassword="${{ secrets.ARTIFACTORY_API_KEY }}" \
assemble -x test
34 changes: 0 additions & 34 deletions .github/workflows/maven.yml

This file was deleted.

5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,7 @@ rebel.xml
rebel-remote.xml
*.iml
*.idea
release.properties
release.properties
.gradle/
.idea/
build/
36 changes: 0 additions & 36 deletions .project

This file was deleted.

39 changes: 39 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
plugins {
id "java-conventions"
id "unit-test-conventions"
id "library-conventions"
id "publication-conventions"
id("org.ajoberstar.reckon") version "0.13.1"
}

reckon {
scopeFromProp()
snapshotFromProp()
}

repositories {
mavenCentral()
}

dependencies {
implementation("javax.validation:validation-api:1.1.0.Final")
implementation("com.google.code.gson:gson:2.9.1")
implementation("org.apache.commons:commons-lang3:3.4")
implementation('com.google.guava:guava:33.0.0-jre')
implementation("org.slf4j:slf4j-api:1.7.27")
implementation("org.slf4j:slf4j-simple:1.7.27")
implementation("org.apache.httpcomponents:httpclient:4.5.14")
implementation("org.apache.httpcomponents:httpmime:4.5.14")
testImplementation("org.apache.httpcomponents:httpclient:4.5.14:tests")
implementation("org.junit.jupiter:junit-jupiter:5.10.2")
testImplementation("org.springframework:spring-beans:6.1.5")
testImplementation("org.springframework:spring-context:6.1.5")
testImplementation("org.springframework:spring-test:6.1.5")
testImplementation("org.mockito:mockito-core:5.3.1")
testImplementation("org.mockito:mockito-junit-jupiter:5.3.1")
testImplementation("org.hamcrest:hamcrest:2.2")
}

group = "edu.ksu.canvas"
description = "Canvas API Library"

12 changes: 12 additions & 0 deletions buildSrc/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
plugins {
id "groovy-gradle-plugin"
}

repositories {
gradlePluginPortal()
}

dependencies {
implementation("com.palantir.gradle.docker:gradle-docker:0.33.0")
implementation("org.springframework.boot:spring-boot-gradle-plugin:3.2.0")
}
1 change: 1 addition & 0 deletions buildSrc/settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
rootProject.name = "buildSrc"
40 changes: 40 additions & 0 deletions buildSrc/src/main/groovy/common-methods.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// Exports a common set of methods to one place to reduce code duplication
// References: https://stackoverflow.com/a/18718802/1079354
// and https://stackoverflow.com/a/23290820/1079354

def retrieveUsername() {
return project.hasProperty('artifactoryUsername') ? project.property('artifactoryUsername') : ''
}

def retrievePassword() {
return project.hasProperty('artifactoryPassword') ? project.property('artifactoryPassword') : ''
}

def isReleaseBuild() {
return project.hasProperty("release") && Boolean.valueOf((String) project.property("release"))
}

def getCheckedOutGitCommitHash() {
'git rev-parse --verify --short HEAD'.execute().text.trim()
}

// Only deploy production artifacts to libs-release-local.
// No property - assume running in development, and deploy to snapshots.
def retrieveRepository() {
def releaseRepoUrl = "https://artifactory.colorado.edu/artifactory/software-engineering-libs-release-local"
def snapshotRepoUrl = "https://artifactory.colorado.edu/artifactory/software-engineering-libs-snapshot-local"

if (isReleaseBuild()) {
return releaseRepoUrl
} else {
return snapshotRepoUrl
}
}

ext {
retrieveUsername = this.&retrieveUsername
retrievePassword = this.&retrievePassword
isReleaseBuild = this.&isReleaseBuild
retrieveRepository = this.&retrieveRepository
getCheckedOutGitCommitHash = this.&getCheckedOutGitCommitHash
}
14 changes: 14 additions & 0 deletions buildSrc/src/main/groovy/java-conventions.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
plugins {
id "java-library"
}

java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
vendor = JvmVendorSpec.ADOPTIUM
}
}

tasks.withType(JavaExec).configureEach {
javaLauncher.set(javaToolchains.launcherFor(java.toolchain))
}
13 changes: 13 additions & 0 deletions buildSrc/src/main/groovy/library-conventions.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
plugins {
id "java-library"
id "maven-publish"
id "org.springframework.boot"
}

tasks.named("bootJar") {
enabled = false
}

tasks.named("jar") {
enabled = true
}
33 changes: 33 additions & 0 deletions buildSrc/src/main/groovy/publication-conventions.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
plugins {
id "maven-publish"
id "common-methods"
}

afterEvaluate {
publishing {
repositories {
maven {
url(retrieveRepository())
credentials {
username = retrieveUsername()
password = retrievePassword()
}
authentication {
basic(BasicAuthentication)
}
}
}

publications {
maven(MavenPublication) {
groupId = project.group
artifactId = jar.archiveBaseName.get()
version = project.version

from components.java
}
}
}
}


22 changes: 22 additions & 0 deletions buildSrc/src/main/groovy/unit-test-conventions.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
plugins {
id "java-library"
}

test {
useJUnitPlatform()
testLogging {
events "failed", "skipped"
showStackTraces true
exceptionFormat "full"
showStandardStreams false

debug {
showStandardStreams true
}
}
// For Mockito wanting to instrument classes that it doesn't have direct access to
// See https://stackoverflow.com/a/70441435 for details
jvmArgs '--add-opens', 'java.base/java.lang=ALL-UNNAMED'
}


Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
5 changes: 5 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading