Skip to content

Commit 11c81e3

Browse files
chore(cd): cd steps for badger (#1830)
This PR adds CD steps for Badger releases. Artifacts (badger binary and checksum) will be uploaded automatically to Github. Final step will be to add artifacts to release. This reflects the process we already have in place for Dgraph. Badger build flags were taken from the [Dgraph release script](https://github.com/dgraph-io/dgraph/blob/main/contrib/release.sh). We add a Makefile to streamline the build process.
1 parent 14dc96a commit 11c81e3

File tree

3 files changed

+76
-1
lines changed

3 files changed

+76
-1
lines changed

.github/workflows/cd-badger.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: cd-badger
2+
on: workflow_dispatch
3+
jobs:
4+
badger-build:
5+
runs-on: ubuntu-latest
6+
steps:
7+
- uses: actions/checkout@v3
8+
- name: Get Go Version
9+
run: |
10+
#!/bin/bash
11+
GOVERSION=$({ [ -f .go-version ] && cat .go-version; })
12+
echo "GOVERSION=$GOVERSION" >> $GITHUB_ENV
13+
- name: Set up Go
14+
uses: actions/setup-go@v3
15+
with:
16+
go-version: ${{ env.GOVERSION }}
17+
- name: Set Badger Release Version
18+
run: |
19+
#!/bin/bash
20+
GIT_BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD)
21+
if [[ "$GIT_BRANCH_NAME" == "release/v"* ]];
22+
then
23+
echo "this is a release branch"
24+
else
25+
echo "this is NOT a release branch"
26+
exit 1
27+
fi
28+
BADGER_RELEASE_VERSION=$(git rev-parse --abbrev-ref HEAD | sed 's/release\///')
29+
echo "making a new release for "$BADGER_RELEASE_VERSION
30+
echo "BADGER_RELEASE_VERSION=$BADGER_RELEASE_VERSION" >> $GITHUB_ENV
31+
- name: Fetch dependencies
32+
run: sudo apt-get -y install build-essential
33+
- name: Build badger linux/amd64
34+
run: make badger
35+
- name: Generate SHA for Linux Build
36+
run: cd badger && sha256sum badger-linux-amd64 | cut -c-64 > badger-checksum-linux-amd64.sha256
37+
- name: Tar Archive for Linux Build
38+
run: cd badger && tar -zcvf badger-linux-amd64.tar.gz badger-linux-amd64
39+
- name: Upload Badger Binary Build Artifacts
40+
uses: actions/upload-artifact@v3
41+
with:
42+
path: |
43+
badger/badger-checksum-linux-amd64.sha256
44+
badger/badger-linux-amd64.tar.gz

Makefile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,12 @@ HAS_JEMALLOC = $(shell test -f /usr/local/lib/libjemalloc.a && echo "jemalloc")
1919
JEMALLOC_URL = "https://github.com/jemalloc/jemalloc/releases/download/5.2.1/jemalloc-5.2.1.tar.bz2"
2020

2121

22-
.PHONY: all test jemalloc dependency
22+
.PHONY: all badger test jemalloc dependency
23+
24+
badger: jemalloc
25+
@echo "Compiling Badger binary..."
26+
@$(MAKE) -C badger badger
27+
@echo "Badger binary located in badger directory."
2328

2429
test: jemalloc
2530
@echo "Running Badger tests..."

badger/Makefile

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#
2+
# Copyright 2022 Dgraph Labs, Inc. and Contributors
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
17+
GOOS ?= $(shell go env GOOS)
18+
GOARCH ?= $(shell go env GOARCH)
19+
20+
.PHONY: badger
21+
22+
all: badger
23+
24+
badger:
25+
# build badger binary
26+
@go build --tags=jemalloc -o badger-$(GOOS)-$(GOARCH) .

0 commit comments

Comments
 (0)