|
| 1 | +name: scip-clang |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + |
| 8 | +jobs: |
| 9 | + index: |
| 10 | + runs-on: ubuntu-24.04 |
| 11 | + steps: |
| 12 | + - uses: actions/checkout@v4 |
| 13 | + |
| 14 | + - name: "Install build dependencies" |
| 15 | + run: | |
| 16 | + set -euxo pipefail |
| 17 | + sudo apt-get update |
| 18 | + sudo apt-get install --yes git make cmake gcc g++ ninja-build |
| 19 | +
|
| 20 | + - name: "Cache Perforce API" |
| 21 | + id: cache-p4api |
| 22 | + uses: actions/cache@v4 |
| 23 | + with: |
| 24 | + path: /tmp/p4-download |
| 25 | + key: ${{ runner.os }}-p4api-r23.1 |
| 26 | + |
| 27 | + - name: "Download Perforce API" |
| 28 | + if: ${{ steps.cache-p4api.outputs.cache-hit != 'true' }} |
| 29 | + run: | |
| 30 | + set -euxo pipefail |
| 31 | + mkdir -p /tmp/p4-download |
| 32 | + curl -L "https://filehost.perforce.com/perforce/r23.1/bin.linux26x86_64/p4api-glibc2.3-openssl1.1.1.tgz" --output /tmp/p4-download/p4.tgz |
| 33 | +
|
| 34 | + - name: "Unpack Perforce API" |
| 35 | + run: | |
| 36 | + set -euxo pipefail |
| 37 | + mkdir -p vendor/helix-core-api/linux |
| 38 | + tar -C vendor/helix-core-api/linux -xzf /tmp/p4-download/p4.tgz --strip 1 |
| 39 | +
|
| 40 | + - name: "Cache OpenSSL source" |
| 41 | + id: cache-openssl |
| 42 | + uses: actions/cache@v4 |
| 43 | + with: |
| 44 | + path: /tmp/openssl-download |
| 45 | + key: ${{ runner.os }}-openssl-1.1.1w |
| 46 | + |
| 47 | + - name: "Download OpenSSL" |
| 48 | + if: ${{ steps.cache-openssl.outputs.cache-hit != 'true' }} |
| 49 | + run: | |
| 50 | + set -euxo pipefail |
| 51 | + mkdir -p /tmp/openssl-download |
| 52 | + curl -L "https://www.openssl.org/source/openssl-1.1.1w.tar.gz" --output /tmp/openssl-download/openssl.tgz |
| 53 | +
|
| 54 | + - name: "Compile OpenSSL" |
| 55 | + run: | |
| 56 | + set -euxo pipefail |
| 57 | + mkdir -p /tmp/openssl-src |
| 58 | + tar -C /tmp/openssl-src -xzf /tmp/openssl-download/openssl.tgz --strip-components 1 |
| 59 | + cd /tmp/openssl-src |
| 60 | + ./config --prefix=/tmp/openssl-install --openssldir=/tmp/openssl-install |
| 61 | + make --jobs="$(($(nproc) + 1))" |
| 62 | + sudo make install |
| 63 | +
|
| 64 | + - name: "Install scip-clang and src CLI" |
| 65 | + run: | |
| 66 | + set -euxo pipefail |
| 67 | + OS="$(uname -s | tr '[:upper:]' '[:lower:]')" |
| 68 | + SCIP_CLANG_TAG="$(curl -sSL https://api.github.com/repos/sourcegraph/scip-clang/releases/latest | grep '"tag_name"' | head -1 | sed -E 's/.*"([^"]+)".*/\1/')" |
| 69 | + curl -L "https://github.com/sourcegraph/scip-clang/releases/download/${SCIP_CLANG_TAG}/scip-clang-x86_64-${OS}" -o scip-clang |
| 70 | + chmod +x scip-clang |
| 71 | + curl -L "https://sourcegraph.sourcegraph.com/.api/src-cli/src_linux_amd64" -o src |
| 72 | + chmod +x src |
| 73 | + echo "$(pwd)" >> "$GITHUB_PATH" |
| 74 | +
|
| 75 | + - name: "Build p4-fusion and generate compilation database" |
| 76 | + env: |
| 77 | + OPENSSL_ROOT_DIR: /tmp/openssl-install |
| 78 | + CMAKE_EXPORT_COMPILE_COMMANDS: "ON" |
| 79 | + run: | |
| 80 | + set -euxo pipefail |
| 81 | + ./generate_cache.sh Release |
| 82 | + ./build.sh |
| 83 | +
|
| 84 | + - name: "Index with scip-clang" |
| 85 | + run: | |
| 86 | + set -euxo pipefail |
| 87 | + scip-clang --compdb-path=build/compile_commands.json |
| 88 | +
|
| 89 | + - name: "Upload SCIP index to Sourcegraph S2" |
| 90 | + env: |
| 91 | + SRC_ENDPOINT: https://sourcegraph.sourcegraph.com/ |
| 92 | + SRC_ACCESS_TOKEN: ${{ secrets.SRC_ACCESS_TOKEN_S2 }} |
| 93 | + run: | |
| 94 | + set -euxo pipefail |
| 95 | + src code-intel upload -github-token="${{ secrets.GITHUB_TOKEN }}" -no-progress |
0 commit comments