Skip to content

Commit

Permalink
#493: nixified build (#494)
Browse files Browse the repository at this point in the history
  • Loading branch information
pshirshov authored Nov 11, 2024
1 parent 2c4e207 commit dba1d1a
Show file tree
Hide file tree
Showing 17 changed files with 370 additions and 62 deletions.
72 changes: 27 additions & 45 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,22 @@ jobs:
OPENSSL_KEY: ${{ secrets.OPENSSL_KEY }}
run: |
echo "HAVE_SECRETS=${{ env.OPENSSL_IV != '' && env.OPENSSL_KEY != '' }}" >> $GITHUB_OUTPUT
build:
runs-on: ubuntu-latest
needs: [ 'checksecret' ]
strategy:
fail-fast: false
matrix:
java: [ '11', '17' ]
java: [ '11', '17', '21' ]
scala: [ '2.11', '2.12', '2.13', '3' ]
steps:
- uses: 7mind/github-env@main
with:
java-version: ${{ matrix.java }}
- uses: 7mind/github-env@minimal
- name: Build and Test
run: |
bash sbtgen.sc --js --native
sbt "++ ${{ matrix.scala }} -v" clean test mimaReportBinaryIssues
env:
SCALA_VERSION: ${{ matrix.scala }}
JAVA_VERSION: ${{ matrix.java }}
run: ./build.sh nix gen test
- uses: dorny/test-reporter@v1
if: (needs.checksecret.outputs.HAVE_SECRETS == 'true') && (success() || failure())
with:
Expand All @@ -45,72 +46,52 @@ jobs:
- name: Upload dependency graph
if: needs.checksecret.outputs.HAVE_SECRETS == 'true'
uses: scalacenter/sbt-dependency-submission@d3f139371479f7d3ca3db160b9b536cb4f9dcdd5

publish-artifacts:
runs-on: ubuntu-latest
needs: [ 'build', 'checksecret' ]
if: needs.checksecret.outputs.HAVE_SECRETS == 'true'
strategy:
matrix:
java: [ '17' ]
scala: [ '2.13' ]
steps:
- uses: 7mind/github-env@main
with:
java-version: ${{ matrix.java }}
- uses: 7mind/github-env@minimal
- name: Build and Publish to Sonatype
env:
JAVA_VERSION: ${{ matrix.java }}
OPENSSL_IV: ${{ secrets.OPENSSL_IV }}
OPENSSL_KEY: ${{ secrets.OPENSSL_KEY }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
SCALA_VERSION: ${{ matrix.scala }}
run: |
bash sbtgen.sc --js --native
COMMAND="sbt +clean +test +mimaReportBinaryIssues"
if [[ "$GITHUB_REF" == refs/heads/develop || "$CI_BRANCH_TAG" =~ ^v.*$ ]] ; then
openssl aes-256-cbc -K ${OPENSSL_KEY} -iv ${OPENSSL_IV} -in secrets.tar.enc -out secrets.tar -d
tar xvf secrets.tar
ln -s .secrets/local.sbt local.sbt
rm ./.secrets/credentials.sonatype-nexus.properties
printf "%s\n" "realm=Sonatype Nexus Repository Manager" "host=oss.sonatype.org" "user=${SONATYPE_USERNAME}" "password=${SONATYPE_PASSWORD}" > ./.secrets/credentials.sonatype-nexus.properties
COMMAND="$COMMAND +publishSigned"
if [[ "$CI_BRANCH_TAG" =~ ^v.*$ ]] ; then
COMMAND="$COMMAND sonatypeBundleRelease"
fi

echo $COMMAND
eval $COMMAND
fi
openssl aes-256-cbc -K ${OPENSSL_KEY} -iv ${OPENSSL_IV} -in secrets.tar.enc -out secrets.tar -d
tar xvf secrets.tar
ln -s .secrets/local.sbt local.sbt
rm ./.secrets/credentials.sonatype-nexus.properties
printf "%s\n" "realm=Sonatype Nexus Repository Manager" "host=oss.sonatype.org" "user=${SONATYPE_USERNAME}" "password=${SONATYPE_PASSWORD}" > ./.secrets/credentials.sonatype-nexus.properties
./build.sh nix gen publish-scala
release-and-notify-docs:
name: Release and Notify Docs
runs-on: ubuntu-latest
continue-on-error: false
needs: [ 'build', 'checksecret' ]
if: needs.checksecret.outputs.HAVE_SECRETS == 'true'
#if: ${{ ((github.event_name == 'release') && (github.event.action == 'published')) || (github.event_name == 'workflow_dispatch') }}
strategy:
matrix:
java: [ '17' ]
scala: [ '2.13' ]
steps:
- uses: 7mind/github-env@main
with:
java-version: ${{ matrix.java }}
- name: Setup NodeJs
uses: actions/setup-node@v4
with:
node-version: 20.x
registry-url: https://registry.npmjs.org
- name: Update Documentation
run: |
awk '/<!--- docs:start --->/,/<!--- docs:end --->/' README.md >> docs/index.md
sed -i '/<!--- docs:start --->/d' docs/index.md
sed -i '/<!--- docs:end --->/d' docs/index.md
- uses: 7mind/github-env@minimal
- name: Publish Docs to NPM Registry
run: |
bash sbtgen.sc --js --native
sbt docs/publishToNpm
env:
JAVA_VERSION: ${{ matrix.java }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
SCALA_VERSION: ${{ matrix.scala }}
run: ./build.sh nix gen publish-ziodocs
- name: Notify the main repo about the new release of docs package
run: |
PACKAGE_NAME=$(cat docs/package.json | grep '"name"' | awk -F'"' '{print $4}')
Expand All @@ -127,6 +108,7 @@ jobs:
"package_version": "'"${PACKAGE_VERSION}"'"
}
}'
all-good:
if: always()
runs-on: ubuntu-latest
Expand Down
7 changes: 7 additions & 0 deletions .keep.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
SCALA_VERSION
JAVA_VERSION
OPENSSL_IV
OPENSSL_KEY
SONATYPE_USERNAME
SONATYPE_PASSWORD
NODE_AUTH_TOKEN
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
---

<!--- docs:start --->

# izumi-reflect

> @quote: Looks a bit similar to TypeTag
Expand Down Expand Up @@ -75,6 +76,7 @@ Other useful system properties are:

- [`izumi.reflect.rtti.optimized.equals`](https://javadoc.io/doc/dev.zio/izumi-reflect_2.13/latest/izumi/reflect/DebugProperties$.html#izumi.reflect.rtti.optimized.equals:String(%22izumi.reflect.rtti.optimized.equals%22))
- [`izumi.reflect.rtti.cache.compile`](https://javadoc.io/doc/dev.zio/izumi-reflect_2.13/latest/izumi/reflect/DebugProperties$.html#izumi.reflect.rtti.cache.compile:String(%22izumi.reflect.rtti.cache.compile%22))

<!--- docs:end --->

## Build
Expand Down Expand Up @@ -108,6 +110,7 @@ Likewise with Scala 3:
In Intellij, you may also set Scala version by changing the option `sbt -> sbt settings -> Open cross-compiled projects Scala 3 / Scala 2 projects as:`

<!--- docs:start --->

# Talks

* [Kit Langton — Scala 3 Macro Fun (Open Source Hackery)](https://www.youtube.com/watch?v=wsLhjqCKZuU)
Expand Down Expand Up @@ -136,4 +139,5 @@ In Intellij, you may also set Scala version by changing the option `sbt -> sbt s

[Stage]: https://img.shields.io/badge/Project%20Stage-Production%20Ready-brightgreen.svg
[Stage-Page]: https://github.com/zio/zio/wiki/Project-Stages

<!--- docs:end --->
79 changes: 65 additions & 14 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import com.typesafe.tools.mima.core._

enablePlugins(SbtgenVerificationPlugin)

lazy val `izumi-reflect-thirdparty-boopickle-shaded` = crossProject(JVMPlatform, JSPlatform).crossType(CrossType.Pure).in(file("izumi-reflect/izumi-reflect-thirdparty-boopickle-shaded"))
lazy val `izumi-reflect-thirdparty-boopickle-shaded` = crossProject(JVMPlatform, JSPlatform, NativePlatform).crossType(CrossType.Pure).in(file("izumi-reflect/izumi-reflect-thirdparty-boopickle-shaded"))
.settings(
libraryDependencies ++= Seq(
"org.scalatest" %%% "scalatest" % V.scalatest % Test
Expand Down Expand Up @@ -110,7 +110,7 @@ lazy val `izumi-reflect-thirdparty-boopickle-shaded` = crossProject(JVMPlatform,
}
},
Compile / doc / sources := { (isSnapshot.value, scalaVersion.value) match {
case (_, "3.2.2") => Seq(
case (_, "3.3.4") => Seq(

)
case (_, _) => (Compile / doc / sources).value
Expand Down Expand Up @@ -188,7 +188,7 @@ lazy val `izumi-reflect-thirdparty-boopickle-shaded` = crossProject(JVMPlatform,
} },
scalacOptions -= "-Wconf:any:error",
mimaPreviousArtifacts := { (isSnapshot.value, scalaVersion.value) match {
case (_, "3.2.2") => Set(organization.value %% name.value % "2.2.5", organization.value %% name.value % "2.1.0")
case (_, "3.3.4") => Set(organization.value %% name.value % "2.2.5", organization.value %% name.value % "2.1.0")
case (_, _) => Set(organization.value %% name.value % "2.2.5", organization.value %% name.value % "2.1.0", organization.value %% name.value % "1.0.0")
} },
scalacOptions ++= { (isSnapshot.value, scalaVersion.value) match {
Expand All @@ -213,7 +213,7 @@ lazy val `izumi-reflect-thirdparty-boopickle-shaded` = crossProject(JVMPlatform,
)
.jvmSettings(
crossScalaVersions := Seq(
"3.2.2",
"3.3.4",
"2.13.14",
"2.12.19",
"2.11.12"
Expand All @@ -222,18 +222,30 @@ lazy val `izumi-reflect-thirdparty-boopickle-shaded` = crossProject(JVMPlatform,
)
.jsSettings(
crossScalaVersions := Seq(
"3.2.2",
"3.3.4",
"2.13.14",
"2.12.19"
),
scalaVersion := crossScalaVersions.value.head,
coverageEnabled := false,
scalaJSLinkerConfig := scalaJSLinkerConfig.value.withModuleKind(ModuleKind.CommonJSModule)
)
.nativeSettings(
crossScalaVersions := Seq(
"3.3.4",
"2.13.14",
"2.12.19"
),
scalaVersion := crossScalaVersions.value.head,
coverageEnabled := false,
test := {},
Test / test := {}
)
lazy val `izumi-reflect-thirdparty-boopickle-shadedJVM` = `izumi-reflect-thirdparty-boopickle-shaded`.jvm
lazy val `izumi-reflect-thirdparty-boopickle-shadedJS` = `izumi-reflect-thirdparty-boopickle-shaded`.js
lazy val `izumi-reflect-thirdparty-boopickle-shadedNative` = `izumi-reflect-thirdparty-boopickle-shaded`.native

lazy val `izumi-reflect` = crossProject(JVMPlatform, JSPlatform).crossType(CrossType.Pure).in(file("izumi-reflect/izumi-reflect"))
lazy val `izumi-reflect` = crossProject(JVMPlatform, JSPlatform, NativePlatform).crossType(CrossType.Pure).in(file("izumi-reflect/izumi-reflect"))
.dependsOn(
`izumi-reflect-thirdparty-boopickle-shaded` % "test->compile;compile->compile"
)
Expand Down Expand Up @@ -337,7 +349,7 @@ lazy val `izumi-reflect` = crossProject(JVMPlatform, JSPlatform).crossType(Cross
}
},
Compile / doc / sources := { (isSnapshot.value, scalaVersion.value) match {
case (_, "3.2.2") => Seq(
case (_, "3.3.4") => Seq(

)
case (_, _) => (Compile / doc / sources).value
Expand Down Expand Up @@ -415,7 +427,7 @@ lazy val `izumi-reflect` = crossProject(JVMPlatform, JSPlatform).crossType(Cross
} },
scalacOptions -= "-Wconf:any:error",
mimaPreviousArtifacts := { (isSnapshot.value, scalaVersion.value) match {
case (_, "3.2.2") => Set(organization.value %% name.value % "2.2.5", organization.value %% name.value % "2.1.0")
case (_, "3.3.4") => Set(organization.value %% name.value % "2.2.5", organization.value %% name.value % "2.1.0")
case (_, _) => Set(organization.value %% name.value % "2.2.5", organization.value %% name.value % "2.1.0", organization.value %% name.value % "1.0.0")
} },
scalacOptions ++= { (isSnapshot.value, scalaVersion.value) match {
Expand All @@ -439,7 +451,7 @@ lazy val `izumi-reflect` = crossProject(JVMPlatform, JSPlatform).crossType(Cross
)
.jvmSettings(
crossScalaVersions := Seq(
"3.2.2",
"3.3.4",
"2.13.14",
"2.12.19",
"2.11.12"
Expand All @@ -448,16 +460,28 @@ lazy val `izumi-reflect` = crossProject(JVMPlatform, JSPlatform).crossType(Cross
)
.jsSettings(
crossScalaVersions := Seq(
"3.2.2",
"3.3.4",
"2.13.14",
"2.12.19"
),
scalaVersion := crossScalaVersions.value.head,
coverageEnabled := false,
scalaJSLinkerConfig := scalaJSLinkerConfig.value.withModuleKind(ModuleKind.CommonJSModule)
)
.nativeSettings(
crossScalaVersions := Seq(
"3.3.4",
"2.13.14",
"2.12.19"
),
scalaVersion := crossScalaVersions.value.head,
coverageEnabled := false,
test := {},
Test / test := {}
)
lazy val `izumi-reflectJVM` = `izumi-reflect`.jvm
lazy val `izumi-reflectJS` = `izumi-reflect`.js
lazy val `izumi-reflectNative` = `izumi-reflect`.native

lazy val `izumi-reflect-aggregate` = (project in file(".agg/izumi-reflect-izumi-reflect-aggregate"))
.settings(
Expand All @@ -467,8 +491,10 @@ lazy val `izumi-reflect-aggregate` = (project in file(".agg/izumi-reflect-izumi-
.aggregate(
`izumi-reflect-thirdparty-boopickle-shadedJVM`,
`izumi-reflect-thirdparty-boopickle-shadedJS`,
`izumi-reflect-thirdparty-boopickle-shadedNative`,
`izumi-reflectJVM`,
`izumi-reflectJS`
`izumi-reflectJS`,
`izumi-reflectNative`
)

lazy val `izumi-reflect-aggregate-jvm` = (project in file(".agg/izumi-reflect-izumi-reflect-aggregate-jvm"))
Expand All @@ -491,11 +517,21 @@ lazy val `izumi-reflect-aggregate-js` = (project in file(".agg/izumi-reflect-izu
`izumi-reflectJS`
)

lazy val `izumi-reflect-aggregate-native` = (project in file(".agg/izumi-reflect-izumi-reflect-aggregate-native"))
.settings(
publish / skip := true,
crossScalaVersions := Nil
)
.aggregate(
`izumi-reflect-thirdparty-boopickle-shadedNative`,
`izumi-reflectNative`
)

lazy val `izumi-reflect-root-jvm` = (project in file(".agg/.agg-jvm"))
.settings(
publish / skip := true,
crossScalaVersions := Seq(
"3.2.2",
"3.3.4",
"2.13.14",
"2.12.19",
"2.11.12"
Expand All @@ -510,7 +546,7 @@ lazy val `izumi-reflect-root-js` = (project in file(".agg/.agg-js"))
.settings(
publish / skip := true,
crossScalaVersions := Seq(
"3.2.2",
"3.3.4",
"2.13.14",
"2.12.19",
"2.11.12"
Expand All @@ -521,6 +557,21 @@ lazy val `izumi-reflect-root-js` = (project in file(".agg/.agg-js"))
`izumi-reflect-aggregate-js`
)

lazy val `izumi-reflect-root-native` = (project in file(".agg/.agg-native"))
.settings(
publish / skip := true,
crossScalaVersions := Seq(
"3.3.4",
"2.13.14",
"2.12.19",
"2.11.12"
),
scalaVersion := crossScalaVersions.value.head
)
.aggregate(
`izumi-reflect-aggregate-native`
)

lazy val `izumi-reflect-root` = (project in file("."))
.settings(
publish / skip := true,
Expand All @@ -547,7 +598,7 @@ lazy val `izumi-reflect-root` = (project in file("."))
"-XDignore.symbol.file"
),
crossScalaVersions := Nil,
scalaVersion := "3.2.2",
scalaVersion := "3.3.4",
ThisBuild / organization := "dev.zio",
sonatypeProfileName := "dev.zio",
sonatypeSessionName := s"[sbt-sonatype] ${name.value} ${version.value} ${java.util.UUID.randomUUID}",
Expand Down
Loading

0 comments on commit dba1d1a

Please sign in to comment.