Skip to content

Commit eeab85b

Browse files
committed
Rework CI workflows
1 parent bf4e06b commit eeab85b

8 files changed

Lines changed: 196 additions & 189 deletions

File tree

‎.github/workflows/ci.yaml‎

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: CI
2+
on:
3+
push:
4+
branches:
5+
- main
6+
pull_request:
7+
jobs:
8+
docker_test:
9+
runs-on: ubuntu-latest
10+
name: Docker CLI tests
11+
steps:
12+
- uses: actions/checkout@v4
13+
14+
- name: Build Dockerised CLI
15+
run: docker build -t sourcegraph/scip-java:latest .
16+
17+
- name: Test repos
18+
shell: bash
19+
run: |
20+
set -eu
21+
check_repo() {
22+
REPO=$1
23+
mkdir -p ".repos/$REPO"
24+
git clone "https://github.com/$REPO.git" ".repos/$REPO" && cd ".repos/$REPO" && git submodule update --init
25+
26+
docker run -v "$PWD/.repos/$REPO:/sources" -w /sources sourcegraph/scip-java:latest scip-java index
27+
file ".repos/$REPO/index.scip" || (echo "$REPO SCIP index doesn't exist!"; exit 1)
28+
}
29+
30+
sudo apt install parallel
31+
export -f check_repo
32+
33+
parallel -j4 check_repo ::: circe/circe indeedeng/iwf-java-sdk

‎.github/workflows/ci.yml‎

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

‎.github/workflows/nix.yaml‎

Lines changed: 161 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: nix flake check
1+
name: Nix
22
on:
33
push:
44
branches:
@@ -9,6 +9,13 @@ concurrency:
99
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
1010
cancel-in-progress: true
1111

12+
env:
13+
NIX_DEVELOP: ${{ github.workspace }}
14+
15+
defaults:
16+
run:
17+
shell: bash --noprofile --norc -eo pipefail -c 'nix develop ${NIX_DEVELOP:?} --command bash --noprofile --norc -eo pipefail ${1:?}' -- {0}
18+
1219
jobs:
1320
flake-check:
1421
runs-on: ubuntu-latest
@@ -23,3 +30,156 @@ jobs:
2330
- uses: DeterminateSystems/magic-nix-cache-action@v13
2431

2532
- run: nix flake check -L
33+
34+
test:
35+
runs-on: ubuntu-latest
36+
name: Tests (JDK ${{ matrix.java }})
37+
env:
38+
NIX_DEVELOP: ${{ github.workspace }}#jdk${{ matrix.java }}
39+
strategy:
40+
fail-fast: false
41+
matrix:
42+
java: [11, 17, 21]
43+
steps:
44+
- uses: actions/checkout@v4
45+
46+
- uses: DeterminateSystems/nix-installer-action@v22
47+
with:
48+
summarize: false
49+
50+
- uses: DeterminateSystems/magic-nix-cache-action@v13
51+
52+
- name: Main project tests
53+
run: gradle test --no-daemon
54+
55+
bazel:
56+
runs-on: ubuntu-latest
57+
name: Bazel (${{ matrix.name }})
58+
strategy:
59+
fail-fast: false
60+
matrix:
61+
include:
62+
- name: scip-java
63+
directory: .
64+
javac_option: "--//scip-javac:enabled=true"
65+
aggregator_target: "scip-aggregator:bazel"
66+
- name: bazel-example
67+
directory: examples/bazel-example
68+
javac_option: "--@scip_java//scip-javac:enabled=true"
69+
aggregator_target: "@scip_java//scip-aggregator:bazel"
70+
steps:
71+
- uses: actions/checkout@v4
72+
73+
- uses: DeterminateSystems/nix-installer-action@v22
74+
with:
75+
summarize: false
76+
77+
- uses: DeterminateSystems/magic-nix-cache-action@v13
78+
79+
- run: bazelisk build //... ${{ matrix.javac_option }}
80+
working-directory: ${{ matrix.directory }}
81+
- run: bazelisk run ${{ matrix.aggregator_target }} -- --sourceroot "$PWD"
82+
working-directory: ${{ matrix.directory }}
83+
- run: du -h index.scip
84+
working-directory: ${{ matrix.directory }}
85+
86+
bazel_aspect:
87+
runs-on: ubuntu-latest
88+
steps:
89+
- uses: actions/checkout@v4
90+
91+
- uses: DeterminateSystems/nix-installer-action@v22
92+
with:
93+
summarize: false
94+
95+
- uses: DeterminateSystems/magic-nix-cache-action@v13
96+
97+
- run: gradle :scip-java:installDist --no-daemon
98+
- run: printf 'SCIP_JAVA_CLI=%s\n' "$PWD/scip-java/build/install/scip-java/bin/scip-java" >> "$GITHUB_ENV"
99+
- name: Auto-index scip-java codebase
100+
run: |
101+
"$SCIP_JAVA_CLI" index --build-tool=bazel --bazel-scip-java-binary="$SCIP_JAVA_CLI"
102+
- run: du -h index.scip
103+
- name: Auto-index example/bazel-workspace
104+
run: |
105+
"$SCIP_JAVA_CLI" index --build-tool=bazel --bazel-scip-java-binary="$SCIP_JAVA_CLI"
106+
working-directory: examples/bazel-example
107+
- run: du -h index.scip
108+
working-directory: examples/bazel-example
109+
110+
kotlin_plugin:
111+
runs-on: ubuntu-latest
112+
name: scip-kotlinc
113+
steps:
114+
- uses: actions/checkout@v4
115+
116+
- uses: DeterminateSystems/nix-installer-action@v22
117+
with:
118+
summarize: false
119+
120+
- uses: DeterminateSystems/magic-nix-cache-action@v13
121+
122+
- name: scip-kotlinc tests
123+
run: gradle :scip-kotlinc:test --no-daemon
124+
125+
snapshots:
126+
runs-on: ubuntu-latest
127+
name: Snapshots
128+
steps:
129+
- uses: actions/checkout@v4
130+
131+
- uses: DeterminateSystems/nix-installer-action@v22
132+
with:
133+
summarize: false
134+
135+
- uses: DeterminateSystems/magic-nix-cache-action@v13
136+
137+
- name: Regenerate snapshots
138+
run: gradle :scip-snapshots:saveSnapshots --no-daemon
139+
140+
- name: Check snapshot drift
141+
run: |
142+
git diff --exit-code \
143+
scip-snapshots/expected
144+
145+
maven:
146+
runs-on: ubuntu-latest
147+
name: Maven tests (JDK ${{ matrix.java }})
148+
env:
149+
NIX_DEVELOP: ${{ github.workspace }}#jdk${{ matrix.java }}
150+
strategy:
151+
fail-fast: false
152+
matrix:
153+
java: [11, 17, 21]
154+
steps:
155+
- uses: actions/checkout@v4
156+
157+
- uses: DeterminateSystems/nix-installer-action@v22
158+
with:
159+
summarize: false
160+
161+
- uses: DeterminateSystems/magic-nix-cache-action@v13
162+
163+
- run: |
164+
gradle --no-daemon :scip-java:installDist publishToMavenLocal
165+
SCIP_JAVA_VERSION="$(
166+
sed -n 's/^version:=//p' scip-java/build/install/scip-java/VERSION
167+
)"
168+
test -n "$SCIP_JAVA_VERSION"
169+
printf 'SCIP_JAVA_VERSION=%s\n' "$SCIP_JAVA_VERSION" >> "$GITHUB_ENV"
170+
printf 'SCIP_JAVA_CLI=%s\n' "$PWD/scip-java/build/install/scip-java/bin/scip-java" >> "$GITHUB_ENV"
171+
172+
- run: mvn clean verify -DskipTests "-Dscip-java.version=$SCIP_JAVA_VERSION" sourcegraph:sourcegraphDependencies
173+
working-directory: examples/maven-example
174+
175+
- run: |
176+
"$SCIP_JAVA_CLI" aggregate target/scip-targetroot
177+
working-directory: examples/maven-example
178+
179+
- run: |
180+
grep org.hamcrest target/scip-targetroot/*dependencies.txt
181+
grep "$PWD/src/main/java" target/scip-targetroot/*dependencies.txt
182+
working-directory: examples/maven-example
183+
184+
- run: du -h index.scip
185+
working-directory: examples/maven-example
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,6 @@ jobs:
3838
needs: publish
3939
permissions:
4040
contents: write
41-
uses: ./.github/workflows/release-cli.yml
41+
uses: ./.github/workflows/release-cli.yaml
4242
with:
4343
tag: ${{ github.ref_name }}

0 commit comments

Comments
 (0)