Skip to content

docs: Add CHANGELOG entry for v0.2.6 (#414) #53

docs: Add CHANGELOG entry for v0.2.6 (#414)

docs: Add CHANGELOG entry for v0.2.6 (#414) #53

Workflow file for this run

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-22.04'
container: 'gcc:9.5.0-buster'
config: 'dev'
- platform: 'ubuntu-22.04'
container: 'gcc:9.5.0-buster'
config: 'release'
# NOTE: GitHub-hosted runners for macOS are x86_64 only
# https://github.com/github/roadmap/issues/528
- platform: 'macos-12'
container: ''
config: 'release'
# Seeing an inexplicable
# ld: file not found: external/llvm_toolchain_llvm/lib/clang/15.0.7/lib/darwin/libclang_rt.asan_osx_dynamic.dylib
# when running the dev build in in GitHub Actions
runs-on: ${{ matrix.platform }}
container: ${{ matrix.container }}
env:
TAG: ${{ github.event.ref }}
permissions:
contents: 'read'
id-token: 'write'
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v3
- 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; then
if [ "$RUNNER_OS" == "Windows" ]; then
choco install bazelisk
elif [ "$RUNNER_OS" == "Linux" ]; then
curl -L https://github.com/bazelbuild/bazelisk/releases/download/v1.16.0/bazelisk-linux-amd64 > /usr/local/bin/bazel
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@v1'
with:
workload_identity_provider: ${{ secrets.GCP_IDENTITY_PROVIDER }}
service_account: ${{ secrets.GCP_SERVICE_ACCOUNT }}
create_credentials_file: true
- name: '🚧 Build scip-clang'
run: |
# Stop Windows from converting the // to /
# https://github.com/bazelbuild/bazel/commit/866ecc8c3d5e0b899e3f0c9c6b2265f16daae842
# https://stackoverflow.com/a/34386471
export MSYS2_ARG_CONV_EXCL="*"
if [ "$RUNNER_OS" == "macOS" ]; then
export BAZEL_MEM="13G"
else # if [ "$RUNNER_OS" == "Linux" ]; then
export BAZEL_MEM="6G"
fi
{
echo "startup --host_jvm_args=-Xmx$BAZEL_MEM"
echo "build --remote_cache=$CI_BAZEL_REMOTE_CACHE --google_default_credentials"
} > ci.bazelrc
# Comment out the 'upload log' bit below for debugging
SUFFIX=""
if [ "$CONFIG" == "release" ]; then
if [ "$(uname -s)" == "Linux" ]; then
SUFFIX="-linux"
fi
fi
bazel build //indexer:scip-clang --config="$CONFIG$SUFFIX" # --execution_log_binary_file=log
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 }}
CI_BAZEL_REMOTE_CACHE: 'https://storage.googleapis.com/sourcegraph_bazel_cache'
- name: 'πŸ”Ž Identify OS'
run: echo "OS=$(uname -s | tr '[:upper:]' '[:lower:]')" >> "$GITHUB_ENV"
# - name: 'πŸͺ΅ Upload log'
# uses: actions/upload-artifact@v3
# with:
# name: ${{ env.OS }}-${{ matrix.config }}-build-log
# path: log
- 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@v3
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-20.04'
steps:
- uses: actions/checkout@v3
- 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 }}
# Download everything to avoid spelling out the different
# platforms here.
- name: 'πŸ“₯ Download all artifacts'
uses: actions/download-artifact@v3
- name: 'πŸ“€ Upload artifacts for release'
run: gh release upload "${GITHUB_REF/refs\/tags\//}" ./*-release-artifacts/*
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}