Skip to content
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
30 changes: 30 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: CI

on:
push:
branches:
- main # Change to your default branch if different
pull_request:

env:
JAVA_OPTS: "-Xmx4G -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled"

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Build Docker image
run: docker build -t ecos-java-scala .

- name: Run tests
run: docker run --rm ecos-java-scala:latest sbt -Dsbt.log.noformat=true +test

- name: Publish to Github Repositories
if: github.event_name == 'push' && github.ref == 'refs/heads/${{ github.event.repository.default_branch }}'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_ACTOR: ${{ github.actor }}
run: docker run --rm -e GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} -e GITHUB_ACTOR=${{ github.actor }} -e PUBLISH_TO_GITHUB=true ecos-java-scala:latest sbt -Dsbt.log.noformat=true +publish
19 changes: 17 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Dependencies._

ThisBuild / scalaVersion := "2.13.15"
ThisBuild / version := "0.0.10"
ThisBuild / version := "0.0.11"
ThisBuild / versionScheme := Some("early-semver")
ThisBuild / organization := "io.citrine"
ThisBuild / organizationName := "Citrine Informatics"
Expand All @@ -11,6 +11,21 @@ ThisBuild / artifactClassifier := Some(osNameClassifier + "_" + osArchitecture)
lazy val osNameClassifier = System.getProperty("os.name").replace(' ', '_').trim
lazy val osArchitecture = System.getProperty("os.arch").replace(' ', '_').trim

ThisBuild / credentials += Credentials(
"GitHub Package Registry",
"maven.pkg.github.com",
sys.env.getOrElse("GITHUB_ACTOR", ""),
sys.env.getOrElse("GITHUB_TOKEN", "")
)

lazy val githubRepository = "GitHub Package Registry" at s"https://maven.pkg.github.com/CitrineInformatics/ecos-java-scala"
lazy val nexusRepository = "Citrine Nexus" at "https://nexus.corp.citrine.io/repository/citrine/"

lazy val publishTarget = sys.env.get("PUBLISH_TO_GITHUB") match {
case Some("true") => Some(githubRepository)
case _ => Some(nexusRepository)
}

lazy val commonSettings = Seq(
javah / target := sourceDirectory.value / "native" / "include",
crossPaths := true,
Expand All @@ -19,7 +34,7 @@ lazy val commonSettings = Seq(
if (isSnapshot.value) {
None
} else {
Some("Citrine Nexus" at "https://nexus.corp.citrine.io/repository/citrine/")
publishTarget
}
},
publishConfiguration := publishConfiguration.value.withOverwrite(true)
Expand Down