-
Notifications
You must be signed in to change notification settings - Fork 16
147 lines (145 loc) Β· 5.12 KB
/
Copy pathrelease.yml
File metadata and controls
147 lines (145 loc) Β· 5.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
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-32core-graph-team-amd64"
config: "dev"
- platform: "ubuntu-24.04-32core-graph-team-amd64"
config: "release"
# macOS 14 => arm64
- 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:
- 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" == "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: |
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"
} > 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 }}
- 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@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 }}
# Download everything to avoid spelling out the different
# platforms here.
- 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 }}