Skip to content
This repository has been archived by the owner on Jan 12, 2024. It is now read-only.

Commit

Permalink
Feat/migrate to gh actions (#20)
Browse files Browse the repository at this point in the history
* Migrates to GH actions
  • Loading branch information
tunderwood committed Nov 17, 2020
1 parent 2c19064 commit 5e27357
Show file tree
Hide file tree
Showing 8 changed files with 138 additions and 29 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# This workflow will build a Java project with Gradle
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle

name: Build

on:
push:
branches:
- '*'
pull_request:
branches:
- master
schedule:
- cron: "0 22 * * 1"

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 8
uses: actions/setup-java@v1
with:
java-version: 8
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew assemble
- name: Test with Gradle
run: ./gradlew check
- name: Upload coverage report to CodeCov
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos
file: ./build/reports/cobertura/coverage.xml # optional
fail_ci_if_error: true # optional (default = false)
verbose: true
- name: Slack notification when master build fails
if: ${{ failure() && github.ref == 'refs/heads/master'}}
uses: rtCamp/[email protected]
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_CHANNEL: cerberus-alerts
SLACK_MESSAGE: 'Cerberus main build has failed :build-failed:'
SLACK_ICON: https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png
SLACK_TITLE: Cerberus Build Failure Notification
SLACK_USERNAME: GitHub Actions
47 changes: 47 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# This workflow will build a Java project with Gradle
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle

name: Release

on:
push:
# Sequence of patterns matched against refs/tags
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
jobs:
Build-and-Release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 8
uses: actions/setup-java@v1
with:
java-version: 8
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew assemble
- name: Test with Gradle
run: ./gradlew check
- name: Upload coverage report to CodeCov
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos
file: ./build/reports/cobertura/coverage.xml # optional
fail_ci_if_error: true # optional (default = false)
verbose: true
- name: Release artifact to Bintray
env:
BINTRAY_USER: ${{ secrets.BINTRAY_USER }}
BINTRAY_KEY: ${{ secrets.BINTRAY_KEY}}
run: ./gradlew bintrayUpload
- name: Slack notification when release fails
if: ${{ failure() }}
uses: rtCamp/[email protected]
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_CHANNEL: cerberus-alerts
SLACK_MESSAGE: 'Cerberus release workflow has failed :build-failed:'
SLACK_ICON: https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png
SLACK_TITLE: Cerberus Build Failure Notification
SLACK_USERNAME: GitHub Actions
21 changes: 0 additions & 21 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[ ![Download](https://api.bintray.com/packages/nike/maven/cerberus-spring-boot-client/images/download.svg) ](https://bintray.com/nike/maven/cerberus-spring-boot-client/_latestVersion)
[![][travis img]][travis]
[![Coverage Status](https://coveralls.io/repos/github/Nike-Inc/cerberus-spring-boot-client/badge.svg?branch=master)](https://coveralls.io/github/Nike-Inc/cerberus-spring-boot-client)
[![codecov](https://codecov.io/gh/Nike-Inc/cerberus-spring-boot-client/branch/master/graph/badge.svg)](https://codecov.io/gh/Nike-Inc/cerberus-spring-boot-client)
[![][license img]][license]

A Spring Boot client library for Cerberus for Spring Boot applications.
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
version=3.2.1
version=3.2.2
groupId=com.nike
artifactId=cerberus-spring-boot-client
4 changes: 4 additions & 0 deletions gradle/check.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ cobertura {
}
test.finalizedBy(project.tasks.coberturaReport)

test {
useJUnitPlatform()
}

task findbugsHtml {
group = "Verification"
description = "Creates a human readable Findbugs report"
Expand Down
2 changes: 1 addition & 1 deletion gradle/dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ dependencies {

// Test dependencies
testRuntime 'org.slf4j:slf4j-simple:1.7.25'
testCompile "junit:junit:4.12"
testCompile "org.junit.jupiter:junit-jupiter:5.7.0"
testCompile ("org.mockito:mockito-core:1.10.19") {
exclude group: 'org.hamcrest'
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,45 @@

package com.nike.cerberus.springboot;

import org.junit.Test;
import org.junit.jupiter.api.*;

public class CerberusClientSpringBootConfigurationTest {

@Test(expected = IllegalArgumentException.class)
public void testForExceptionOnMissingRequiredProperty() throws Exception {
new CerberusClientSpringBootConfiguration(new CerberusClientSpringBootProperties())
.cerberusClient();
@Test
public void testForExceptionOnMissingMissingRegion() {
Assertions.assertThrows(
IllegalArgumentException.class,
() -> {
CerberusClientSpringBootProperties configProps =
new CerberusClientSpringBootProperties();
configProps.setUrl("https://test.cerberus.example.com");

new CerberusClientSpringBootConfiguration(configProps).cerberusClient();
});
}

@Test
public void testForExceptionOnMissingURL() {
Assertions.assertThrows(
IllegalArgumentException.class,
() -> {
CerberusClientSpringBootProperties configProps =
new CerberusClientSpringBootProperties();
configProps.setRegion("us-west-2");

new CerberusClientSpringBootConfiguration(configProps).cerberusClient();
});
}

@Test
public void testCerberusClientSpringBootConfiguration() {
Assertions.assertDoesNotThrow(
() -> {
CerberusClientSpringBootProperties configProps =
new CerberusClientSpringBootProperties();
configProps.setRegion("us-west-2");
configProps.setUrl("https://test.cerberus.example.com");
new CerberusClientSpringBootConfiguration(configProps).cerberusClient();
});
}
}

0 comments on commit 5e27357

Please sign in to comment.