Add Maven build config #2627
This file contains hidden or 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
| 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 mvn --batch-mode test | |
| 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 mvn --batch-mode -pl scip-java -am -DskipTests package | |
| - run: echo "$PWD/scip-java/target/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 mvn --batch-mode -pl scip-kotlinc -am test | |
| - name: Regenerate snapshots | |
| run: nix develop --command mvn --batch-mode -pl scip-snapshots -am -DskipTests -PsaveSnapshots verify | |
| - name: Check snapshot drift | |
| run: | | |
| git diff --exit-code \ | |
| scip-snapshots/expected | |
| 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 \ | |
| mvn --batch-mode -DskipTests install | |
| SCIP_JAVA_VERSION="$( | |
| sed -n 's/^version:=//p' scip-java/target/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/target/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 |