-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
192 additions
and
93 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 |
---|---|---|
|
@@ -15,18 +15,35 @@ on: | |
tags: [v*] | ||
|
||
env: | ||
PACT_BROKER_BASE_URL: 'https://test.pactflow.io' | ||
PACT_BROKER_USERNAME: dXfltyFMgNOFZAxr8io9wJ37iUpY42M | ||
PACT_BROKER_PASSWORD: O5AIZWxelWbLvqMd8PkAVycBJh2Psyg1 | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
jobs: | ||
build: | ||
name: Build and Test | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest] | ||
scala: [3.3.4-RC1] | ||
os: [ubuntu-latest, macos-latest, windows-2019] | ||
scala: [3.5.0] | ||
java: [zulu@17, zulu@20] | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- name: Ignore line ending differences in git | ||
if: contains(runner.os, 'windows') | ||
shell: bash | ||
run: git config --global core.autocrlf false | ||
|
||
- name: Configure pagefile for Windows | ||
if: contains(runner.os, 'windows') | ||
uses: al-cheb/[email protected] | ||
with: | ||
minimum-size: 2GB | ||
maximum-size: 8GB | ||
disk-root: 'C:' | ||
|
||
- name: Checkout current branch (full) | ||
uses: actions/checkout@v4 | ||
with: | ||
|
@@ -52,28 +69,45 @@ jobs: | |
uses: sbt/setup-sbt@v1 | ||
|
||
- name: Check that workflows are up to date | ||
shell: bash | ||
run: sbt '++ ${{ matrix.scala }}' githubWorkflowCheck | ||
|
||
- name: Start containers | ||
run: docker compose -f docker-compose.yml up -d | ||
- name: Set outputs | ||
id: vars | ||
shell: bash | ||
run: | | ||
echo "sha_short=$(git rev-parse --short ${{ github.sha }})" >> $GITHUB_OUTPUT | ||
echo "git_tag=$(git describe --tags)" >> $GITHUB_OUTPUT | ||
- name: Pactflow Setup | ||
uses: pactflow/actions@main | ||
|
||
- name: Build project | ||
shell: bash | ||
run: sbt '++ ${{ matrix.scala }}' compile scalafmtCheckAll javafmtCheckAll plugin/test | ||
|
||
- name: Test Consumer | ||
shell: bash | ||
run: sbt '++ ${{ matrix.scala }}' consumer/test | ||
|
||
- name: Upload Consumer Pact | ||
run: ./scripts/pact-publish.sh | ||
- name: Pact publish Windows | ||
if: contains(runner.os, 'windows') | ||
shell: bash | ||
run: pact-broker.bat publish "modules/examples/consumer/target/pacts" --consumer-app-version=${{ steps.vars.outputs.git_tag }}-${{ runner.os }} --tag=${{ steps.vars.outputs.git_tag }}-${{ runner.os }} | ||
|
||
- name: Pact publish *nix | ||
if: '!contains(runner.os, ''windows'')' | ||
shell: bash | ||
run: pact-broker publish "modules/examples/consumer/target/pacts" --consumer-app-version=${{ steps.vars.outputs.git_tag }}-${{ runner.os }} --tag=${{ steps.vars.outputs.git_tag }}-${{ runner.os }} | ||
|
||
- name: Test Provider | ||
env: | ||
PACT_BROKER_TAG: ${{ steps.vars.outputs.git_tag }}-${{ runner.os }} | ||
shell: bash | ||
run: sbt '++ ${{ matrix.scala }}' provider/test | ||
|
||
- name: Stop containers | ||
if: always() | ||
run: docker compose -f docker-compose.yml down | ||
|
||
- name: Compress target directories | ||
shell: bash | ||
run: tar cf targets.tar target modules/plugin/target modules/examples/provider/target modules/examples/consumer/target project/target | ||
|
||
- name: Upload target directories | ||
|
@@ -89,10 +123,22 @@ jobs: | |
strategy: | ||
matrix: | ||
os: [ubuntu-latest] | ||
scala: [3.3.4-RC1] | ||
scala: [3.5.0] | ||
java: [zulu@17] | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- name: Ignore line ending differences in git | ||
if: contains(runner.os, 'windows') | ||
run: git config --global core.autocrlf false | ||
|
||
- name: Configure pagefile for Windows | ||
if: contains(runner.os, 'windows') | ||
uses: al-cheb/[email protected] | ||
with: | ||
minimum-size: 2GB | ||
maximum-size: 8GB | ||
disk-root: 'C:' | ||
|
||
- name: Checkout current branch (full) | ||
uses: actions/checkout@v4 | ||
with: | ||
|
@@ -117,12 +163,12 @@ jobs: | |
- name: Setup sbt | ||
uses: sbt/setup-sbt@v1 | ||
|
||
- name: Download target directories (3.3.4-RC1) | ||
- name: Download target directories (3.5.0) | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: target-${{ matrix.os }}-3.3.4-RC1-${{ matrix.java }} | ||
name: target-${{ matrix.os }}-3.5.0-${{ matrix.java }} | ||
|
||
- name: Inflate target directories (3.3.4-RC1) | ||
- name: Inflate target directories (3.5.0) | ||
run: | | ||
tar xf targets.tar | ||
rm targets.tar | ||
|
This file was deleted.
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 |
---|---|---|
|
@@ -4,20 +4,26 @@ import PublishSettings.* | |
import TestEnvironment.* | ||
|
||
ThisBuild / scalaVersion := scalaV | ||
//ThisBuild / conflictManager := ConflictManager.strict | ||
|
||
lazy val plugin = project | ||
.in(file("modules/plugin")) | ||
lazy val pactOptions: Seq[Tests.Argument] = Seq( | ||
Some(sys.env.getOrElse("PACT_BROKER_BASE_URL", "http://localhost:9292")).map(s => s"-Dpactbroker.url=$s"), | ||
sys.env.get("PACT_BROKER_USERNAME").map(s => s"-Dpactbroker.auth.username=$s"), | ||
sys.env.get("PACT_BROKER_PASSWORD").map(s => s"-Dpactbroker.auth.password=$s"), | ||
sys.env.get("PACT_BROKER_TAG").map(s => s"-Dpactbroker.consumerversionselectors.tags=$s"), | ||
).flatten.map(o => Tests.Argument(jupiterTestFramework, o)) | ||
|
||
lazy val plugin = moduleProject("plugin", "plugin") | ||
.enablePlugins( | ||
GitHubPagesPlugin, | ||
GitVersioning, | ||
JavaAppPackaging, | ||
// https://sbt-native-packager.readthedocs.io/en/stable/recipes/longclasspath.html#long-classpaths | ||
LauncherJarPlugin | ||
) | ||
.settings( | ||
git.useGitDescribe := true, | ||
name := "plugin", | ||
maintainer := "[email protected]", | ||
basicSettings, | ||
publishSettings, | ||
testEnvSettings, | ||
gitHubPagesOrgName := "austek", | ||
|
@@ -28,29 +34,26 @@ lazy val plugin = project | |
scalapb.gen() -> (Compile / sourceManaged).value / "scalapb" | ||
), | ||
libraryDependencies ++= | ||
Dependencies.compile(apacheAvro, auPactMatchers, logback, pactCore, scalaLogging, scalaPBRuntime) ++ | ||
Dependencies.compile(apacheAvro, auPactMatchers, logback, scalaLogging, scalaPBRuntime) ++ | ||
Dependencies.protobuf(scalaPB) ++ | ||
Dependencies.test(scalaTest), | ||
dependencyOverrides ++= Seq(grpcApi, grpcCore, grpcNetty) | ||
) | ||
lazy val pluginRef = LocalProject("plugin") | ||
|
||
lazy val provider = project | ||
.in(file("modules/examples/provider")) | ||
lazy val provider = moduleProject("provider", "examples/provider") | ||
.settings( | ||
basicSettings, | ||
Test / sbt.Keys.test := (Test / sbt.Keys.test).dependsOn(pluginRef / buildTestPluginDir).value, | ||
Test / envVars := Map("PACT_PLUGIN_DIR" -> ((pluginRef / target).value / "plugin").absolutePath), | ||
testOptions ++= pactOptions, | ||
libraryDependencies ++= | ||
Dependencies.compile(avroCompiler, logback, pulsar4sCore, pulsar4sAvro, scalacheck) ++ | ||
Dependencies.test(assertJCore, jUnitInterface, pactProviderJunit), | ||
publish / skip := false | ||
) | ||
|
||
lazy val consumer = project | ||
.in(file("modules/examples/consumer")) | ||
lazy val consumer = moduleProject("consumer", "examples/consumer") | ||
.settings( | ||
basicSettings, | ||
Compile / avroSource := (Compile / resourceDirectory).value / "avro", | ||
Test / sbt.Keys.test := (Test / sbt.Keys.test).dependsOn(pluginRef / buildTestPluginDir).value, | ||
Test / envVars := Map("PACT_PLUGIN_DIR" -> ((pluginRef / target).value / "plugin").absolutePath), | ||
|
@@ -70,3 +73,19 @@ lazy val `pact-avro-plugin` = (project in file(".")) | |
basicSettings, | ||
publish / skip := false | ||
) | ||
|
||
def moduleProject(name: String, path: String): Project = { | ||
Project(name, file(s"modules/$path")) | ||
.enablePlugins(GitVersioning, ScalafmtPlugin) | ||
.settings( | ||
basicSettings, | ||
moduleName := name, | ||
git.useGitDescribe := true, | ||
git.gitTagToVersionNumber := { tag: String => | ||
if(tag matches "v[0-9].*") { | ||
Some(tag.drop(1).replaceAll("-[0-9]+-.+", "")) | ||
} | ||
else None | ||
} | ||
) | ||
} |
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
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
Oops, something went wrong.