From ee530850c317546c618470e1ab468be9196d9f1b Mon Sep 17 00:00:00 2001 From: ghostbuster91 Date: Mon, 31 Jan 2022 23:28:08 +0100 Subject: [PATCH 1/3] Setup sourcegraph for scala 2 --- .github/workflows/main.yml | 41 ++++++++++++++++++++++++++++++++------ 1 file changed, 35 insertions(+), 6 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2d48b340..c1c6fc2d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -16,9 +16,9 @@ jobs: - name: Checkout uses: actions/checkout@v2 - name: Set up JDK 11 - uses: actions/setup-java@v1 + uses: coursier/setup-action@v1.1.2 with: - java-version: 11 + jvm: adopt:11 - name: Cache sbt uses: coursier/cache-action@v6 with: @@ -40,9 +40,9 @@ jobs: with: fetch-depth: 0 # checkout tags so that dynver works properly (we need the version for MiMa) - name: Set up JDK 11 - uses: actions/setup-java@v1 + uses: coursier/setup-action@v1.1.2 with: - java-version: 11 + jvm: adopt:11 - name: Cache sbt uses: coursier/cache-action@v6 with: @@ -50,6 +50,35 @@ jobs: - name: Check MiMa # disable for major releases run: sbt -v core/mimaReportBinaryIssues + sourcegraph: + name: Upload index to sourcegraph + needs: [ci] + # run on external PRs, but not on internal PRs since those will be run by push to branch + if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository + runs-on: ubuntu-20.04 + env: + JAVA_OPTS: -Xmx4G + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Set up JDK 11 + uses: coursier/setup-action@v1.1.2 + with: + jvm: adopt:11 + apps: lsif-java + - name: Cache sbt + uses: coursier/cache-action@v6 + with: + extraKey: sbt-cache-${{ runner.os }} + - name: Generate LSIF + run: lsif-java index + - name: Upload LSIF data + uses: sourcegraph/lsif-upload-action@master + with: + endpoint: https://sourcegraph.com + github_token: ${{ secrets.GITHUB_TOKEN }} + file: dump.lsif + publish: name: Publish release needs: [ci] @@ -61,9 +90,9 @@ jobs: - name: Checkout uses: actions/checkout@v2 - name: Set up JDK 11 - uses: actions/setup-java@v1 + uses: coursier/setup-action@v1.1.2 with: - java-version: 11 + jvm: adopt:11 - name: Cache sbt uses: coursier/cache-action@v6 with: From 875432abb26bc3d3f9449501df1fae5058e21a87 Mon Sep 17 00:00:00 2001 From: ghostbuster91 Date: Mon, 31 Jan 2022 23:51:58 +0100 Subject: [PATCH 2/3] Enable semanticDb explicitly --- build.sbt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/build.sbt b/build.sbt index f101aa81..96f34e13 100644 --- a/build.sbt +++ b/build.sbt @@ -76,3 +76,10 @@ lazy val test = (projectMatrix in file("test")) ) .jvmPlatform(scalaVersions = scala2) .jsPlatform(scalaVersions = scala2) + +inThisBuild( + List( + semanticdbEnabled := true, + semanticdbVersion := "4.4.33" + ) +) \ No newline at end of file From 9d5aa3db4b20af2aef885398a76942dd075e48bc Mon Sep 17 00:00:00 2001 From: ghostbuster91 Date: Sun, 6 Feb 2022 18:01:34 +0100 Subject: [PATCH 3/3] Add sbt-sourcegraph plugin and enable semanticDb on demand --- .github/workflows/main.yml | 5 ++--- build.sbt | 7 ------- project/plugins.sbt | 2 ++ 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c1c6fc2d..2c0699c8 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -65,19 +65,18 @@ jobs: uses: coursier/setup-action@v1.1.2 with: jvm: adopt:11 - apps: lsif-java - name: Cache sbt uses: coursier/cache-action@v6 with: extraKey: sbt-cache-${{ runner.os }} - name: Generate LSIF - run: lsif-java index + run: sbt 'set every semanticdbEnabled := true; set every semanticdbVersion := "4.4.33"' sourcegraphLsif - name: Upload LSIF data uses: sourcegraph/lsif-upload-action@master with: endpoint: https://sourcegraph.com github_token: ${{ secrets.GITHUB_TOKEN }} - file: dump.lsif + file: target/sbt-sourcegraph/dump.lsif publish: name: Publish release diff --git a/build.sbt b/build.sbt index 96f34e13..f101aa81 100644 --- a/build.sbt +++ b/build.sbt @@ -76,10 +76,3 @@ lazy val test = (projectMatrix in file("test")) ) .jvmPlatform(scalaVersions = scala2) .jsPlatform(scalaVersions = scala2) - -inThisBuild( - List( - semanticdbEnabled := true, - semanticdbVersion := "4.4.33" - ) -) \ No newline at end of file diff --git a/project/plugins.sbt b/project/plugins.sbt index 0575c716..d4f236ab 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -7,3 +7,5 @@ addSbtPlugin("com.softwaremill.sbt-softwaremill" % "sbt-softwaremill-publish" % addSbtPlugin("org.jetbrains.scala" % "sbt-ide-settings" % "1.1.1") addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.8.0") addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "1.0.1") + +addSbtPlugin("com.sourcegraph" % "sbt-sourcegraph" % "0.3.3")