Skip to content

Add standardized Sourcegraph CI workflows (build checks + code intel) #1

Add standardized Sourcegraph CI workflows (build checks + code intel)

Add standardized Sourcegraph CI workflows (build checks + code intel) #1

Workflow file for this run

name: SG CI - Java
on:
push:
pull_request:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '17'
- name: Build
run: |
if [ -f pom.xml ]; then mvn -B -e -DskipTests compile;
elif [ -f build.gradle ] || [ -f build.gradle.kts ]; then chmod +x ./gradlew 2>/dev/null || true; ./gradlew compileJava -x test || gradle compileJava -x test;
else find . -name '*.java' > /tmp/srcs.txt; mkdir -p /tmp/out; javac -d /tmp/out @/tmp/srcs.txt; fi
code-intel:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '17'
- name: Install scip-java and src-cli
run: |
curl -sfLo /usr/local/bin/cs https://github.com/coursier/launchers/raw/master/cs-x86_64-pc-linux
chmod +x /usr/local/bin/cs
cs install --quiet scip-java || true
curl -sfL https://demo.sourcegraph.com/.api/src-cli/src_linux_amd64 -o /usr/local/bin/src
chmod +x /usr/local/bin/src
- name: Index and upload
env:
SRC_ENDPOINT: https://demo.sourcegraph.com
SRC_ACCESS_TOKEN: ${{secrets.SRC_ACCESS_TOKEN}}
run: |
export PATH="$HOME/.local/share/coursier/bin:$PATH"
if [ -f pom.xml ] || [ -f build.gradle ] || [ -f build.gradle.kts ]; then scip-java index || true; fi
if [ -f index.scip ]; then src code-intel upload -no-progress; else echo "no index (needs a build tool)"; fi