forked from thesamet/sbt-protoc
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use hashing instead of timestamps (#1)
* Use hashing instead of timestamps * change CI routines
- Loading branch information
Showing
10 changed files
with
260 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
use flake |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
name: ci | ||
on: | ||
push: | ||
branches: | ||
- '**' | ||
workflow_dispatch: | ||
inputs: | ||
clean_build: | ||
description: 'build all' | ||
required: false | ||
default: false | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: ${{ github.ref_name != 'master' }} | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 25 | ||
env: | ||
# define Java options for both official sbt and sbt-extras | ||
JAVA_OPTS: -XX:MinRAMPercentage=70.0 -XX:MaxRAMPercentage=70.0 -Xss6M -XX:ReservedCodeCacheSize=256M -Dfile.encoding=UTF-8 | ||
JVM_OPTS: -XX:MinRAMPercentage=70.0 -XX:MaxRAMPercentage=70.0 -Xss6M -XX:ReservedCodeCacheSize=256M -Dfile.encoding=UTF-8 | ||
SBT_NATIVE_CLIENT: "true" | ||
steps: | ||
- id: checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 100 | ||
fetch-tags: true | ||
sparse-checkout-cone-mode: false | ||
|
||
# set vars | ||
- name: set vars | ||
uses: whisklabs/gha-workflows/actions/set_vars@master | ||
with: | ||
clean_build: ${{ github.event.inputs.clean_build }} | ||
|
||
- name: Setup Scala | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: "21" | ||
distribution: 'temurin' | ||
|
||
- name: restore cache | ||
uses: whisklabs/gha-workflows/actions/scala_restore_cache@master | ||
with: | ||
clean_build: ${{ github.event.inputs.clean_build }} | ||
|
||
- name: Setup M2 Credentials | ||
run: mkdir -p ~/.m2 && echo ${{secrets.M2_CREDENTIALS}} | base64 -d > ~/.m2/.credentials | ||
|
||
- name: set branch | ||
run: | | ||
branch="$(echo -n ${{ github.event.ref }} | sed 's#refs/heads/##g; s#/#-#g' | tr '[:upper:]' '[:lower:]')" | ||
echo "branch=\"${branch}\"" >> $GITHUB_ENV | ||
- name: set new version | ||
run: | | ||
if [[ ${{env.branch}} == "master" ]]; then | ||
version="$(date +'%Y.%m.%d')-${{github.run_number}}" | ||
else | ||
version="$(date +'%Y.%m.%d')-${branch}-${{github.run_number}}" | ||
fi | ||
version=$(echo $version | sed 's/"//g') | ||
echo "version=$version" | ||
echo "version=$version" >> $GITHUB_ENV | ||
- run: | | ||
echo "version in ThisBuild := \"${{env.version}}\"" > version.sbt | ||
- run: sbt +outboxProcessor/docker:publishLocal | ||
|
||
- run: docker login -u ${{secrets.DOCKER_USER}} -p ${{secrets.DOCKER_PASS}} quay.io | ||
- run: docker push quay.io/whisk/outbox-processor:${{env.version}} | ||
- name: label vcs | ||
run: git tag $version && git push --tag | ||
- name: Save Scala Cache | ||
uses: whisklabs/gha-workflows/actions/scala_save_cache@master | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,3 +22,6 @@ project/plugins/project/ | |
.scala_dependencies | ||
.worksheet | ||
metals.sbt | ||
|
||
.direnv | ||
.share |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,9 @@ | ||
import sbt.Keys.publishMavenStyle | ||
|
||
name := "sbt-protoc" | ||
|
||
resolvers += "internal.repo.read" at "https://nexus.whisk-dev.com/repository/whisk-maven-group/" | ||
|
||
description := "SBT plugin for generating code from Protocol Buffer using protoc" | ||
|
||
scalacOptions := Seq("-deprecation", "-unchecked", "-Xlint", "-Yno-adapted-args") | ||
|
@@ -40,6 +44,15 @@ inThisBuild( | |
"[email protected]", | ||
url("https://www.thesamet.com") | ||
) | ||
) | ||
), | ||
scmInfo := Some( | ||
ScmInfo( | ||
url("https://github.com/whisklabs/sbt-protoc"), | ||
"scm:git:github.com/whisklabs/sbt-protoc.git" | ||
) | ||
), | ||
publishMavenStyle := true, | ||
credentials += Credentials(Path.userHome / ".m2" / ".credentials"), | ||
publishTo := Some("internal.repo" at "https://nexus.whisk-dev.com/repository/whisk-maven2/") | ||
) | ||
) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
{ | ||
description = "A flake for getting started with Scala."; | ||
inputs = { | ||
nixpkgs.url = "github:nixos/nixpkgs"; | ||
flake-utils.url = "github:numtide/flake-utils"; | ||
}; | ||
outputs = | ||
{ self | ||
, nixpkgs | ||
, flake-utils | ||
, | ||
}: | ||
let | ||
supportedSystems = [ | ||
"aarch64-darwin" | ||
"aarch64-linux" | ||
"x86_64-linux" | ||
"x86_64-darwin" | ||
]; | ||
in | ||
flake-utils.lib.eachSystem supportedSystems ( | ||
system: | ||
let | ||
buildOverlays = | ||
{ nixpkgs, system, ... }: | ||
let | ||
pkgs = import nixpkgs { inherit system; }; | ||
makeOverlays = | ||
let | ||
armOverlay = | ||
_: prev: | ||
let | ||
pkgsForx86 = import nixpkgs { localSystem = "x86_64-darwin"; }; | ||
in | ||
prev.lib.optionalAttrs (prev.stdenv.isDarwin && prev.stdenv.isAarch64) { | ||
inherit (pkgsForx86) bloop; | ||
}; | ||
ammoniteOverlay = final: prev: { ammonite = prev.ammonite.override { jre = pkgs.graalvm-ce; }; }; | ||
bloopOverlay = final: prev: { bloop = prev.bloop.override { jre = final.graalvm-ce; }; }; | ||
scalaCliOverlay = final: prev: { scala-cli = prev.scala-cli.override { jre = final.graalvm-ce; }; }; | ||
javaOverlay = final: _: { | ||
jdk = pkgs.graalvm-ce; | ||
jre = pkgs.graalvm-ce; | ||
}; | ||
in | ||
[ | ||
javaOverlay | ||
armOverlay | ||
bloopOverlay | ||
scalaCliOverlay | ||
ammoniteOverlay | ||
]; | ||
|
||
makePackages = | ||
let | ||
overlays = makeOverlays; | ||
in | ||
import nixpkgs { inherit system overlays; }; | ||
default = makePackages; | ||
in | ||
{ | ||
inherit default; | ||
}; | ||
|
||
pkgs = buildOverlays { inherit nixpkgs system; }; | ||
java = pkgs.default.graalvm-ce; | ||
in | ||
{ | ||
devShells.default = pkgs.default.mkShell { | ||
buildInputs = with pkgs.default; [ | ||
ammonite | ||
bloop | ||
coursier | ||
graalvm-ce | ||
sbt | ||
scala-cli | ||
scalafmt | ||
]; | ||
shellHook = '' | ||
#SHOVE THIS JDK SOMEWHERE TO MAKE IDEA HAPPY | ||
mkdir -p ./.share | ||
if [ -L "./.share/java" ]; then | ||
unlink "./.share/java" | ||
fi | ||
ln -sf ${java} ./.share/java | ||
''; | ||
}; | ||
formatter = pkgs.default.nixpkgs-fmt; | ||
} | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ThisBuild / version := sys.env.getOrElse("BUILD_VERSION", "0.1.0") |