Skip to content

Commit bed632a

Browse files
authored
Initialize nix setup for the repo (#880)
1 parent 68388f3 commit bed632a

23 files changed

Lines changed: 269 additions & 163 deletions

.github/PULL_REQUEST_TEMPLATE.md

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

.github/dependabot.yml

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

.github/labeler.yml

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

.github/release-drafter.yml

Lines changed: 0 additions & 4 deletions
This file was deleted.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"$schema": "http://json.schemastore.org/renovate",
33
"extends": [
4-
"github>sourcegraph/renovate-config"
4+
"config:recommended"
55
],
66
"semanticCommits": false
77
}

.github/workflows/ci.yml

Lines changed: 58 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,14 @@ jobs:
1818
steps:
1919
- uses: actions/checkout@v4
2020

21-
- uses: actions/setup-java@v4
21+
- uses: DeterminateSystems/nix-installer-action@v22
2222
with:
23-
distribution: "temurin"
24-
cache: "sbt"
25-
java-version: ${{ matrix.java }}
23+
summarize: false
2624

27-
- uses: sbt/setup-sbt@v1
28-
29-
- name: Setup Gradle 8.10
30-
uses: gradle/actions/setup-gradle@v4
31-
with:
32-
gradle-version: '8.10'
25+
- uses: DeterminateSystems/magic-nix-cache-action@v13
3326

3427
- name: Main project tests
35-
run: sbt test
28+
run: nix develop .#jdk${{ matrix.java }} --command sbt test
3629

3730
docker_test:
3831
runs-on: ${{ matrix.os }}
@@ -42,30 +35,28 @@ jobs:
4235
matrix:
4336
os: [ubuntu-latest]
4437
steps:
45-
- uses: actions/checkout@v2
38+
- uses: actions/checkout@v4
4639

47-
- uses: actions/setup-java@v3
40+
- uses: DeterminateSystems/nix-installer-action@v22
4841
with:
49-
distribution: "temurin"
50-
cache: "sbt"
51-
java-version: 17
42+
summarize: false
5243

53-
- uses: sbt/setup-sbt@v1
44+
- uses: DeterminateSystems/magic-nix-cache-action@v13
5445

5546
- name: Build Dockerised CLI
56-
run: DOCKER_BUILDKIT=0 sbt cli/docker
47+
run: nix develop --command bash -c "DOCKER_BUILDKIT=0 sbt cli/docker"
5748

5849
- name: Test repos
5950
shell: bash
6051
run: |
6152
set -eu
6253
check_repo() {
6354
REPO=$1
64-
mkdir -p .repos/$REPO
65-
git clone https://github.com/$REPO.git .repos/$REPO && cd .repos/$REPO && git submodule update --init
55+
mkdir -p ".repos/$REPO"
56+
git clone "https://github.com/$REPO.git" ".repos/$REPO" && cd ".repos/$REPO" && git submodule update --init
6657
67-
docker run -v $PWD/.repos/$REPO:/sources -w /sources sourcegraph/scip-java:latest scip-java index
68-
file .repos/$REPO/index.scip || (echo "$REPO SCIP index doesn't exist!"; exit 1)
58+
docker run -v "$PWD/.repos/$REPO:/sources" -w /sources sourcegraph/scip-java:latest scip-java index
59+
file ".repos/$REPO/index.scip" || (echo "$REPO SCIP index doesn't exist!"; exit 1)
6960
}
7061
7162
sudo apt install parallel
@@ -76,41 +67,48 @@ jobs:
7667
bazel:
7768
runs-on: ubuntu-latest
7869
steps:
79-
- uses: actions/checkout@v2
80-
- run: yarn global add @bazel/bazelisk
81-
- run: bazel build //... --//semanticdb-javac:enabled=true
82-
- run: bazel run scip-semanticdb:bazel -- --sourceroot "$PWD"
70+
- uses: actions/checkout@v4
71+
72+
- uses: DeterminateSystems/nix-installer-action@v22
73+
with:
74+
summarize: false
75+
76+
- uses: DeterminateSystems/magic-nix-cache-action@v13
77+
78+
- run: nix develop --command bazelisk build //... --//semanticdb-javac:enabled=true
79+
- run: nix develop --command bazelisk run scip-semanticdb:bazel -- --sourceroot "$PWD"
8380
- run: du -h index.scip
84-
- run: bazel build //... --@scip_java//semanticdb-javac:enabled=true
81+
- run: nix develop "$GITHUB_WORKSPACE" --command bazelisk build //... --@scip_java//semanticdb-javac:enabled=true
8582
working-directory: examples/bazel-example
86-
- run: bazel run @scip_java//scip-semanticdb:bazel -- --sourceroot "$PWD"
83+
- run: nix develop "$GITHUB_WORKSPACE" --command bazelisk run @scip_java//scip-semanticdb:bazel -- --sourceroot "$PWD"
8784
working-directory: examples/bazel-example
8885
- run: du -h index.scip
8986
working-directory: examples/bazel-example
9087

9188
bazel_aspect:
9289
runs-on: ubuntu-latest
9390
steps:
94-
- uses: actions/checkout@v2
95-
- run: yarn global add @bazel/bazelisk
91+
- uses: actions/checkout@v4
9692

97-
- uses: actions/setup-java@v3
93+
- uses: DeterminateSystems/nix-installer-action@v22
9894
with:
99-
distribution: "temurin"
100-
cache: "sbt"
101-
java-version: 17
95+
summarize: false
10296

103-
- uses: sbt/setup-sbt@v1
97+
- uses: DeterminateSystems/magic-nix-cache-action@v13
10498

105-
- run: sbt build
106-
- run: echo "$PWD/out/bin" >> $GITHUB_PATH
99+
- run: nix develop --command sbt build
100+
- run: echo "$PWD/out/bin" >> "$GITHUB_PATH"
107101
- name: Auto-index scip-java codebase
108102
run: |
109-
scip-java index --build-tool=bazel --bazel-scip-java-binary=$(which scip-java)
103+
# shellcheck disable=SC2016
104+
nix develop --command bash -c \
105+
'scip-java index --build-tool=bazel --bazel-scip-java-binary=$(which scip-java)'
110106
- run: du -h index.scip
111107
- name: Auto-index example/bazel-workspace
112108
run: |
113-
scip-java index --build-tool=bazel --bazel-scip-java-binary=$(which scip-java)
109+
# shellcheck disable=SC2016
110+
nix develop "$GITHUB_WORKSPACE" --command bash -c \
111+
'scip-java index --build-tool=bazel --bazel-scip-java-binary=$(which scip-java)'
114112
working-directory: examples/bazel-example
115113
- run: du -h index.scip
116114
working-directory: examples/bazel-example
@@ -121,19 +119,17 @@ jobs:
121119
steps:
122120
- uses: actions/checkout@v4
123121

124-
- uses: actions/setup-java@v4
122+
- uses: DeterminateSystems/nix-installer-action@v22
125123
with:
126-
distribution: "temurin"
127-
cache: "sbt"
128-
java-version: 11
124+
summarize: false
129125

130-
- uses: sbt/setup-sbt@v1
126+
- uses: DeterminateSystems/magic-nix-cache-action@v13
131127

132128
- name: semanticdb-kotlinc tests
133-
run: sbt semanticdbKotlinc/test
129+
run: nix develop --command sbt semanticdbKotlinc/test
134130

135131
- name: Kotlin snapshots
136-
run: sbt semanticdbKotlincMinimized/kotlincSnapshots
132+
run: nix develop --command sbt semanticdbKotlincMinimized/kotlincSnapshots
137133

138134
- name: Check snapshot drift
139135
run: |
@@ -143,20 +139,18 @@ jobs:
143139
check:
144140
runs-on: ubuntu-latest
145141
steps:
146-
- uses: actions/checkout@v2
142+
- uses: actions/checkout@v4
147143

148-
- uses: actions/setup-java@v3
144+
- uses: DeterminateSystems/nix-installer-action@v22
149145
with:
150-
distribution: "temurin"
151-
java-version: 11
152-
cache: "sbt"
146+
summarize: false
153147

154-
- uses: sbt/setup-sbt@v1
148+
- uses: DeterminateSystems/magic-nix-cache-action@v13
155149

156-
- run: sbt --client checkAll
150+
- run: nix develop --command sbt --client checkAll
157151

158152
- name: Run sample benchmarks
159-
run: sbt --client 'bench/Jmh/run -i 1 -f1 -t1 -foe true'
153+
run: nix develop --command sbt --client 'bench/Jmh/run -i 1 -f1 -t1 -foe true'
160154

161155

162156
maven:
@@ -169,30 +163,29 @@ jobs:
169163
steps:
170164
- uses: actions/checkout@v4
171165

172-
- uses: actions/setup-java@v4
166+
- uses: DeterminateSystems/nix-installer-action@v22
173167
with:
174-
distribution: "temurin"
175-
cache: "sbt"
176-
java-version: ${{ matrix.java }}
168+
summarize: false
177169

178-
- uses: sbt/setup-sbt@v1
170+
- uses: DeterminateSystems/magic-nix-cache-action@v13
179171

180172
- run: |
181-
sbt build publishM2 publishLocal dumpScipJavaVersion
182-
echo "SCIP_JAVA_VERSION=$(cat VERSION)" >> $GITHUB_ENV
183-
echo "SCIP_JAVA_CLI=$PWD/out/bin/scip-java" >> $GITHUB_ENV
173+
nix develop .#jdk${{ matrix.java }} --command sbt build publishM2 publishLocal dumpScipJavaVersion
174+
echo "SCIP_JAVA_VERSION=$(cat VERSION)" >> "$GITHUB_ENV"
175+
echo "SCIP_JAVA_CLI=$PWD/out/bin/scip-java" >> "$GITHUB_ENV"
184176
185177
- run: |
186-
mvn clean verify -DskipTests -Dscip-java.version=$SCIP_JAVA_VERSION sourcegraph:sourcegraphDependencies
178+
nix develop "$GITHUB_WORKSPACE#jdk${{ matrix.java }}" --command \
179+
mvn clean verify -DskipTests "-Dscip-java.version=$SCIP_JAVA_VERSION" sourcegraph:sourcegraphDependencies
187180
working-directory: examples/maven-example
188181
189-
- run: $SCIP_JAVA_CLI index-semanticdb target/semanticdb-targetroot
182+
- run: nix develop "$GITHUB_WORKSPACE#jdk${{ matrix.java }}" --command "$SCIP_JAVA_CLI" index-semanticdb target/semanticdb-targetroot
190183
working-directory: examples/maven-example
191184

192185
- run: |
193186
set -e
194187
grep org.hamcrest target/semanticdb-targetroot/*dependencies.txt
195-
grep $PWD/src/main/java target/semanticdb-targetroot/*dependencies.txt
188+
grep "$PWD/src/main/java" target/semanticdb-targetroot/*dependencies.txt
196189
working-directory: examples/maven-example
197190
198191
- run: du -h index.scip

.github/workflows/labeler.yml

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

.github/workflows/mdoc.yml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,13 @@ jobs:
77
publish:
88
runs-on: ubuntu-latest
99
steps:
10-
- uses: actions/checkout@v3
10+
- uses: actions/checkout@v4
1111
with:
1212
fetch-depth: 0
13-
- uses: actions/setup-java@v3
13+
- uses: DeterminateSystems/nix-installer-action@v22
1414
with:
15-
distribution: 'temurin'
16-
java-version: 11
17-
cache: 'sbt'
18-
- uses: sbt/setup-sbt@v1
19-
- run: sbt docs/docusaurusPublishGhpages
15+
summarize: false
16+
- uses: DeterminateSystems/magic-nix-cache-action@v13
17+
- run: nix develop --command sbt docs/docusaurusPublishGhpages
2018
env:
2119
GIT_DEPLOY_KEY: ${{ secrets.GIT_DEPLOY_KEY }}

.github/workflows/release-cli.yml

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,19 @@ permissions:
1313
jobs:
1414
publish:
1515
runs-on: ubuntu-latest
16+
defaults:
17+
run:
18+
shell: nix develop --command bash -e {0}
1619
steps:
17-
- uses: actions/setup-java@v4
18-
with:
19-
distribution: 'temurin'
20-
java-version: 11
20+
- uses: actions/checkout@v4
2121

22-
- uses: coursier/setup-action@v3
22+
- uses: DeterminateSystems/nix-installer-action@v22
2323
with:
24-
apps: ''
24+
summarize: false
25+
26+
- uses: DeterminateSystems/magic-nix-cache-action@v13
2527

2628
- name: Build standalone launcher
27-
shell: bash
2829
env:
2930
OUT_DIR: ${{ runner.temp }}/release-cli
3031
TAG: ${{ inputs.tag }}
@@ -67,7 +68,6 @@ jobs:
6768
6869
- name: Check for GitHub release
6970
id: release
70-
shell: bash
7171
env:
7272
GH_TOKEN: ${{ github.token }}
7373
TAG: ${{ inputs.tag }}
@@ -83,7 +83,6 @@ jobs:
8383
8484
- name: Upload release assets
8585
if: steps.release.outputs.exists == 'true'
86-
shell: bash
8786
env:
8887
OUT_DIR: ${{ runner.temp }}/release-cli
8988
GH_TOKEN: ${{ github.token }}

.github/workflows/release-docker.yml

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,17 @@ jobs:
88
publish:
99
runs-on: ubuntu-latest
1010
steps:
11-
- uses: actions/checkout@v3
11+
- uses: actions/checkout@v4
1212
with:
1313
fetch-depth: 0
14-
- uses: actions/setup-java@v3
14+
- uses: DeterminateSystems/nix-installer-action@v22
1515
with:
16-
distribution: 'temurin'
17-
java-version: 11
18-
cache: 'sbt'
19-
- uses: sbt/setup-sbt@v1
20-
- uses: docker/setup-buildx-action@v1
16+
summarize: false
17+
- uses: DeterminateSystems/magic-nix-cache-action@v13
18+
- uses: docker/setup-buildx-action@v3
2119
- name: Login to DockerHub
22-
uses: docker/login-action@v1
20+
uses: docker/login-action@v3
2321
with:
2422
username: ${{ secrets.DOCKER_USERNAME }}
2523
password: ${{ secrets.DOCKER_PASSWORD }}
26-
- run: DOCKER_BUILDKIT=0 sbt cli/dockerBuildAndPush
24+
- run: nix develop --command bash -c "DOCKER_BUILDKIT=0 sbt cli/dockerBuildAndPush"

0 commit comments

Comments
 (0)