Added BitBucket and GitLab CIs.

More code cleanup.
This commit is contained in:
Erik C. Thauvin 2020-07-26 02:00:18 -07:00
parent c65204414d
commit 64d2328618
10 changed files with 81 additions and 19 deletions

View file

@ -4,7 +4,7 @@ defaults: &defaults
environment: environment:
JVM_OPTS: -Xmx3200m JVM_OPTS: -Xmx3200m
TERM: dumb TERM: dumb
CI: true CI_NAME: "CircleCI"
defaults_gradle: &defaults_gradle defaults_gradle: &defaults_gradle
steps: steps:

26
.github/workflows/gradle.yml vendored Normal file
View file

@ -0,0 +1,26 @@
name: Java CI with Gradle
on:
push
pull_request
workflow_dispatch
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Set environment variables
env:
CI_NAME: "GitHub CI"
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Test with Gradle
run: ./gradlew check

32
.gitlab-ci.yml Normal file
View file

@ -0,0 +1,32 @@
image: openjdk:11-jdk-slim
variables:
GRADLE_OPTS: "-Dorg.gradle.daemon=false"
CI_NAME: "GitLab CI"
before_script:
- export GRADLE_USER_HOME=`pwd`/.gradle
stages:
- build
- test
build:
stage: build
script: ./gradlew --build-cache assemble
cache:
key: "$CI_COMMIT_REF_NAME"
policy: push
paths:
- build
- .gradle
test:
stage: test
script: ./gradlew check
cache:
key: "$CI_COMMIT_REF_NAME"
policy: pull
paths:
- build
- .gradle

View file

@ -3,7 +3,7 @@ dist: trusty
env: env:
global: global:
- CI=true - CI_NAME: "Travis CI"
install: install:
- git fetch --unshallow --tags - git fetch --unshallow --tags

9
bitbucket-pipelines.yml Normal file
View file

@ -0,0 +1,9 @@
image: openjdk:11
pipelines:
default:
- step:
caches:
- gradle
script:
- bash ./gradlew check

View file

@ -188,12 +188,12 @@ public class Mobibot extends PircBot {
setVerbose(true); setVerbose(true);
setAutoNickChange(true); setAutoNickChange(true);
setLogin(p.getProperty("login", getName())); setLogin(p.getProperty("login", getName()));
setVersion(p.getProperty("weblog", "")); setVersion(ReleaseInfo.PROJECT + ' ' + ReleaseInfo.VERSION);
// setMessageDelay(1000); // setMessageDelay(1000);
setIdentity(p.getProperty("ident", ""), p.getProperty("ident-nick", ""), p.getProperty("ident-msg", "")); setIdentity(p.getProperty("ident", ""), p.getProperty("ident-nick", ""), p.getProperty("ident-msg", ""));
// Set the URLs // Set the URLs
setWeblogUrl(getVersion()); setWeblogUrl(p.getProperty("weblog", ""));
setBacklogsUrl(Utils.ensureDir(p.getProperty("backlogs", weblogUrl), true)); setBacklogsUrl(Utils.ensureDir(p.getProperty("backlogs", weblogUrl), true));
// Set the pinboard authentication // Set the pinboard authentication
@ -404,7 +404,6 @@ public class Mobibot extends PircBot {
} }
} }
} }
setVersion(ReleaseInfo.PROJECT + ' ' + ReleaseInfo.VERSION);
identify(); identify();
joinChannel(); joinChannel();
} }

View file

@ -62,7 +62,7 @@ class ChannelFeed(bot: Mobibot, channel: String) : AbstractCommand(bot) {
isPrivate: Boolean isPrivate: Boolean
) { ) {
with(getProperty(FEED_PROP)) { with(getProperty(FEED_PROP)) {
if (!this.isNullOrBlank()) { if (!isNullOrBlank()) {
Thread(FeedReader(bot, sender, this)).start() Thread(FeedReader(bot, sender, this)).start()
} else { } else {
bot.send(sender, "There is no feed setup for this channel.", false) bot.send(sender, "There is no feed setup for this channel.", false)

View file

@ -44,8 +44,8 @@ import java.util.List;
public class Info extends AbstractCommand { public class Info extends AbstractCommand {
private final List<String> version = List.of( private final List<String> version = List.of(
StringUtils.capitalize(ReleaseInfo.PROJECT) + " " + ReleaseInfo.VERSION + " (" StringUtils.capitalize(ReleaseInfo.PROJECT) + " " + ReleaseInfo.VERSION
+ Utils.green(ReleaseInfo.WEBSITE) + ')', + " (" + Utils.green(ReleaseInfo.WEBSITE) + ')',
"Written by " + ReleaseInfo.AUTHOR + " (" + Utils.green(ReleaseInfo.AUTHOR_URL) + ')'); "Written by " + ReleaseInfo.AUTHOR + " (" + Utils.green(ReleaseInfo.AUTHOR_URL) + ')');
public Info(@NotNull final Mobibot bot) { public Info(@NotNull final Mobibot bot) {

View file

@ -42,13 +42,10 @@ import java.util.List;
public class Versions extends AbstractCommand { public class Versions extends AbstractCommand {
private final List<String> verList = private final List<String> verList =
List.of("Version: " + ReleaseInfo.VERSION + " (" + Utils.isoLocalDate(ReleaseInfo.BUILDDATE) + ')', List.of("Version: " + ReleaseInfo.VERSION + " (" + Utils.isoLocalDate(ReleaseInfo.BUILDDATE) + ')',
"Platform: " + System.getProperty("os.name") + " (" + System.getProperty("os.version") + ", " "Platform: " + System.getProperty("os.name") + ' ' + System.getProperty("os.version")
+ System.getProperty("os.arch") + ", " + System.getProperty("user.country") + ')', + " (" + System.getProperty("os.arch") + ')',
"Runtime: " + System.getProperty("java.runtime.name") + " (build " + System.getProperty( "Runtime: " + System.getProperty("java.runtime.name")
"java.runtime.version") + ')', + ' ' + System.getProperty("java.runtime.version"));
"VM: " + System.getProperty("java.vm.name") + " (build " + System.getProperty("java.vm.version")
+ ", "
+ System.getProperty("java.vm.info") + ')');
public Versions(@NotNull final Mobibot bot) { public Versions(@NotNull final Mobibot bot) {
super(bot); super(bot);

View file

@ -51,10 +51,9 @@ import static org.assertj.core.api.Assertions.assertThat;
public class TwitterTest extends LocalProperties { public class TwitterTest extends LocalProperties {
@SuppressFBWarnings("MDM") @SuppressFBWarnings("MDM")
private String getCi() { private String getCi() {
if ("true".equals(System.getenv("CIRCLECI"))) { final String ciName = System.getenv("CI_NAME");
return "CircleCI"; if (ciName != null) {
} else if ("true".equals(System.getenv("TRAVIS"))) { return ciName;
return "Travis CI";
} else { } else {
try { try {
return InetAddress.getLocalHost().getHostName(); return InetAddress.getLocalHost().getHostName();