-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit f7c018a
Showing
35 changed files
with
3,221 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
runChecks: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
name: "Build and Test" | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
matrix_build: | ||
name: "Matrix Build" | ||
runs-on: | ||
- ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
max-parallel: 100 | ||
matrix: | ||
spring_boot_version: | ||
- 3.2.2 | ||
- 3.1.2 | ||
- 3.0.9 | ||
- 2.7.14 | ||
container: | ||
image: azul/zulu-openjdk:17 | ||
env: | ||
SPRING_BOOT_VERSION: ${{ matrix.spring_boot_version }} | ||
GRADLE_OPTS: "-Djava.security.egd=file:/dev/./urandom -Dorg.gradle.parallel=true" | ||
IN_CI: true | ||
steps: | ||
- name: "Install packages" | ||
run: apt-get update && apt-get install -y git unzip docker docker-compose | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
- name: Setup Gradle | ||
uses: gradle/gradle-build-action@v2 | ||
with: | ||
gradle-home-cache-cleanup: true | ||
# Comment out when you are upgrading gradle in a branch and doing tons of commits you would need to test. | ||
# cache-read-only: false | ||
- name: "Assemble jar" | ||
uses: gradle/gradle-build-action@v2 | ||
with: | ||
arguments: assemble --console=plain --info --stacktrace --parallel | ||
- name: "Compile tests" | ||
uses: gradle/gradle-build-action@v2 | ||
with: | ||
arguments: compileTest --console=plain --info --stacktrace --parallel | ||
- name: "Run checks" | ||
uses: gradle/gradle-build-action@v2 | ||
with: | ||
arguments: check -x test --console=plain --stacktrace | ||
- name: "Run tests" | ||
uses: gradle/gradle-build-action@v2 | ||
with: | ||
arguments: -Dspring.profiles.include=continuous-integration test --console=plain --info --stacktrace | ||
- name: "Test if publishing works" | ||
uses: gradle/gradle-build-action@v2 | ||
with: | ||
arguments: publishToMavenLocal --console=plain --info --stacktrace | ||
- name: "Publish Test Report" | ||
uses: mikepenz/action-junit-report@v3 | ||
if: always() | ||
with: | ||
check_name: Test Report-(${{ matrix.spring_boot_version }}) | ||
report_paths: '**/build/test-results/**/*.xml' | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
require_tests: true | ||
- name: Publish checkstyle report | ||
if: always() | ||
uses: jwgmeligmeyling/checkstyle-github-action@master | ||
with: | ||
name: Checkstyle Report-(${{ matrix.spring_boot_version }}) | ||
path: '**/build/reports/**/*.xml' | ||
- name: Publish spotbugs report | ||
if: failure() | ||
uses: jwgmeligmeyling/spotbugs-github-action@master | ||
with: | ||
name: Spotbugs Report-(${{ matrix.spring_boot_version }}) | ||
path: '**/build/reports/**/*.xml' | ||
- name: "Collect test reports" | ||
run: | | ||
tar -zcvf all-test-reports-${{ matrix.spring_boot_version }}.tar.gz **/build/reports | ||
if: always() | ||
- name: "Store test results" | ||
uses: actions/upload-artifact@v3 | ||
if: always() | ||
with: | ||
name: all-test-reports-${{ matrix.spring_boot_version }} | ||
path: all-test-reports-${{ matrix.spring_boot_version }}.tar.gz | ||
retention-days: 7 | ||
build: | ||
name: "Build and Test" | ||
runs-on: | ||
- ubuntu-latest | ||
needs: matrix_build | ||
container: | ||
image: azul/zulu-openjdk:17 | ||
steps: | ||
# Needed hacks to properly fail the build when one matrix build fails. | ||
- name: Do something so that GHA is happy | ||
run: echo "Be happy!" | ||
- name: Verify matrix jobs succeeded | ||
if: ${{ needs.matrix_build.result != 'success' }} | ||
run: exit 1 | ||
- name: "Install packages" | ||
run: apt-get update && apt-get install -y git unzip | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
- name: Setup Gradle | ||
uses: gradle/gradle-build-action@v2 | ||
with: | ||
gradle-home-cache-cleanup: true | ||
# Comment out when you are upgrading gradle in a branch and doing tons of commits you would need to test. | ||
# cache-read-only: false | ||
- name: "Tag release" | ||
if: github.ref == 'refs/heads/master' | ||
uses: gradle/gradle-build-action@v2 | ||
with: | ||
arguments: tagRelease --console=plain --info --stacktrace |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: Mark stale issues and pull requests | ||
|
||
on: | ||
schedule: | ||
- cron: "30 1 * * *" | ||
|
||
jobs: | ||
stale: | ||
runs-on: | ||
- ubuntu-latest | ||
steps: | ||
- uses: actions/[email protected] | ||
with: | ||
repo-token: ${{ secrets.GITHUB_TOKEN }} | ||
stale-issue-message: 'Stale issue message' | ||
stale-pr-message: 'Stale pull request message' | ||
stale-issue-label: 'no-issue-activity' | ||
stale-pr-label: 'no-pr-activity' | ||
days-before-stale: 60 | ||
days-before-close: 10 | ||
days-before-issue-stale: -1 | ||
days-before-issue-close: -1 | ||
operations-per-run: 100 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
.gradle | ||
build/ | ||
out/ | ||
|
||
# Idea IDE files | ||
*.iml | ||
*.ipr | ||
*.iws | ||
.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Changelog | ||
|
||
All notable changes to this project will be documented in this file. | ||
|
||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), | ||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). | ||
|
||
## [0.0.1] - 2024-03-21 | ||
|
||
### Added | ||
|
||
* A bean to ask the current environment from. |
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* @transferwise/application-engineering |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
Copyright 2021 TransferWise Ltd. | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Wise Environment. | ||
|
||
![Apache 2](https://img.shields.io/hexpm/l/plug.svg) | ||
![Java 11](https://img.shields.io/badge/Java-11-blue.svg) | ||
![Maven Central](https://badgen.net/maven/v/maven-central/com.transferwise.common/wise-environment) | ||
[![Owners](https://img.shields.io/badge/team-AppEng-blueviolet.svg?logo=wise)](https://transferwise.atlassian.net/wiki/spaces/EKB/pages/2520812116/Application+Engineering+Team) [![Slack](https://img.shields.io/badge/slack-sre--guild-blue.svg?logo=slack)](https://app.slack.com/client/T026FB76G/CLR1U8SNS) | ||
> Use the `@application-engineering-on-call` handle on Slack for help. | ||
--- | ||
|
||
Provides information to other libraries in which environment they are running in. | ||
|
||
Allows to set default properties via environment variables and system properties. | ||
|
||
Those have to prefixed respectively with | ||
* `WISE_DEFAULTS_` | ||
* `wise.defaults.` | ||
|
||
E.g. | ||
* `WISE_DEFAULTS_WISE_ENVIRONMENT_TEST_VALUE1` | ||
* `wise.defaults.wise.environment.test.value4` | ||
|
||
## License | ||
Copyright 2024 TransferWise Ltd. | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
import org.gradle.api.tasks.testing.logging.TestExceptionFormat | ||
import org.gradle.api.tasks.testing.logging.TestLogEvent | ||
|
||
buildscript { | ||
repositories { | ||
mavenCentral() | ||
mavenLocal() | ||
} | ||
} | ||
|
||
apply plugin: "java-library" | ||
apply plugin: "checkstyle" | ||
apply plugin: "idea" | ||
apply plugin: "com.github.spotbugs" | ||
apply plugin: "groovy" | ||
|
||
apply from: "$rootProject.rootDir/build.libraries.gradle" | ||
|
||
group = "com.transferwise.common" | ||
|
||
repositories { | ||
mavenCentral() | ||
mavenLocal() | ||
} | ||
|
||
configurations { | ||
local { | ||
canBeResolved(false) | ||
canBeConsumed(false) | ||
} | ||
compileClasspath { | ||
extendsFrom(local) | ||
} | ||
runtimeClasspath { | ||
extendsFrom(local) | ||
} | ||
testCompileClasspath { | ||
extendsFrom(local) | ||
} | ||
testRuntimeClasspath { | ||
extendsFrom(local) | ||
} | ||
annotationProcessor { | ||
extendsFrom(local) | ||
} | ||
testAnnotationProcessor { | ||
extendsFrom(local) | ||
} | ||
} | ||
|
||
dependencies { | ||
local(platform(libraries.springBootDependencies)) | ||
|
||
local(libraries.lombok) | ||
|
||
compileOnly libraries.spotbugsAnnotations | ||
} | ||
|
||
java { | ||
sourceCompatibility = JavaVersion.VERSION_17 | ||
targetCompatibility = JavaVersion.VERSION_17 | ||
|
||
withSourcesJar() | ||
withJavadocJar() | ||
} | ||
|
||
jar { | ||
manifest { | ||
attributes( | ||
"Implementation-Title": "Transferwise Base Utils", | ||
"Implementation-Version": archiveVersion | ||
) | ||
} | ||
} | ||
|
||
compileJava { | ||
options.encoding = 'utf-8' | ||
options.compilerArgs << '-parameters' | ||
options.compilerArgs << '-Xlint' | ||
options.compilerArgs << '-Xlint:-processing' | ||
|
||
options.fork = true | ||
options.forkOptions.jvmArgs << '-Xmx256m' | ||
} | ||
|
||
compileTestJava { | ||
options.fork = true | ||
options.forkOptions.jvmArgs << '-Xmx256m' | ||
} | ||
|
||
test { | ||
useJUnitPlatform() | ||
|
||
environment("WISE_DEFAULTS_WISE_ENVIRONMENT_TEST_VALUE1", "foo") | ||
environment("WISE_DEFAULTS_WISE_ENVIRONMENT_TEST_VALUE2", "foo") | ||
environment("WISE_ENVIRONMENT_TEST_VALUE3", "foo") | ||
|
||
systemProperty("wise.defaults.wise.environment.test.value4", "foo") | ||
|
||
testLogging { | ||
events TestLogEvent.STARTED, TestLogEvent.FAILED, TestLogEvent.SKIPPED, TestLogEvent.PASSED, | ||
TestLogEvent.STANDARD_ERROR | ||
showExceptions = true | ||
showStackTraces = true | ||
exceptionFormat = TestExceptionFormat.FULL | ||
} | ||
} | ||
|
||
tasks.findAll { it.name.startsWith("spotbugs") }*.configure { | ||
excludeFilter = file("$rootProject.rootDir/spotbugs-exclude.xml") | ||
|
||
reports { | ||
xml.required = true | ||
html.required = true | ||
} | ||
} | ||
|
||
tasks.withType(Checkstyle).configureEach { | ||
config = resources.text.fromFile(file("$rootProject.rootDir/google_checks.xml")) | ||
|
||
// Deprecated, checkstyle does not like the namings. | ||
exclude "com/transferwise/common/baseutils/tracing/**" | ||
|
||
maxWarnings = 0 | ||
|
||
reports { | ||
xml.required = true | ||
html.required = true | ||
} | ||
} |
Oops, something went wrong.