From bf4e06ba6db547d0e327908b19c78808aa063926 Mon Sep 17 00:00:00 2001 From: jupblb Date: Thu, 25 Jun 2026 12:14:10 +0200 Subject: [PATCH 1/4] Split CI workflows --- .github/workflows/ci.yml | 8 ------ .../{nix-flake-check.yml => nix.yaml} | 0 .github/workflows/snapshots.yaml | 27 +++++++++++++++++++ 3 files changed, 27 insertions(+), 8 deletions(-) rename .github/workflows/{nix-flake-check.yml => nix.yaml} (100%) create mode 100644 .github/workflows/snapshots.yaml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 640bfdb7..4bb40497 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -115,14 +115,6 @@ jobs: - name: scip-kotlinc tests run: nix develop --command gradle :scip-kotlinc:test --no-daemon - - name: Regenerate snapshots - run: nix develop --command gradle :scip-snapshots:saveSnapshots --no-daemon - - - name: Check snapshot drift - run: | - git diff --exit-code \ - scip-snapshots/expected - maven: runs-on: ubuntu-latest name: Maven tests diff --git a/.github/workflows/nix-flake-check.yml b/.github/workflows/nix.yaml similarity index 100% rename from .github/workflows/nix-flake-check.yml rename to .github/workflows/nix.yaml diff --git a/.github/workflows/snapshots.yaml b/.github/workflows/snapshots.yaml new file mode 100644 index 00000000..c0c2ad54 --- /dev/null +++ b/.github/workflows/snapshots.yaml @@ -0,0 +1,27 @@ +name: Snapshots +on: + push: + branches: + - main + pull_request: + +jobs: + snapshots: + runs-on: ubuntu-latest + name: Snapshots + steps: + - uses: actions/checkout@v4 + + - uses: DeterminateSystems/nix-installer-action@v22 + with: + summarize: false + + - uses: DeterminateSystems/magic-nix-cache-action@v13 + + - name: Regenerate snapshots + run: nix develop --command gradle :scip-snapshots:saveSnapshots --no-daemon + + - name: Check snapshot drift + run: | + git diff --exit-code \ + scip-snapshots/expected From eeab85b443d07377916816f37cf5e85764fda687 Mon Sep 17 00:00:00 2001 From: jupblb Date: Thu, 25 Jun 2026 12:38:49 +0200 Subject: [PATCH 2/4] Rework CI workflows --- .github/workflows/ci.yaml | 33 ++++ .github/workflows/ci.yml | 159 ----------------- .github/workflows/nix.yaml | 162 +++++++++++++++++- .../{release-cli.yml => release-cli.yaml} | 0 ...release-docker.yml => release-docker.yaml} | 0 .../{release-maven.yml => release-maven.yaml} | 2 +- .github/workflows/snapshots.yaml | 27 --- flake.nix | 2 +- 8 files changed, 196 insertions(+), 189 deletions(-) create mode 100644 .github/workflows/ci.yaml delete mode 100644 .github/workflows/ci.yml rename .github/workflows/{release-cli.yml => release-cli.yaml} (100%) rename .github/workflows/{release-docker.yml => release-docker.yaml} (100%) rename .github/workflows/{release-maven.yml => release-maven.yaml} (97%) delete mode 100644 .github/workflows/snapshots.yaml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 00000000..ad749f53 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,33 @@ +name: CI +on: + push: + branches: + - main + pull_request: +jobs: + docker_test: + runs-on: ubuntu-latest + name: Docker CLI tests + steps: + - uses: actions/checkout@v4 + + - name: Build Dockerised CLI + run: docker build -t sourcegraph/scip-java:latest . + + - name: Test repos + shell: bash + run: | + set -eu + check_repo() { + REPO=$1 + mkdir -p ".repos/$REPO" + git clone "https://github.com/$REPO.git" ".repos/$REPO" && cd ".repos/$REPO" && git submodule update --init + + docker run -v "$PWD/.repos/$REPO:/sources" -w /sources sourcegraph/scip-java:latest scip-java index + file ".repos/$REPO/index.scip" || (echo "$REPO SCIP index doesn't exist!"; exit 1) + } + + sudo apt install parallel + export -f check_repo + + parallel -j4 check_repo ::: circe/circe indeedeng/iwf-java-sdk diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index 4bb40497..00000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,159 +0,0 @@ -name: CI -on: - push: - branches: - - main - pull_request: -jobs: - test: - runs-on: ubuntu-latest - name: Tests - strategy: - fail-fast: false - matrix: - java: [11, 17, 21] - steps: - - uses: actions/checkout@v4 - - - uses: DeterminateSystems/nix-installer-action@v22 - with: - summarize: false - - - uses: DeterminateSystems/magic-nix-cache-action@v13 - - - name: Main project tests - run: nix develop .#jdk${{ matrix.java }} --command gradle test --no-daemon - - docker_test: - runs-on: ubuntu-latest - name: Docker CLI tests - steps: - - uses: actions/checkout@v4 - - - name: Build Dockerised CLI - run: docker build -t sourcegraph/scip-java:latest . - - - name: Test repos - shell: bash - run: | - set -eu - check_repo() { - REPO=$1 - mkdir -p ".repos/$REPO" - git clone "https://github.com/$REPO.git" ".repos/$REPO" && cd ".repos/$REPO" && git submodule update --init - - docker run -v "$PWD/.repos/$REPO:/sources" -w /sources sourcegraph/scip-java:latest scip-java index - file ".repos/$REPO/index.scip" || (echo "$REPO SCIP index doesn't exist!"; exit 1) - } - - sudo apt install parallel - export -f check_repo - - parallel -j4 check_repo ::: circe/circe indeedeng/iwf-java-sdk - - bazel: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - uses: DeterminateSystems/nix-installer-action@v22 - with: - summarize: false - - - uses: DeterminateSystems/magic-nix-cache-action@v13 - - - run: nix develop --command bazelisk build //... --//scip-javac:enabled=true - - run: nix develop --command bazelisk run scip-aggregator:bazel -- --sourceroot "$PWD" - - run: du -h index.scip - - run: nix develop "$GITHUB_WORKSPACE" --command bazelisk build //... --@scip_java//scip-javac:enabled=true - working-directory: examples/bazel-example - - run: nix develop "$GITHUB_WORKSPACE" --command bazelisk run @scip_java//scip-aggregator:bazel -- --sourceroot "$PWD" - working-directory: examples/bazel-example - - run: du -h index.scip - working-directory: examples/bazel-example - - bazel_aspect: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - uses: DeterminateSystems/nix-installer-action@v22 - with: - summarize: false - - - uses: DeterminateSystems/magic-nix-cache-action@v13 - - - run: nix develop --command gradle :scip-java:installDist --no-daemon - - run: echo "$PWD/scip-java/build/install/scip-java/bin" >> "$GITHUB_PATH" - - name: Auto-index scip-java codebase - run: | - # shellcheck disable=SC2016 - nix develop --command bash -c \ - 'scip-java index --build-tool=bazel --bazel-scip-java-binary=$(which scip-java)' - - run: du -h index.scip - - name: Auto-index example/bazel-workspace - run: | - # shellcheck disable=SC2016 - nix develop "$GITHUB_WORKSPACE" --command bash -c \ - 'scip-java index --build-tool=bazel --bazel-scip-java-binary=$(which scip-java)' - working-directory: examples/bazel-example - - run: du -h index.scip - working-directory: examples/bazel-example - - kotlin_plugin: - runs-on: ubuntu-latest - name: scip-kotlinc - steps: - - uses: actions/checkout@v4 - - - uses: DeterminateSystems/nix-installer-action@v22 - with: - summarize: false - - - uses: DeterminateSystems/magic-nix-cache-action@v13 - - - name: scip-kotlinc tests - run: nix develop --command gradle :scip-kotlinc:test --no-daemon - - maven: - runs-on: ubuntu-latest - name: Maven tests - strategy: - fail-fast: false - matrix: - java: [11, 17, 21] - steps: - - uses: actions/checkout@v4 - - - uses: DeterminateSystems/nix-installer-action@v22 - with: - summarize: false - - - uses: DeterminateSystems/magic-nix-cache-action@v13 - - - run: | - nix develop .#jdk${{ matrix.java }} --command \ - gradle --no-daemon :scip-java:installDist publishToMavenLocal - SCIP_JAVA_VERSION="$( - sed -n 's/^version:=//p' scip-java/build/install/scip-java/VERSION - )" - test -n "$SCIP_JAVA_VERSION" - printf 'SCIP_JAVA_VERSION=%s\n' "$SCIP_JAVA_VERSION" >> "$GITHUB_ENV" - printf 'SCIP_JAVA_CLI=%s\n' "$PWD/scip-java/build/install/scip-java/bin/scip-java" >> "$GITHUB_ENV" - - - run: | - nix develop "$GITHUB_WORKSPACE#jdk${{ matrix.java }}" --command \ - mvn clean verify -DskipTests "-Dscip-java.version=$SCIP_JAVA_VERSION" sourcegraph:sourcegraphDependencies - working-directory: examples/maven-example - - - run: nix develop "$GITHUB_WORKSPACE#jdk${{ matrix.java }}" --command "$SCIP_JAVA_CLI" aggregate target/scip-targetroot - working-directory: examples/maven-example - - - run: | - set -e - grep org.hamcrest target/scip-targetroot/*dependencies.txt - grep "$PWD/src/main/java" target/scip-targetroot/*dependencies.txt - working-directory: examples/maven-example - - - run: du -h index.scip - working-directory: examples/maven-example diff --git a/.github/workflows/nix.yaml b/.github/workflows/nix.yaml index 340a3399..e9ca9fab 100644 --- a/.github/workflows/nix.yaml +++ b/.github/workflows/nix.yaml @@ -1,4 +1,4 @@ -name: nix flake check +name: Nix on: push: branches: @@ -9,6 +9,13 @@ concurrency: group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} cancel-in-progress: true +env: + NIX_DEVELOP: ${{ github.workspace }} + +defaults: + run: + shell: bash --noprofile --norc -eo pipefail -c 'nix develop ${NIX_DEVELOP:?} --command bash --noprofile --norc -eo pipefail ${1:?}' -- {0} + jobs: flake-check: runs-on: ubuntu-latest @@ -23,3 +30,156 @@ jobs: - uses: DeterminateSystems/magic-nix-cache-action@v13 - run: nix flake check -L + + test: + runs-on: ubuntu-latest + name: Tests (JDK ${{ matrix.java }}) + env: + NIX_DEVELOP: ${{ github.workspace }}#jdk${{ matrix.java }} + strategy: + fail-fast: false + matrix: + java: [11, 17, 21] + steps: + - uses: actions/checkout@v4 + + - uses: DeterminateSystems/nix-installer-action@v22 + with: + summarize: false + + - uses: DeterminateSystems/magic-nix-cache-action@v13 + + - name: Main project tests + run: gradle test --no-daemon + + bazel: + runs-on: ubuntu-latest + name: Bazel (${{ matrix.name }}) + strategy: + fail-fast: false + matrix: + include: + - name: scip-java + directory: . + javac_option: "--//scip-javac:enabled=true" + aggregator_target: "scip-aggregator:bazel" + - name: bazel-example + directory: examples/bazel-example + javac_option: "--@scip_java//scip-javac:enabled=true" + aggregator_target: "@scip_java//scip-aggregator:bazel" + steps: + - uses: actions/checkout@v4 + + - uses: DeterminateSystems/nix-installer-action@v22 + with: + summarize: false + + - uses: DeterminateSystems/magic-nix-cache-action@v13 + + - run: bazelisk build //... ${{ matrix.javac_option }} + working-directory: ${{ matrix.directory }} + - run: bazelisk run ${{ matrix.aggregator_target }} -- --sourceroot "$PWD" + working-directory: ${{ matrix.directory }} + - run: du -h index.scip + working-directory: ${{ matrix.directory }} + + bazel_aspect: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: DeterminateSystems/nix-installer-action@v22 + with: + summarize: false + + - uses: DeterminateSystems/magic-nix-cache-action@v13 + + - run: gradle :scip-java:installDist --no-daemon + - run: printf 'SCIP_JAVA_CLI=%s\n' "$PWD/scip-java/build/install/scip-java/bin/scip-java" >> "$GITHUB_ENV" + - name: Auto-index scip-java codebase + run: | + "$SCIP_JAVA_CLI" index --build-tool=bazel --bazel-scip-java-binary="$SCIP_JAVA_CLI" + - run: du -h index.scip + - name: Auto-index example/bazel-workspace + run: | + "$SCIP_JAVA_CLI" index --build-tool=bazel --bazel-scip-java-binary="$SCIP_JAVA_CLI" + working-directory: examples/bazel-example + - run: du -h index.scip + working-directory: examples/bazel-example + + kotlin_plugin: + runs-on: ubuntu-latest + name: scip-kotlinc + steps: + - uses: actions/checkout@v4 + + - uses: DeterminateSystems/nix-installer-action@v22 + with: + summarize: false + + - uses: DeterminateSystems/magic-nix-cache-action@v13 + + - name: scip-kotlinc tests + run: gradle :scip-kotlinc:test --no-daemon + + snapshots: + runs-on: ubuntu-latest + name: Snapshots + steps: + - uses: actions/checkout@v4 + + - uses: DeterminateSystems/nix-installer-action@v22 + with: + summarize: false + + - uses: DeterminateSystems/magic-nix-cache-action@v13 + + - name: Regenerate snapshots + run: gradle :scip-snapshots:saveSnapshots --no-daemon + + - name: Check snapshot drift + run: | + git diff --exit-code \ + scip-snapshots/expected + + maven: + runs-on: ubuntu-latest + name: Maven tests (JDK ${{ matrix.java }}) + env: + NIX_DEVELOP: ${{ github.workspace }}#jdk${{ matrix.java }} + strategy: + fail-fast: false + matrix: + java: [11, 17, 21] + steps: + - uses: actions/checkout@v4 + + - uses: DeterminateSystems/nix-installer-action@v22 + with: + summarize: false + + - uses: DeterminateSystems/magic-nix-cache-action@v13 + + - run: | + gradle --no-daemon :scip-java:installDist publishToMavenLocal + SCIP_JAVA_VERSION="$( + sed -n 's/^version:=//p' scip-java/build/install/scip-java/VERSION + )" + test -n "$SCIP_JAVA_VERSION" + printf 'SCIP_JAVA_VERSION=%s\n' "$SCIP_JAVA_VERSION" >> "$GITHUB_ENV" + printf 'SCIP_JAVA_CLI=%s\n' "$PWD/scip-java/build/install/scip-java/bin/scip-java" >> "$GITHUB_ENV" + + - run: mvn clean verify -DskipTests "-Dscip-java.version=$SCIP_JAVA_VERSION" sourcegraph:sourcegraphDependencies + working-directory: examples/maven-example + + - run: | + "$SCIP_JAVA_CLI" aggregate target/scip-targetroot + working-directory: examples/maven-example + + - run: | + grep org.hamcrest target/scip-targetroot/*dependencies.txt + grep "$PWD/src/main/java" target/scip-targetroot/*dependencies.txt + working-directory: examples/maven-example + + - run: du -h index.scip + working-directory: examples/maven-example diff --git a/.github/workflows/release-cli.yml b/.github/workflows/release-cli.yaml similarity index 100% rename from .github/workflows/release-cli.yml rename to .github/workflows/release-cli.yaml diff --git a/.github/workflows/release-docker.yml b/.github/workflows/release-docker.yaml similarity index 100% rename from .github/workflows/release-docker.yml rename to .github/workflows/release-docker.yaml diff --git a/.github/workflows/release-maven.yml b/.github/workflows/release-maven.yaml similarity index 97% rename from .github/workflows/release-maven.yml rename to .github/workflows/release-maven.yaml index 78659fb0..b3763d59 100644 --- a/.github/workflows/release-maven.yml +++ b/.github/workflows/release-maven.yaml @@ -38,6 +38,6 @@ jobs: needs: publish permissions: contents: write - uses: ./.github/workflows/release-cli.yml + uses: ./.github/workflows/release-cli.yaml with: tag: ${{ github.ref_name }} diff --git a/.github/workflows/snapshots.yaml b/.github/workflows/snapshots.yaml deleted file mode 100644 index c0c2ad54..00000000 --- a/.github/workflows/snapshots.yaml +++ /dev/null @@ -1,27 +0,0 @@ -name: Snapshots -on: - push: - branches: - - main - pull_request: - -jobs: - snapshots: - runs-on: ubuntu-latest - name: Snapshots - steps: - - uses: actions/checkout@v4 - - - uses: DeterminateSystems/nix-installer-action@v22 - with: - summarize: false - - - uses: DeterminateSystems/magic-nix-cache-action@v13 - - - name: Regenerate snapshots - run: nix develop --command gradle :scip-snapshots:saveSnapshots --no-daemon - - - name: Check snapshot drift - run: | - git diff --exit-code \ - scip-snapshots/expected diff --git a/flake.nix b/flake.nix index 53b054dc..da4285a0 100644 --- a/flake.nix +++ b/flake.nix @@ -45,7 +45,7 @@ { checks = { actionlint = pkgs.runCommand "check-actionlint" { } '' - ${pkgs.actionlint}/bin/actionlint ${./.github/workflows}/*.yml + ${pkgs.actionlint}/bin/actionlint ${./.github/workflows}/*.yaml touch $out ''; javafmt = pkgs.runCommand "check-javafmt" { } '' From cc64b5a4a16ba84e4500a0da16d463d70224609c Mon Sep 17 00:00:00 2001 From: jupblb Date: Thu, 25 Jun 2026 12:43:58 +0200 Subject: [PATCH 3/4] Fix Nix workflow shell --- .github/workflows/nix.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/nix.yaml b/.github/workflows/nix.yaml index e9ca9fab..ff1fc362 100644 --- a/.github/workflows/nix.yaml +++ b/.github/workflows/nix.yaml @@ -14,7 +14,7 @@ env: defaults: run: - shell: bash --noprofile --norc -eo pipefail -c 'nix develop ${NIX_DEVELOP:?} --command bash --noprofile --norc -eo pipefail ${1:?}' -- {0} + shell: bash --noprofile --norc -eo pipefail -c 'nix develop "$NIX_DEVELOP" --command bash --noprofile --norc -eo pipefail "$1"' -- {0} jobs: flake-check: From 82ce4212f8eb977e36b44b0c7ef7ee9b8e9d1a43 Mon Sep 17 00:00:00 2001 From: jupblb Date: Thu, 25 Jun 2026 12:45:46 +0200 Subject: [PATCH 4/4] Fix Nix shell quoting --- .github/workflows/nix.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/nix.yaml b/.github/workflows/nix.yaml index ff1fc362..67dcc2f7 100644 --- a/.github/workflows/nix.yaml +++ b/.github/workflows/nix.yaml @@ -14,7 +14,7 @@ env: defaults: run: - shell: bash --noprofile --norc -eo pipefail -c 'nix develop "$NIX_DEVELOP" --command bash --noprofile --norc -eo pipefail "$1"' -- {0} + shell: bash --noprofile --norc -eo pipefail -c "nix develop $NIX_DEVELOP --command bash --noprofile --norc -eo pipefail $1" -- {0} jobs: flake-check: