Skip to content

Commit edced17

Browse files
committed
chore(infra): Fix release workflow
1 parent 0b5a729 commit edced17

File tree

11 files changed

+179
-17
lines changed

11 files changed

+179
-17
lines changed

.gitconfig/hooks/commit-msg

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/usr/bin/env bash
2+
3+
if [ -z "$1" ]; then
4+
echo "Missing argument (commit message). Did you try to run this manually?"
5+
exit 1
6+
fi
7+
8+
commitTitle="$(cat $1 | head -n1)"
9+
10+
# ignore merge requests
11+
if echo "$commitTitle" | grep -qE "^Merge branch \'"; then
12+
echo "Commit hook: ignoring branch merge"
13+
exit 0
14+
fi
15+
16+
# check semantic versioning scheme
17+
if ! echo "$commitTitle" | grep -qE '^(style|feat|fix|docs|refactor|perf|test|chore)(\([a-zA-Z0-9\-_]+\))?:\s.+'; then
18+
echo "Your commit title did not follow semantic versioning: $commitTitle"
19+
echo "Please see https://www.conventionalcommits.org/en/v1.0.0/"
20+
exit 1
21+
fi

.github/workflows/cluster_test.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1-
name: Test
1+
name: Cluster Test
22

33
on:
4+
workflow_call:
45
pull_request:
56
push:
67
branches:
78
- main
89

910
jobs:
10-
cluster-tests:
11+
test:
1112
runs-on: ubuntu-latest
1213
steps:
1314
- uses: actions/checkout@v4

.github/workflows/go-releaser.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ jobs:
2929
go-version: '>=1.22'
3030
cache: true
3131

32-
- name: Goreleaser
33-
uses: goreleaser/goreleaser-action@v3
32+
- name: Run GoReleaser
33+
uses: goreleaser/goreleaser-action@v6
3434
with:
3535
distribution: goreleaser
3636
version: latest

.github/workflows/test.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1-
name: Test
1+
name: Unittests
22

33
on:
4+
workflow_call:
45
pull_request:
56
push:
67
branches:
78
- main
89

910
jobs:
10-
unittests:
11+
test:
1112
runs-on: ubuntu-latest
1213
steps:
1314
- uses: actions/checkout@v4

.github/workflows/xfstests.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1-
name: Test
1+
name: XFS Tests
22

33
on:
4+
workflow_call:
45
pull_request:
56
push:
67
branches:
78
- main
89

910
jobs:
10-
xfstests:
11+
test:
1112
runs-on: ubuntu-latest
1213
steps:
1314
- uses: actions/checkout@v4

.goreleaser.yaml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
version: 2
12
builds:
23
- env:
34
- CGO_ENABLED=0
@@ -16,21 +17,18 @@ builds:
1617
archives:
1718
- format_overrides:
1819
- goos: windows
19-
format: zip
20-
name_template: "geesefs_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
20+
formats: [ 'zip' ]
21+
name_template: "geesefs_tigris_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
2122

2223
checksum:
2324
name_template: 'checksums.txt'
2425
signs:
2526
- artifacts: checksum
26-
changelog:
27-
skip: true
2827

2928
nfpms:
3029
- formats:
3130
- apk
3231
- deb
3332
- rpm
34-
- termux.deb
35-
file_name_template: "tigris_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
33+
file_name_template: "geesefs_tigris_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
3634
maintainer: Yevgeniy Firsov <[email protected]>

Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ s3proxy.jar:
1818

1919
get-deps: s3proxy.jar
2020
go get -t ./...
21+
/bin/bash scripts/install_build_deps.sh
22+
/bin/bash scripts/install_test_deps.sh
2123

2224
build:
2325
go build -ldflags "github.com/tigrisdata/geesefs/core/cfg.Version=$(VERSION)"
@@ -28,6 +30,9 @@ build-debug:
2830
install:
2931
go install -ldflags "github.com/tigrisdata/geesefs/core/cfg.Version=$(VERSION)"
3032

33+
# Setup local development environment.
34+
setup: get-deps
35+
git config core.hooksPath ./.gitconfig/hooks
3136

3237
.PHONY: protoc
3338
protoc:

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
[![unittests](https://github.com/tigrisdata/geesefs/workflows/tests/badge.svg)]()
2-
[![xfstests](https://github.com/tigrisdata/geesefs/workflows/xfstests/badge.svg)]()
3-
[![cluster-test](https://github.com/tigrisdata/geesefs/workflows/cluster_test/badge.svg)]()
1+
[![unittests](https://github.com/tigrisdata/geesefs/actions/workflows/test.yaml/badge.svg)]()
2+
[![xfstests](https://github.com/tigrisdata/geesefs/actions/workflows/xfstests.yaml/badge.svg)]()
3+
[![cluster-test](https://github.com/tigrisdata/geesefs/actions/workflows/cluster_test.yaml/badge.svg)]()
44

55
<img src="doc/geesefs.png" height="64" width="64" align="middle" />
66

scripts/install_build_deps.sh

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
#!/usr/bin/env bash
2+
# Copyright 2022-2023 Tigris Data, Inc.
3+
4+
set -ex
5+
6+
# Settings
7+
PROTO_VERSION=25.6
8+
PROTO_RELEASES="https://github.com/protocolbuffers/protobuf/releases"
9+
10+
### Prereqs checks ###
11+
# Check if architecture and OS is supported
12+
# and set environment specifics
13+
ARCH=$(uname -m)
14+
OS=$(uname -s)
15+
16+
case "${OS}-${ARCH}" in
17+
"Darwin-arm64")
18+
BINARIES="brew curl go"
19+
;;
20+
"Darwin-x86_64")
21+
BINARIES="brew curl go"
22+
;;
23+
"Linux-aarch64")
24+
BINARIES="apt-get curl go"
25+
;;
26+
"Linux-arm64")
27+
BINARIES="apt-get curl go"
28+
;;
29+
"Linux-x86_64")
30+
BINARIES="apt-get curl go"
31+
;;
32+
*)
33+
echo "Unsupported architecture ${ARCH} or operating system ${OS}."
34+
exit 1
35+
;;
36+
esac
37+
38+
# Check if required binaries are available in PATH
39+
for bin in ${BINARIES}; do
40+
binpath=$(command -v "${bin}")
41+
if [ -z "${binpath}" ] || ! test -x "${binpath}"; then
42+
echo "Please ensure that $bin binary is installed and in PATH."
43+
exit 1
44+
fi
45+
done
46+
47+
# Install protobuf compiler
48+
case "${OS}" in
49+
"Darwin")
50+
brew install protobuf
51+
;;
52+
"Linux")
53+
case "${ARCH}" in
54+
"x86_64")
55+
PROTO_PKG=protoc-$PROTO_VERSION-linux-x86_64.zip
56+
;;
57+
"aarch64")
58+
PROTO_PKG=protoc-$PROTO_VERSION-linux-aarch_64.zip
59+
;;
60+
*)
61+
echo "No supported proto compiler for ${ARCH} or operating system ${OS}."
62+
exit 1
63+
;;
64+
esac
65+
;;
66+
*)
67+
echo "No supported proto compiler for ${ARCH} or operating system ${OS}."
68+
exit 1
69+
;;
70+
esac
71+
72+
if [ -n "$PROTO_PKG" ]; then
73+
DOWNLOAD_URL="$PROTO_RELEASES/download/v$PROTO_VERSION/$PROTO_PKG"
74+
echo "Fetching protobuf release ${DOWNLOAD_URL}"
75+
curl -LO "$DOWNLOAD_URL"
76+
sudo unzip "$PROTO_PKG" -d "/usr/local/"
77+
sudo chmod +x "/usr/local/bin/protoc"
78+
sudo chmod -R 755 "/usr/local/include/"
79+
rm -f "$PROTO_PKG"
80+
fi
81+
82+
# Install protobuf
83+
export GO111MODULE=on
84+
go install google.golang.org/protobuf/cmd/protoc-gen-go@v1
85+
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1

scripts/install_go.sh

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/usr/bin/env bash
2+
# Copyright 2022-2023 Tigris Data, Inc.
3+
4+
set -e
5+
6+
VERSION=1.23.6
7+
ARCH=$(dpkg --print-architecture)
8+
FN="go${VERSION}.linux-${ARCH}.tar.gz"
9+
10+
case "$ARCH" in
11+
"amd64")
12+
SHA256="9379441ea310de000f33a4dc767bd966e72ab2826270e038e78b2c53c2e7802d"
13+
;;
14+
"arm64")
15+
SHA256="561c780e8f4a8955d32bf72e46af0b5ee5e0debe1e4633df9a03781878219202"
16+
;;
17+
*)
18+
echo "No supported architecture."
19+
exit 1
20+
;;
21+
esac
22+
23+
wget "https://go.dev/dl/$FN"
24+
echo "$SHA256 $FN" | shasum -a 256 -c
25+
26+
mkdir -p /usr/local
27+
tar -C /usr/local -xzf "$FN"
28+
rm "$FN"
29+
30+
export PATH=$PATH:/usr/local/go/bin
31+

0 commit comments

Comments
 (0)