From efdbebbcb920d32d76a1166b4351ceac047d1294 Mon Sep 17 00:00:00 2001 From: Guillaume Galy Date: Tue, 16 Jul 2024 15:16:27 +0200 Subject: [PATCH] chore: Add build action on main branch and pull requests --- .github/workflows/build.yml | 48 +++++++++++++++++++++++++++++++++++++ js/cli/package.json | 3 ++- js/core/package.json | 1 + js/http/package.json | 1 + js/jvm-types/package.json | 3 ++- jvm/build.sbt | 20 ++++++++-------- 6 files changed, 64 insertions(+), 12 deletions(-) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..501c4f6 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,48 @@ +name: Build + +on: + push: + branches: + - main + pull_request: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +defaults: + run: + shell: bash + +jobs: + build: + runs-on: ubuntu-latest + timeout-minutes: 10 + env: + JAVA_OPTS: "-Xmx4G" + SBT_OPTS: "-Dsbt.ci=true" + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up JDK + uses: actions/setup-java@v4 + with: + distribution: 'zulu' + java-version: '21' + + - name: Build JVM projects + working-directory: ./jvm + run: sbt gatling-jvm-to-js-adapter/spotlessCheck gatling-jvm-to-js-adapter/compile gatling-jvm-to-js-adapter/test + + - name: Set up Node + uses: actions/setup-node@v4 + with: + node-version: 20 + + - name: Build JS projects + working-directory: ./js + run: | + npm ci + npm run format-check --workspaces + npm run build --workspaces diff --git a/js/cli/package.json b/js/cli/package.json index bb4c951..b727d9e 100644 --- a/js/cli/package.json +++ b/js/cli/package.json @@ -28,6 +28,7 @@ "scripts": { "clean": "rimraf target", "format": "prettier --write '**/*.ts'", + "format-check": "prettier --check '**/*.ts'", "build": "tsc -p . && chmod +x ./target/index.js" } -} \ No newline at end of file +} diff --git a/js/core/package.json b/js/core/package.json index 695b7a5..f06ba05 100644 --- a/js/core/package.json +++ b/js/core/package.json @@ -19,6 +19,7 @@ "scripts": { "clean": "rimraf target", "format": "prettier --write '**/*.ts'", + "format-check": "prettier --check '**/*.ts'", "test": "jest", "build": "tsc -p ." } diff --git a/js/http/package.json b/js/http/package.json index ce8f417..fe1a6d3 100644 --- a/js/http/package.json +++ b/js/http/package.json @@ -20,6 +20,7 @@ "scripts": { "clean": "rimraf target", "format": "prettier --write '**/*.ts'", + "format-check": "prettier --check '**/*.ts'", "test": "jest", "build": "tsc -p ." } diff --git a/js/jvm-types/package.json b/js/jvm-types/package.json index a420440..f7ec3f5 100644 --- a/js/jvm-types/package.json +++ b/js/jvm-types/package.json @@ -8,6 +8,7 @@ "scripts": { "clean": "rm -f ./index.js ./index.d.ts", "format": "prettier --write 'gatling.d.ts' 'index.ts'", + "format-check": "prettier --check 'gatling.d.ts' 'index.ts'", "build": "tsc -p ." } -} \ No newline at end of file +} diff --git a/jvm/build.sbt b/jvm/build.sbt index b576490..9d1e8f9 100644 --- a/jvm/build.sbt +++ b/jvm/build.sbt @@ -49,16 +49,16 @@ lazy val adapter = (project in file("adapter")) val jsAdapterVersion = version.value val content = s"""export const versions = { - | graalvm: { - | jdk: "$graalvmJdkVersion", - | js: "$graalvmJsVersion" - | }, - | coursier: "$coursierVersion", - | gatling: { - | core: "$gatlingVersion", - | enterprisePluginCommons: "$gatlingEnterpriseComponentPluginVersion", - | jsAdapter: "$jsAdapterVersion" - | } + | graalvm: { + | jdk: "$graalvmJdkVersion", + | js: "$graalvmJsVersion" + | }, + | coursier: "$coursierVersion", + | gatling: { + | core: "$gatlingVersion", + | enterprisePluginCommons: "$gatlingEnterpriseComponentPluginVersion", + | jsAdapter: "$jsAdapterVersion" + | } |}; |""".stripMargin IO.write(path, content)