Skip to content

Commit a334c20

Browse files
authored
Merge pull request #3 from cortexproject/ghactions
Configuring GH actions
2 parents bf16f5f + 7fa8414 commit a334c20

File tree

25 files changed

+299
-1321
lines changed

25 files changed

+299
-1321
lines changed

.circleci/config.yml

Lines changed: 0 additions & 47 deletions
This file was deleted.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
3+
set -x
4+
VER="20.10.19"
5+
curl -L -o /tmp/docker-$VER.tgz https://download.docker.com/linux/static/stable/x86_64/docker-$VER.tgz
6+
tar -xz -C /tmp -f /tmp/docker-$VER.tgz
7+
mkdir -vp ~/.docker/cli-plugins/
8+
curl --silent -L "https://github.com/docker/buildx/releases/download/v0.3.0/buildx-v0.3.0.linux-amd64" > ~/.docker/cli-plugins/docker-buildx
9+
chmod a+x ~/.docker/cli-plugins/docker-buildx
10+
mv /tmp/docker/* /usr/bin
11+
docker run --privileged --rm tonistiigi/binfmt --install all
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: ci
2+
permissions: read-all
3+
on:
4+
push:
5+
branches: [master]
6+
tags:
7+
- v[0-9]+.[0-9]+.[0-9]+** # Tag filters not as strict due to different regex system on Github Actions
8+
pull_request:
9+
10+
jobs:
11+
lint:
12+
runs-on: ubuntu-20.04
13+
container:
14+
image: quay.io/cortexproject/build-image:master-0ddced051
15+
steps:
16+
- name: Checkout Repo
17+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
18+
- name: Setup Git safe.directory
19+
run: |
20+
echo "this step is needed because when running in container, actions/checkout does not set safe.directory effectively."
21+
echo "See https://github.com/actions/runner/issues/2033. We should use --system instead of --global"
22+
git config --system --add safe.directory $GITHUB_WORKSPACE
23+
# Commands in the Makefile are hardcoded with an assumed file structure of the CI container
24+
# Symlink ensures paths specified in previous commands don’t break
25+
- name: Sym Link Expected Path to Workspace
26+
run: |
27+
mkdir -p /go/src/github.com/cortexproject/weaveworks-common
28+
ln -s $GITHUB_WORKSPACE/* /go/src/github.com/cortexproject/weaveworks-common
29+
- name: Lint
30+
run: make lint
31+
32+
protos:
33+
runs-on: ubuntu-20.04
34+
steps:
35+
- name: Checkout Repo
36+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
37+
- name: Sym Link Expected Path to Workspace
38+
run: |
39+
sudo mkdir -p /go/src/github.com/cortexproject/weaveworks-common
40+
sudo ln -s $GITHUB_WORKSPACE/* /go/src/github.com/cortexproject/weaveworks-common
41+
- name: Install Docker Client
42+
run: sudo ./.github/workflows/scripts/install-docker.sh
43+
- name: Go mod Vendor
44+
run: go mod vendor
45+
- name: CheckProtos
46+
run: make check-protos
47+
48+
test:
49+
runs-on: ubuntu-20.04
50+
container:
51+
image: quay.io/cortexproject/build-image:master-0ddced051
52+
steps:
53+
- name: Checkout Repo
54+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
55+
- name: Setup Git safe.directory
56+
run: |
57+
echo "this step is needed because when running in container, actions/checkout does not set safe.directory effectively."
58+
echo "See https://github.com/actions/runner/issues/2033. We should use --system instead of --global"
59+
git config --system --add safe.directory $GITHUB_WORKSPACE
60+
# Commands in the Makefile are hardcoded with an assumed file structure of the CI container
61+
# Symlink ensures paths specified in previous commands don’t break
62+
- name: Sym Link Expected Path to Workspace
63+
run: |
64+
mkdir -p /go/src/github.com/cortexproject/weaveworks-common
65+
ln -s $GITHUB_WORKSPACE/* /go/src/github.com/cortexproject/weaveworks-common
66+
- name: Test
67+
run: make test

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ GO_FLAGS := -ldflags "-extldflags \"-static\" -linkmode=external -s -w" -tags ne
1414
PROTOC_IMAGE=namely/protoc:1.23_0
1515

1616
protos:
17-
docker run $(RM) --user $(id -u):$(id -g) -v $(shell pwd):/go/src/github.com/weaveworks/common -w /go/src/github.com/weaveworks/common $(PROTOC_IMAGE) --proto_path=/go/src/github.com/weaveworks/common --go_out=plugins=grpc:/go/src/ server/fake_server.proto
18-
docker run $(RM) --user $(id -u):$(id -g) -v $(shell pwd):/go/src/github.com/weaveworks/common -w /go/src/github.com/weaveworks/common $(PROTOC_IMAGE) --proto_path=/go/src/github.com/weaveworks/common --go_out=plugins=grpc:/go/src/ middleware/middleware_test/echo_server.proto
19-
docker run $(RM) --user $(id -u):$(id -g) -v $(shell pwd):/go/src/github.com/weaveworks/common -w /go/src/github.com/weaveworks/common $(PROTOC_IMAGE) -I/go/src/github.com/weaveworks/common -I/go/src/github.com/weaveworks/common/vendor/github.com/gogo/protobuf/ --proto_path=/go/src/github.com/weaveworks/common --gogofast_out=plugins=grpc:/go/src/ httpgrpc/httpgrpc.proto
17+
docker run $(RM) --user $(id -u):$(id -g) -v $(shell pwd):/go/src/github.com/cortexproject/weaveworks-common -w /go/src/github.com/cortexproject/weaveworks-common $(PROTOC_IMAGE) --proto_path=/go/src/github.com/cortexproject/weaveworks-common --go_out=plugins=grpc:/go/src/ server/fake_server.proto
18+
docker run $(RM) --user $(id -u):$(id -g) -v $(shell pwd):/go/src/github.com/cortexproject/weaveworks-common -w /go/src/github.com/cortexproject/weaveworks-common $(PROTOC_IMAGE) --proto_path=/go/src/github.com/cortexproject/weaveworks-common --go_out=plugins=grpc:/go/src/ middleware/middleware_test/echo_server.proto
19+
docker run $(RM) --user $(id -u):$(id -g) -v $(shell pwd):/go/src/github.com/cortexproject/weaveworks-common -w /go/src/github.com/cortexproject/weaveworks-common $(PROTOC_IMAGE) -I/go/src/github.com/cortexproject/weaveworks-common -I/go/src/github.com/cortexproject/weaveworks-common/vendor/github.com/gogo/protobuf/ --proto_path=/go/src/github.com/cortexproject/weaveworks-common --gogofast_out=plugins=grpc:/go/src/ httpgrpc/httpgrpc.proto
2020

2121
protos: $(GENERATED_PROTOS)
2222

fs/fs.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,13 @@ package fs
22

33
import (
44
"io"
5-
"io/ioutil"
65
"os"
76
"syscall"
87
)
98

109
// Interface is the filesystem interface type.
1110
type Interface interface {
12-
ReadDir(string) ([]os.FileInfo, error)
11+
ReadDir(string) ([]os.DirEntry, error)
1312
ReadDirNames(string) ([]string, error)
1413
ReadDirCount(string) (int, error)
1514
ReadFile(string) ([]byte, error)
@@ -23,8 +22,8 @@ type realFS struct{}
2322
// FS is the way you should access the filesystem.
2423
var fs Interface = realFS{}
2524

26-
func (realFS) ReadDir(path string) ([]os.FileInfo, error) {
27-
return ioutil.ReadDir(path)
25+
func (realFS) ReadDir(path string) ([]os.DirEntry, error) {
26+
return os.ReadDir(path)
2827
}
2928

3029
func (realFS) ReadDirNames(path string) ([]string, error) {
@@ -37,7 +36,7 @@ func (realFS) ReadDirNames(path string) ([]string, error) {
3736
}
3837

3938
func (realFS) ReadFile(path string) ([]byte, error) {
40-
return ioutil.ReadFile(path)
39+
return os.ReadFile(path)
4140
}
4241

4342
func (realFS) Lstat(path string, stat *syscall.Stat_t) error {
@@ -55,7 +54,7 @@ func (realFS) Open(path string) (io.ReadWriteCloser, error) {
5554
// trampolines here to allow users to do fs.ReadDir etc
5655

5756
// ReadDir see ioutil.ReadDir
58-
func ReadDir(path string) ([]os.FileInfo, error) {
57+
func ReadDir(path string) ([]os.DirEntry, error) {
5958
return fs.ReadDir(path)
6059
}
6160

go.mod

Lines changed: 42 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,67 @@
11
module github.com/weaveworks/common
22

3-
go 1.14
3+
go 1.22
4+
5+
toolchain go1.23.2
46

57
require (
68
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5
7-
github.com/aws/aws-sdk-go v1.27.0
8-
github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd // indirect
9+
github.com/aws/aws-sdk-go v1.55.5
910
github.com/davecgh/go-spew v1.1.1
1011
github.com/felixge/httpsnoop v1.0.3
1112
github.com/go-kit/log v0.2.1
1213
github.com/gogo/googleapis v1.1.0
13-
github.com/gogo/protobuf v1.3.0
14+
github.com/gogo/protobuf v1.3.2
1415
github.com/gogo/status v1.0.3
15-
github.com/golang/protobuf v1.5.2
16+
github.com/golang/protobuf v1.5.4
1617
github.com/gorilla/mux v1.7.3
17-
github.com/mattn/go-colorable v0.0.9 // indirect
18-
github.com/mattn/go-isatty v0.0.4 // indirect
1918
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b
2019
github.com/opentracing-contrib/go-grpc v0.0.0-20180928155321-4b5a12d3ff02
2120
github.com/opentracing-contrib/go-stdlib v0.0.0-20190519235532-cf7a6c988dc9
2221
github.com/opentracing/opentracing-go v1.1.0
2322
github.com/pkg/errors v0.9.1
2423
github.com/pmezard/go-difflib v1.0.0
25-
github.com/prometheus/client_golang v1.14.0
24+
github.com/prometheus/client_golang v1.15.1
2625
github.com/prometheus/exporter-toolkit v0.8.2
27-
github.com/sercand/kuberesolver/v4 v4.0.0
2826
github.com/sirupsen/logrus v1.6.0
29-
github.com/soheilhy/cmux v0.1.5 // indirect
27+
github.com/soheilhy/cmux v0.1.5
3028
github.com/stretchr/testify v1.8.1
3129
github.com/uber/jaeger-client-go v2.28.0+incompatible
3230
github.com/uber/jaeger-lib v2.2.0+incompatible
3331
github.com/weaveworks/promrus v1.2.0
34-
go.uber.org/atomic v1.5.1 // indirect
35-
golang.org/x/net v0.5.0
36-
golang.org/x/tools v0.3.0
37-
google.golang.org/grpc v1.53.0
32+
golang.org/x/net v0.31.0
33+
golang.org/x/tools v0.22.0
34+
google.golang.org/grpc v1.65.0
3835
gopkg.in/yaml.v2 v2.4.0
3936
)
37+
38+
require (
39+
github.com/beorn7/perks v1.0.1 // indirect
40+
github.com/cespare/xxhash/v2 v2.3.0 // indirect
41+
github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd // indirect
42+
github.com/coreos/go-systemd/v22 v22.4.0 // indirect
43+
github.com/fsnotify/fsnotify v1.6.0 // indirect
44+
github.com/go-logfmt/logfmt v0.5.1 // indirect
45+
github.com/jpillora/backoff v1.0.0 // indirect
46+
github.com/konsorten/go-windows-terminal-sequences v1.0.3 // indirect
47+
github.com/kr/text v0.1.0 // indirect
48+
github.com/mattn/go-colorable v0.0.9 // indirect
49+
github.com/mattn/go-isatty v0.0.4 // indirect
50+
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
51+
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f // indirect
52+
github.com/prometheus/client_model v0.3.0 // indirect
53+
github.com/prometheus/common v0.42.0 // indirect
54+
github.com/prometheus/procfs v0.9.0 // indirect
55+
github.com/rogpeppe/go-internal v1.13.1 // indirect
56+
github.com/sercand/kuberesolver/v5 v5.1.1 // indirect
57+
go.uber.org/atomic v1.5.1 // indirect
58+
golang.org/x/crypto v0.29.0 // indirect
59+
golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 // indirect
60+
golang.org/x/oauth2 v0.20.0 // indirect
61+
golang.org/x/sync v0.9.0 // indirect
62+
golang.org/x/sys v0.27.0 // indirect
63+
golang.org/x/text v0.20.0 // indirect
64+
google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect
65+
google.golang.org/protobuf v1.34.1 // indirect
66+
gopkg.in/yaml.v3 v3.0.1 // indirect
67+
)

0 commit comments

Comments
 (0)