Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Publish node jar to Sonatype OSS #3948

Merged
merged 15 commits into from
Jun 3, 2024
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
61 changes: 15 additions & 46 deletions .github/workflows/check-pr.yaml
Original file line number Diff line number Diff line change
@@ -1,31 +1,20 @@
name: Check PR
on:
push:
branches:
- version-[0-9].[0-9]+.x
tags:
- v[0-9].[0-9]+.[0-9]+
pull_request:

jobs:
check-pr:
name: Check PR
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: 'zulu'
distribution: 'temurin'
java-version: '11'
- name: Cache SBT
uses: actions/cache@v3
with:
path: ~/.sbt
key: sbt-cache-${{ hashFiles('project/build.properties') }}
- name: Cache Coursier
uses: actions/cache@v3
with:
path: ~/.cache/coursier
key: coursier-cache
cache: 'sbt'
gpg-private-key: ${{ secrets.OSSRH_GPG_KEY }}
gpg-passphrase: ${{ secrets.OSSRH_GPG_PASSPHRASE }}
- name: Check PR
run: sbt --mem 4096 --batch ";checkPR;completeQaseRun"
env:
Expand All @@ -35,7 +24,7 @@ jobs:
QASE_PROJECT_CODE: PR
QASE_API_TOKEN: ${{ secrets.QASE_API_TOKEN }}
CHECKPR_RUN_ID: ${{ github.run_id }}
- uses: dorny/paths-filter@v2
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
Expand All @@ -57,33 +46,13 @@ jobs:
find swopfi-smart-contracts/dApps -name "*.ride" -type f -exec java -jar lang/jvm/target/file-compiler.jar {} +;
- name: Clean cache
run: find ~/.cache/coursier -type d -name '*SNAPSHOT' | xargs rm -vrf {} \;
- name: Prepare version
if: false # steps.filter.outputs.lang == 'true'
id: sbt-version
run: |
sbt_version=$(cut -d\" -f2 version.sbt)
git_ref=${GITHUB_REF##*/}
echo ${{ github.event }}
pr_number=${{ github.event.number }}
if [[ $git_ref =~ v[0-9]+\.[0-9]+\.[0-9]+$ ]] ; then
if [[ v$sbt_version != $git_ref ]] ; then
echo SBT version $sbt_version does not match tag $git_ref
exit 1
fi
else
if [[ $pr_number != "" ]] ; then
sbt_version=$sbt_version-$pr_number-SNAPSHOT
else
sbt_version=$sbt_version-SNAPSHOT
fi
echo "ThisBuild / version := \"$sbt_version\"" >> version.sbt
echo Setting version to $sbt_version
fi
- name: Publish lang
run: sbt ci-release
if: false # steps.filter.outputs.lang == 'true'
- name: Publish snapshots
if: ${{ contains(github.event.pull_request.labels.*.name, 'publish-snapshots') }}
env:
PGP_PASSPHRASE: ${{ secrets.OSSRH_GPG_PASSPHRASE }}
PGP_SECRET: ${{ secrets.OSSRH_GPG_KEY_BASE64 }}
SONATYPE_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
SONATYPE_USERNAME: ${{ secrets.OSSRH_USERNAME }}
PGP_PASSPHRASE: ${{ secrets.OSSRH_GPG_PASSPHRASE }}
run: |
sbt_version=$(cut -d\" -f2 version.sbt)
pr_number=${{ github.event.number }}
sbt -Dproject.version=$sbt_version-$pr_number-SNAPSHOT --mem 4096 --batch publishSigned
43 changes: 14 additions & 29 deletions .github/workflows/publish-docker-node.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,43 +8,28 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Setup Java
uses: actions/setup-java@v3
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: 'zulu'
distribution: 'temurin'
java-version: '11'
cache: 'sbt'

- name: Checkout repository
uses: actions/checkout@v3

- name: Cache SBT
uses: actions/cache@v3
with:
path: ~/.sbt
key: sbt-cache-${{ hashFiles('project/build.properties') }}

- name: Cache Coursier
uses: actions/cache@v3
with:
path: ~/.cache/coursier
key: coursier-cache

- name: Build sources
run: |
sbt --mem 4096 --batch -J-XX:+UseG1GC -Dcoursier.cache=~/.cache/coursier -Dsbt.boot.directory=~/.sbt ';buildTarballsForDocker;buildRIDERunnerForDocker'
- name: Build tarballs for Docker
run: sbt --mem 4096 --batch ';buildTarballsForDocker;buildRIDERunnerForDocker'

- name: Setup Docker buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3

- name: Log into Docker Hub registry
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}

- name: Extract Docker public node metadata
id: meta-public
uses: docker/metadata-action@v4
uses: docker/metadata-action@v5
with:
images: wavesplatform/wavesnode
flavor: |
Expand All @@ -55,7 +40,7 @@ jobs:

- name: Extract Docker private node metadata
id: meta-private
uses: docker/metadata-action@v4
uses: docker/metadata-action@v5
with:
images: wavesplatform/waves-private-node
flavor: |
Expand All @@ -66,7 +51,7 @@ jobs:

- name: Extract Docker RIDE runner metadata
id: meta-ride-runner
uses: docker/metadata-action@v4
uses: docker/metadata-action@v5
with:
images: wavesplatform/ride-runner
flavor: |
Expand All @@ -77,7 +62,7 @@ jobs:

- name: Build and push Docker public image
id: build-and-push-public
uses: docker/build-push-action@v3
uses: docker/build-push-action@v5
with:
context: ./docker
push: true
Expand All @@ -86,7 +71,7 @@ jobs:

- name: Build and push Docker private image
id: build-and-push-private
uses: docker/build-push-action@v3
uses: docker/build-push-action@v5
with:
context: ./docker/private
push: true
Expand All @@ -97,7 +82,7 @@ jobs:

- name: Build and push Docker RIDE runner image
id: build-and-push-ride-runner
uses: docker/build-push-action@v3
uses: docker/build-push-action@v5
with:
context: ./ride-runner/docker
push: true
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/publish-node-sbt-builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ jobs:
run: |
echo "waves-version=$(cut -d\" -f2 version.sbt)" >> $GITHUB_OUTPUT
echo "sbt-version=$(cut -d= -f2 project/build.properties)" >> $GITHUB_OUTPUT
- uses: docker/setup-buildx-action@v2
- uses: docker/login-action@v2
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- uses: docker/build-push-action@v3
- uses: docker/build-push-action@v5
with:
context: ./docker
file: ./docker/node-sbt-builder.Dockerfile
Expand Down
38 changes: 38 additions & 0 deletions .github/workflows/publish-release-jars.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Publish node and lang jars to Maven Central

on:
release:
types: [published]

jobs:
publish-release:
name: Publish jars
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- id: sbt-version
run: |
sbt_version=$(cut -d\" -f2 version.sbt)
echo "sbt_version=$sbt_version" >> "$GITHUB_OUTPUT"
- if: ${{ format('v{0}', steps.sbt-version.outputs.sbt_version) != github.ref_name }}
env:
SBT_VERSION: ${{ steps.sbt-version.outputs.sbt_version }}
RELEASE_VERSION: ${{ github.ref_name }}
run: |
echo "::error::Release version $RELEASE_VERSION does not match SBT version $SBT_VERSION"
exit 1
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '11'
cache: 'sbt'
gpg-private-key: ${{ secrets.OSSRH_GPG_KEY }}
gpg-passphrase: ${{ secrets.OSSRH_GPG_PASSPHRASE }}
- name: Publish snapshots
if: ${{ contains(github.event.pull_request.labels.*.name, 'publish-snapshots') }}
env:
SONATYPE_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
SONATYPE_USERNAME: ${{ secrets.OSSRH_USERNAME }}
PGP_PASSPHRASE: ${{ secrets.OSSRH_GPG_PASSPHRASE }}
run: |
sbt --mem 4096 --batch ";publishSigned;sonatypeBundleRelease"
30 changes: 23 additions & 7 deletions node/build.sbt
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
name := "waves"

enablePlugins(
RunApplicationSettings,
JavaServerAppPackaging,
Expand All @@ -20,20 +18,37 @@ javaAgents ++= {
}
}

publishTo := sonatypePublishToBundle.value
publish / skip := false
homepage := Some(url("https://waves.tech/"))
developers := List(
Developer("ismagin", "Ilya Smagin", "[email protected]", url("https://github.com/ismagin")),
Developer("asayadyan", "Artyom Sayadyan", "[email protected]", url("https://github.com/xrtm000")),
Developer("mpotanin", "Mike Potanin", "[email protected]", url("https://github.com/potan")),
Developer("irakitnykh", "Ivan Rakitnykh", "[email protected]", url("https://github.com/mrkraft")),
Developer("akiselev", "Alexey Kiselev", "[email protected]>", url("https://github.com/alexeykiselev")),
Developer("phearnot", "Sergey Nazarov", "[email protected]", url("https://github.com/phearnot")),
Developer("tolsi", "Sergey Tolmachev", "[email protected]", url("https://github.com/tolsi")),
Developer("vsuharnikov", "Vyatcheslav Suharnikov", "[email protected]", url("https://github.com/vsuharnikov")),
Developer("ivan-mashonskiy", "Ivan Mashonskii", "[email protected]", url("https://github.com/ivan-mashonskiy"))
)
versionScheme := Some("pvp")

Compile / packageDoc / publishArtifact := true
Test / packageDoc / publishArtifact := false

inConfig(Compile)(
Seq(
PB.targets += scalapb.gen(flatPackage = true) -> sourceManaged.value,
PB.protoSources += PB.externalIncludePath.value,
PB.generate / includeFilter := { (f: File) =>
(** / "waves" / "*.proto").matches(f.toPath)
},
PB.deleteTargetDirectory := false,
packageDoc / publishArtifact := false,
packageSrc / publishArtifact := false
PB.deleteTargetDirectory := false
)
)

inTask(assembly)(CommonSettings.assemblySettings)
inTask(assembly)(Seq(name := "waves") ++ CommonSettings.assemblySettings)

// Adds "$lib_dir/*" to app_classpath in the executable file, this is needed for extensions
scriptClasspath += "*"
Expand Down Expand Up @@ -73,6 +88,7 @@ linuxScriptReplacements += ("network" -> network.value.toString)

inConfig(Universal)(
Seq(
packageName := s"waves-${version.value}",
mappings += (baseDirectory.value / s"waves-sample.conf" -> "doc/waves.conf.sample"),
javaOptions ++= Seq(
// -J prefix is required by the bash script
Expand All @@ -93,7 +109,7 @@ inConfig(Linux)(
Seq(
packageSummary := "Waves node",
packageDescription := "Waves node",
name := s"${name.value}${network.value.packageSuffix}",
name := s"waves${network.value.packageSuffix}",
normalizedName := name.value,
packageName := normalizedName.value
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ package object http {
case NonFatal(e) => logger.error("Uncaught error", e); complete(ApiError.Unknown)
}

/** Handles all [[scala.util.control.NonFatal non-fatal]] exceptions and tries to handle fatal errors.
/** Handles all [[scala.util.control.NonFatal]] exceptions and tries to handle fatal errors.
*
* This directive can't handle __fatal__ errors from:
*
Expand Down