Skip to content

Commit dcd5824

Browse files
authored
Simplify build configuration (#919)
1 parent bd52060 commit dcd5824

11 files changed

Lines changed: 105 additions & 345 deletions

File tree

.github/workflows/ci.yml

Lines changed: 11 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,8 @@ jobs:
3030
steps:
3131
- uses: actions/checkout@v4
3232

33-
- uses: DeterminateSystems/nix-installer-action@v22
34-
with:
35-
summarize: false
36-
37-
- uses: DeterminateSystems/magic-nix-cache-action@v13
38-
3933
- name: Build Dockerised CLI
40-
run: nix develop --command bash -c "DOCKER_BUILDKIT=0 sbt cli/docker"
34+
run: docker build -t sourcegraph/scip-java:latest .
4135

4236
- name: Test repos
4337
shell: bash
@@ -89,8 +83,8 @@ jobs:
8983

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

92-
- run: nix develop --command sbt build
93-
- run: echo "$PWD/out/bin" >> "$GITHUB_PATH"
86+
- run: nix develop --command sbt cli/pack
87+
- run: echo "$PWD/scip-java/target/pack/bin" >> "$GITHUB_PATH"
9488
- name: Auto-index scip-java codebase
9589
run: |
9690
# shellcheck disable=SC2016
@@ -129,20 +123,6 @@ jobs:
129123
git diff --exit-code \
130124
scip-kotlinc/minimized/src/generatedSnapshots
131125
132-
check:
133-
runs-on: ubuntu-latest
134-
steps:
135-
- uses: actions/checkout@v4
136-
137-
- uses: DeterminateSystems/nix-installer-action@v22
138-
with:
139-
summarize: false
140-
141-
- uses: DeterminateSystems/magic-nix-cache-action@v13
142-
143-
- run: nix develop --command sbt --client checkAll
144-
145-
146126
maven:
147127
runs-on: ubuntu-latest
148128
name: Maven tests
@@ -160,9 +140,14 @@ jobs:
160140
- uses: DeterminateSystems/magic-nix-cache-action@v13
161141

162142
- run: |
163-
nix develop .#jdk${{ matrix.java }} --command sbt build publishM2 publishLocal dumpScipJavaVersion
164-
echo "SCIP_JAVA_VERSION=$(cat VERSION)" >> "$GITHUB_ENV"
165-
echo "SCIP_JAVA_CLI=$PWD/out/bin/scip-java" >> "$GITHUB_ENV"
143+
nix develop .#jdk${{ matrix.java }} --command \
144+
sbt --error cli/pack publishM2 publishLocal
145+
SCIP_JAVA_VERSION="$(
146+
sed -n 's/^version:=//p' scip-java/target/pack/VERSION
147+
)"
148+
test -n "$SCIP_JAVA_VERSION"
149+
printf 'SCIP_JAVA_VERSION=%s\n' "$SCIP_JAVA_VERSION" >> "$GITHUB_ENV"
150+
printf 'SCIP_JAVA_CLI=%s\n' "$PWD/scip-java/target/pack/bin/scip-java" >> "$GITHUB_ENV"
166151
167152
- run: |
168153
nix develop "$GITHUB_WORKSPACE#jdk${{ matrix.java }}" --command \

.github/workflows/release-docker.yml

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,25 @@ jobs:
1111
- uses: actions/checkout@v4
1212
with:
1313
fetch-depth: 0
14-
- uses: DeterminateSystems/nix-installer-action@v22
15-
with:
16-
summarize: false
17-
- uses: DeterminateSystems/magic-nix-cache-action@v13
1814
- uses: docker/setup-buildx-action@v3
1915
- name: Login to DockerHub
2016
uses: docker/login-action@v3
2117
with:
2218
username: ${{ secrets.DOCKER_USERNAME }}
2319
password: ${{ secrets.DOCKER_PASSWORD }}
24-
- run: nix develop --command bash -c "DOCKER_BUILDKIT=0 sbt cli/dockerBuildAndPush"
20+
- name: Build and push Docker image
21+
shell: bash
22+
run: |
23+
set -euo pipefail
24+
25+
tags=(--tag sourcegraph/scip-java:latest-snapshot)
26+
27+
if [[ "${GITHUB_REF_TYPE}" == "tag" ]]; then
28+
version="${GITHUB_REF_NAME#v}"
29+
tags=(
30+
--tag sourcegraph/scip-java:latest
31+
--tag "sourcegraph/scip-java:${version}"
32+
)
33+
fi
34+
35+
docker buildx build --push "${tags[@]}" .

.jvmopts

Lines changed: 0 additions & 4 deletions
This file was deleted.

.scalafix.conf

Lines changed: 0 additions & 15 deletions
This file was deleted.

.scalafmt.conf

Lines changed: 0 additions & 12 deletions
This file was deleted.

CONTRIBUTING.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ nix develop .#jdk21 # JDK 21
1515
```
1616

1717
This drops you into a shell with `sbt`, `maven`, `gradle`, `bazelisk`,
18-
`scalafmt`, `nodejs`, `yarn`, `git`, `jq`, etc. all pinned to the versions used
19-
in CI.
18+
`nodejs`, `yarn`, `git`, `jq`, etc. all pinned to the versions used in CI.
2019

2120
If you'd rather install tools manually, you'll need at least:
2221

@@ -40,7 +39,7 @@ These are the main components of the project.
4039
- `tests/snapshots`: slow running
4140
["snapshot tests"](https://jestjs.io/docs/en/snapshot-testing) that index a
4241
corpus of published Java libraries.
43-
- `cli/src/main/scala`: implementation of the `scip-java` command-line
42+
- `scip-java/src/main/kotlin`: implementation of the `scip-java` command-line
4443
interface.
4544
- `build.sbt`: the sbt build definition.
4645
- `project/plugins.sbt`: plugins for the sbt build.
@@ -59,7 +58,6 @@ These are the main components of the project.
5958
| `scipKotlincMinimized/kotlincSnapshots` | sbt | Update only the Kotlin snapshot goldens under `scip-kotlinc/minimized`. |
6059
| `regenerateSnapshots` | sbt | Regenerate ALL snapshot goldens (Java + Kotlin). Run after fixing a bug. |
6160
| `cli/run --cwd DIRECTORY` | sbt | Run `scip-java` command-line tool against a given Gradle/Maven build. |
62-
| `fixAll` | sbt | Run Scalafmt and Scalafix on all Scala sources. Run this before opening a PR. |
6361
| `google-java-format --replace $(git ls-files '*.java')` | terminal | Format Java sources (from `nix develop`). Enforced by `nix flake check`. |
6462
| `ktfmt --kotlinlang-style $(git ls-files '*.kt')` | terminal | Format Kotlin sources (from `nix develop`). Enforced by `nix flake check`. |
6563

@@ -74,7 +72,6 @@ community edition is
7472

7573
Next, install the following IntelliJ plugins:
7674

77-
- IntelliJ Scala plugin.
7875
- Google Java Format
7976

8077
Next, follow

Dockerfile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ RUN git config --global --add safe.directory *
1717

1818
COPY . .
1919

20-
RUN sbt publishLocal dumpScipJavaVersion
21-
RUN mkdir -p /app && coursier bootstrap "com.sourcegraph:scip-java:$(cat VERSION)" -f -o /app/scip-java -M com.sourcegraph.scip_java.ScipJava
20+
RUN sbt cli/pack && mkdir -p /app/scip-java && cp -R scip-java/target/pack/. /app/scip-java/
2221

2322
COPY ./bin/scip-java-docker-script.sh /usr/bin/scip-java
2423

bin/scip-java-docker-script.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ do
2929
eval "$(coursier java --jvm "$JVM_VERSION" --env --jvm-index https://github.com/coursier/jvm-index/blob/master/index.json)"
3030

3131
java -version
32-
if /app/scip-java "$@"; then
32+
if /app/scip-java/bin/scip-java "$@"; then
3333
LAST_CODE="0"
3434
else
3535
LAST_CODE=$?

0 commit comments

Comments
 (0)