Release #72
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release | |
| on: | |
| push: | |
| tags: | |
| - "v*" | |
| workflow_dispatch: | |
| inputs: | |
| revision: | |
| description: "Tag or revision to build binaries for" | |
| type: string | |
| required: true | |
| create_release: | |
| description: "Should publish the binary or not" | |
| required: true | |
| default: "false" | |
| jobs: | |
| build-and-upload-artifacts: | |
| name: "Build and upload artifacts" | |
| strategy: | |
| matrix: | |
| include: | |
| - platform: "ubuntu-24.04" | |
| config: "dev" | |
| - platform: "ubuntu-24.04" | |
| config: "release" | |
| - platform: "macos-14" | |
| config: "release" | |
| runs-on: ${{ matrix.platform }} | |
| env: | |
| TAG: ${{ github.event.ref }} | |
| permissions: | |
| contents: "read" | |
| id-token: "write" | |
| defaults: | |
| run: | |
| shell: bash | |
| steps: | |
| - name: "π§Ή Free up disk space" | |
| if: runner.os == 'Linux' | |
| run: | | |
| # Free up disk space on GitHub-hosted runners | |
| # The LLVM 21 toolchain requires ~5GB when extracted | |
| echo "Before cleanup:" | |
| df -h / | |
| sudo rm -rf /usr/share/dotnet | |
| sudo rm -rf /usr/local/lib/android | |
| sudo rm -rf /opt/ghc | |
| sudo rm -rf /opt/hostedtoolcache/CodeQL | |
| sudo docker image prune --all --force || true | |
| echo "After cleanup:" | |
| df -h / | |
| - uses: actions/checkout@v4 | |
| - name: "π Check version" | |
| run: | | |
| set -euo pipefail | |
| if [[ "${TAG:-}" == v* ]]; then | |
| TAG_LIKE="$TAG" | |
| else | |
| TAG_LIKE="$(grep '## v' CHANGELOG.md | head -n 1 | cut -d ' ' -f 2)" | |
| fi | |
| NEW_VERSION="${TAG_LIKE/v/}" ./tools/version_check.sh | |
| - name: "π Install Bazelisk" | |
| run: | | |
| if ! command -v bazelisk && ! command -v bazel; then | |
| if [ "$RUNNER_OS" == "Windows" ]; then | |
| choco install bazelisk | |
| elif [ "$RUNNER_OS" == "Linux" ]; then | |
| sudo curl -L https://github.com/bazelbuild/bazelisk/releases/download/v1.16.0/bazelisk-linux-amd64 -o /usr/local/bin/bazel | |
| sudo chmod +x /usr/local/bin/bazel | |
| else | |
| sudo npm install -g @bazel/bazelisk | |
| fi | |
| fi | |
| - id: auth | |
| name: "π Authenticate to Google Cloud" | |
| uses: "google-github-actions/auth@v2" | |
| with: | |
| workload_identity_provider: ${{ secrets.GCP_IDENTITY_PROVIDER }} | |
| service_account: ${{ secrets.GCP_SERVICE_ACCOUNT }} | |
| create_credentials_file: true | |
| - name: "π§ Build scip-clang" | |
| run: | | |
| export MSYS2_ARG_CONV_EXCL="*" | |
| if [ "$RUNNER_OS" == "macOS" ]; then | |
| export BAZEL_MEM="13G" | |
| else | |
| export BAZEL_MEM="6G" | |
| fi | |
| { | |
| echo "startup --host_jvm_args=-Xmx$BAZEL_MEM" | |
| } > ci.bazelrc | |
| SUFFIX="" | |
| if [ "$CONFIG" == "release" ]; then | |
| if [ "$(uname -s)" == "Linux" ]; then | |
| SUFFIX="-linux" | |
| fi | |
| fi | |
| bazel --bazelrc=.bazelrc --bazelrc=.aspect/bazelrc/ci.bazelrc build //indexer:scip-clang --config="$CONFIG$SUFFIX" | |
| if [ "$RUNNER_OS" == "Linux" ]; then | |
| echo "--- GLIBC VERSIONS ---" | |
| objdump -T bazel-bin/indexer/scip-clang | grep GLIBC | sed 's/.*GLIBC_\([.0-9]*\).*/\1/g' | sort -Vu | |
| echo "----------------------" | |
| fi | |
| env: | |
| CONFIG: ${{ matrix.config }} | |
| - name: "π Identify OS" | |
| run: echo "OS=$(uname -s | tr '[:upper:]' '[:lower:]')" >> "$GITHUB_ENV" | |
| - name: ${{ format('πͺ Rename binary ({0})', matrix.config) }} | |
| run: | | |
| SUFFIX="-dev" | |
| if [ "$CONFIG" == "release" ]; then | |
| SUFFIX="" | |
| fi | |
| outBinaryPath="scip-clang${SUFFIX}-$(uname -m)-$OS" | |
| cp bazel-bin/indexer/scip-clang "$outBinaryPath" | |
| echo "outBinaryPath=$outBinaryPath" >> "$GITHUB_ENV" | |
| echo "suffix=$SUFFIX" >> "$GITHUB_ENV" | |
| env: | |
| OS: ${{ env.OS }} | |
| CONFIG: ${{ matrix.config }} | |
| - name: ${{ format('π¦ Store binary ({0})', matrix.config) }} | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.platform }}-${{ matrix.config }}-release-artifacts | |
| path: ${{ env.outBinaryPath }} | |
| create-release: | |
| name: "Create release" | |
| if: github.event_name != 'workflow_dispatch' || inputs.create_release | |
| needs: build-and-upload-artifacts | |
| runs-on: "ubuntu-24.04" | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: "π Create Release" | |
| run: | | |
| REV="$INPUT_REVISION" | |
| if [ "$TRIGGER" != "workflow_dispatch" ]; then | |
| REV="${GITHUB_REF/refs\/tags\//}" | |
| fi | |
| TEMPLATE="$(< .github/workflows/release-template.md)" | |
| echo "${TEMPLATE//TAG_PLACEHOLDER/$REV}" > notes | |
| gh release create "$REV" --title "scip-clang $REV" --notes-file notes | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| TRIGGER: ${{ github.event_name }} | |
| INPUT_REVISION: ${{ inputs.revision }} | |
| - name: "π₯ Download all artifacts" | |
| uses: actions/download-artifact@v4 | |
| - name: "π€ Upload artifacts for release" | |
| run: gh release upload "${GITHUB_REF/refs\/tags\//}" ./*-release-artifacts/* | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |