Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -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
25 changes: 0 additions & 25 deletions .github/workflows/nix-flake-check.yml

This file was deleted.

128 changes: 73 additions & 55 deletions .github/workflows/ci.yml → .github/workflows/nix.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
name: CI
name: Nix
on:
push:
branches:
- main
pull_request:

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:
test:
flake-check:
runs-on: ubuntu-latest
name: Tests
strategy:
fail-fast: false
matrix:
java: [11, 17, 21]
name: nix flake check
steps:
- uses: actions/checkout@v4

Expand All @@ -21,38 +29,44 @@ jobs:

- uses: DeterminateSystems/magic-nix-cache-action@v13

- name: Main project tests
run: nix develop .#jdk${{ matrix.java }} --command gradle test --no-daemon
- run: nix flake check -L

docker_test:
test:
runs-on: ubuntu-latest
name: Docker CLI tests
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

- 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)
}
- uses: DeterminateSystems/nix-installer-action@v22
with:
summarize: false

sudo apt install parallel
export -f check_repo
- uses: DeterminateSystems/magic-nix-cache-action@v13

parallel -j4 check_repo ::: circe/circe indeedeng/iwf-java-sdk
- 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

Expand All @@ -62,15 +76,12 @@ jobs:

- 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: 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
- 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
working-directory: ${{ matrix.directory }}

bazel_aspect:
runs-on: ubuntu-latest
Expand All @@ -83,19 +94,15 @@ jobs:

- 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"
- 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: |
# shellcheck disable=SC2016
nix develop --command bash -c \
'scip-java index --build-tool=bazel --bazel-scip-java-binary=$(which scip-java)'
"$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: |
# shellcheck disable=SC2016
nix develop "$GITHUB_WORKSPACE" --command bash -c \
'scip-java index --build-tool=bazel --bazel-scip-java-binary=$(which scip-java)'
"$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
Expand All @@ -113,10 +120,22 @@ jobs:
- uses: DeterminateSystems/magic-nix-cache-action@v13

- name: scip-kotlinc tests
run: nix develop --command gradle :scip-kotlinc:test --no-daemon
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: nix develop --command gradle :scip-snapshots:saveSnapshots --no-daemon
run: gradle :scip-snapshots:saveSnapshots --no-daemon

- name: Check snapshot drift
run: |
Expand All @@ -125,7 +144,9 @@ jobs:

maven:
runs-on: ubuntu-latest
name: Maven tests
name: Maven tests (JDK ${{ matrix.java }})
env:
NIX_DEVELOP: ${{ github.workspace }}#jdk${{ matrix.java }}
strategy:
fail-fast: false
matrix:
Expand All @@ -140,25 +161,22 @@ jobs:
- uses: DeterminateSystems/magic-nix-cache-action@v13

- run: |
nix develop .#jdk${{ matrix.java }} --command \
gradle --no-daemon :scip-java:installDist publishToMavenLocal
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
- run: 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
- run: |
"$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
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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" { } ''
Expand Down
Loading