From 549017478c943ded9ba5b2ab902d73cd40b4f29b Mon Sep 17 00:00:00 2001 From: jossmoff Date: Tue, 21 May 2024 13:49:35 +0100 Subject: [PATCH] :bug: Fixing bugs --- .github/workflows/cicd.yaml | 28 +++++++++++++++++ .github/workflows/deploy-docs.yaml | 31 +++++++++++++++++++ .github/workflows/publish.yaml | 14 ++------- .github/workflows/release-drafter.yaml | 20 ++++++++++++ build.gradle | 23 ++++++++------ example/build.gradle | 2 +- .../scala/dev/joss/gatling/sfn/SfnDsl.scala | 3 +- .../sfn/action/StartSyncExecutionAction.scala | 2 +- .../StartSyncExecutionActionBuilder.scala | 2 +- .../sfn/request/SfnDslBuilderBase.scala | 8 ++--- 10 files changed, 104 insertions(+), 29 deletions(-) create mode 100644 .github/workflows/cicd.yaml create mode 100644 .github/workflows/deploy-docs.yaml create mode 100644 .github/workflows/release-drafter.yaml diff --git a/.github/workflows/cicd.yaml b/.github/workflows/cicd.yaml new file mode 100644 index 0000000..687bdc4 --- /dev/null +++ b/.github/workflows/cicd.yaml @@ -0,0 +1,28 @@ +name: 🕵️ + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + ci: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Set up JDK 11 + uses: actions/setup-java@v3 + with: + distribution: temurin + java-version: 17 + + - name: Build & Test + run: ./gradlew clean build + + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@v3 + with: + token: ${{ secrets.CODECOV_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/deploy-docs.yaml b/.github/workflows/deploy-docs.yaml new file mode 100644 index 0000000..abd13c5 --- /dev/null +++ b/.github/workflows/deploy-docs.yaml @@ -0,0 +1,31 @@ +name: 📚 Deploy Documentation + +on: + push: + branches: + - main + paths: + - 'docs/**' + + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - name: 🔄 Checkout + uses: actions/checkout@v3 + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v4 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: us-east-1 + - name: 📥 Install modules + run: npm ci --prefix docs + - name: 🏗️ Build application + run: npm run build --prefix docs + - name: 🚀 Deploy to S3 + run: aws s3 sync ./docs/dist/ s3://${{ secrets.BUCKET_ID }} + - name: ☁️ Create CloudFront invalidation + run: aws cloudfront create-invalidation --distribution-id ${{ secrets.DISTRIBUTION_ID }} --paths "/*" + diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index e006fe6..7989e76 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -18,20 +18,10 @@ jobs: distribution: temurin java-version: 11 - - name: Set up Test Environment - run: | - pip install localstack awscli-local - docker pull localstack/localstack - - - name: Test - run: ./gradlew test - env: - OPENAI_TOKEN: ${{ secrets.OPENAI_TOKEN }} - - name: Publish - run: ./gradlew build publish --no-parallel + run: ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository -Prelease env: ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.SONATYPE_NEXUS_USERNAME }} ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.SONATYPE_NEXUS_PASSWORD }} ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SIGNING_KEY }} - ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SIGNING_PASSWORD }} + ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SIGNING_PASSWORD }} \ No newline at end of file diff --git a/.github/workflows/release-drafter.yaml b/.github/workflows/release-drafter.yaml new file mode 100644 index 0000000..c715c07 --- /dev/null +++ b/.github/workflows/release-drafter.yaml @@ -0,0 +1,20 @@ +name: Release Drafter + +on: + push: + branches: + - main + +permissions: + contents: read + +jobs: + update_release_draft: + permissions: + contents: write + pull-requests: write + runs-on: ubuntu-latest + steps: + - uses: release-drafter/release-drafter@v5 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/build.gradle b/build.gradle index 2cda8cc..5a154bc 100644 --- a/build.gradle +++ b/build.gradle @@ -1,10 +1,14 @@ plugins { id 'scala' + id 'java' id 'jacoco' - id 'com.diffplug.spotless' version '6.20.0' id 'maven-publish' id 'signing' id "com.avast.gradle.docker-compose" version "0.17.4" + id 'com.palantir.git-version' version '3.0.0' + id 'io.github.gradle-nexus.publish-plugin' version "1.3.0" + id 'com.diffplug.spotless' version '6.23.2' + id "net.ltgt.errorprone" version "3.1.0" } group = 'dev.joss' @@ -21,7 +25,7 @@ repositories { ext { junitVersion = "5.10.0" scalaVersion = "2.13.11" - gatlingVersion = "3.9.5" + gatlingVersion = "3.11.0" awsSdkVersion = "2.20.130" } @@ -121,14 +125,15 @@ publishing { } } } +} + +nexusPublishing { repositories { - maven { - name = "OSSRH" - url = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/" - credentials { - username = project.findProperty("sonatypeUsername") - password = project.findProperty("sonatypePassword") - } + sonatype { + nexusUrl = uri("https://s01.oss.sonatype.org/service/local/") + snapshotRepositoryUrl = uri("https://s01.oss.sonatype.org/content/repositories/snapshots/") + username = project.findProperty("sonatypeUsername") + password = project.findProperty("sonatypePassword") } } } diff --git a/example/build.gradle b/example/build.gradle index 0d97eac..d5d01bf 100644 --- a/example/build.gradle +++ b/example/build.gradle @@ -1,7 +1,7 @@ plugins { id "scala" id 'io.gatling.gradle' version '3.9.5.5' - id "com.diffplug.spotless" version "6.20.0" + id 'com.diffplug.spotless' version '6.23.2' } repositories { diff --git a/src/main/scala/dev/joss/gatling/sfn/SfnDsl.scala b/src/main/scala/dev/joss/gatling/sfn/SfnDsl.scala index 1757483..8d90279 100644 --- a/src/main/scala/dev/joss/gatling/sfn/SfnDsl.scala +++ b/src/main/scala/dev/joss/gatling/sfn/SfnDsl.scala @@ -1,5 +1,6 @@ package dev.joss.gatling.sfn +import dev.joss.gatling.sfn.action.StartSyncExecutionActionBuilder import dev.joss.gatling.sfn.protocol.{ SfnProtocol, SfnProtocolBuilder, @@ -45,7 +46,7 @@ trait SfnDsl { ): ActionBuilder = builder.build implicit def sfnDslBuilder2ActionBuilder( - builder: StartSyncExecutionActionBuilder + builder: StartSyncExecutionActionBuilder ): ActionBuilder = builder.build implicit def sfnDslBuilder2ActionBuilder( diff --git a/src/main/scala/dev/joss/gatling/sfn/action/StartSyncExecutionAction.scala b/src/main/scala/dev/joss/gatling/sfn/action/StartSyncExecutionAction.scala index f85a6b8..99d5ff7 100644 --- a/src/main/scala/dev/joss/gatling/sfn/action/StartSyncExecutionAction.scala +++ b/src/main/scala/dev/joss/gatling/sfn/action/StartSyncExecutionAction.scala @@ -1,4 +1,4 @@ -package uk.co.capitalone.services.decision.processor.utils +package dev.joss.gatling.sfn.action import dev.joss.gatling.sfn.action.SfnActionBase import dev.joss.gatling.sfn.request.attributes.SfnExecuteAttributes diff --git a/src/main/scala/dev/joss/gatling/sfn/action/StartSyncExecutionActionBuilder.scala b/src/main/scala/dev/joss/gatling/sfn/action/StartSyncExecutionActionBuilder.scala index 2308727..c2b5ec1 100644 --- a/src/main/scala/dev/joss/gatling/sfn/action/StartSyncExecutionActionBuilder.scala +++ b/src/main/scala/dev/joss/gatling/sfn/action/StartSyncExecutionActionBuilder.scala @@ -1,4 +1,4 @@ -package uk.co.capitalone.services.decision.processor.utils +package dev.joss.gatling.sfn.action import dev.joss.gatling.sfn.action.SfnActionBuilderBase import dev.joss.gatling.sfn.request.attributes.SfnExecuteAttributes diff --git a/src/main/scala/dev/joss/gatling/sfn/request/SfnDslBuilderBase.scala b/src/main/scala/dev/joss/gatling/sfn/request/SfnDslBuilderBase.scala index 9c7ec89..f98b395 100644 --- a/src/main/scala/dev/joss/gatling/sfn/request/SfnDslBuilderBase.scala +++ b/src/main/scala/dev/joss/gatling/sfn/request/SfnDslBuilderBase.scala @@ -37,8 +37,8 @@ object StartSyncExecutionDslBuilder { } final class Payload( - requestName: Expression[String], - executionArn: Expression[String] + requestName: Expression[String], + executionArn: Expression[String] ) { def payload(payload: Expression[String]): StartSyncExecutionDslBuilder = StartSyncExecutionDslBuilder( @@ -49,8 +49,8 @@ object StartSyncExecutionDslBuilder { } final case class StartSyncExecutionDslBuilder( - attributes: SfnExecuteAttributes, - factory: SfnExecuteAttributes => StartSyncExecutionActionBuilder + attributes: SfnExecuteAttributes, + factory: SfnExecuteAttributes => StartSyncExecutionActionBuilder ) { def build: ActionBuilder = factory(attributes) }