Skip to content

Commit ed7192b

Browse files
authored
Merge pull request #15 from banzaicloud/move-to-gha
ci: move workflows to github actions
2 parents ba19a6d + 0b64bfd commit ed7192b

6 files changed

Lines changed: 156 additions & 63 deletions

File tree

.circleci/config.yml

Lines changed: 0 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -3,72 +3,11 @@ version: 2.1
33
orbs:
44
docker: banzaicloud/docker@0.0.7
55

6-
jobs:
7-
build:
8-
docker:
9-
- image: cimg/go:1.18
10-
environment:
11-
GOFLAGS: -mod=readonly
12-
steps:
13-
- checkout
14-
15-
- restore_cache:
16-
name: Restore build dependencies
17-
keys:
18-
- build-deps-v1-{{ .Branch }}-{{ checksum "Makefile" }}
19-
20-
- restore_cache:
21-
name: Restore Go module cache
22-
keys:
23-
- gomod-v1-{{ .Branch }}-{{ checksum "go.sum" }}
24-
- gomod-v1-{{ .Branch }}
25-
- gomod-v1-master
26-
- gomod-v1
27-
28-
- run:
29-
name: Download Go module cache
30-
command: go mod download
31-
32-
- save_cache:
33-
name: Save Go module cache
34-
key: gomod-v1-{{ .Branch }}-{{ checksum "go.sum" }}
35-
paths:
36-
- /home/circleci/go/pkg/mod
37-
38-
- restore_cache:
39-
name: Restore license cache
40-
keys:
41-
- licensei-v1-{{ .Branch }}-{{ checksum "go.sum" }}
42-
43-
- run:
44-
name: Download license information for dependencies
45-
command: make license-cache
46-
47-
- save_cache:
48-
name: Save license cache
49-
key: licensei-v1-{{ .Branch }}-{{ checksum "go.sum" }}
50-
paths:
51-
- .licensei.cache
52-
53-
- run:
54-
name: Run checks
55-
command: make check
56-
57-
- save_cache:
58-
name: Save build dependencies
59-
key: build-deps-v1-{{ .Branch }}-{{ checksum "Makefile" }}
60-
paths:
61-
- bin/
62-
63-
- store_test_results:
64-
path: build/test_results/
656

667
workflows:
678
version: 2
689
ci:
6910
jobs:
70-
- build
71-
7211
- docker/build:
7312
name: Docker build
7413
executor: docker/machine-dlc

.github/dependabot.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
version: 2
2+
3+
updates:
4+
- package-ecosystem: "docker"
5+
directory: "/"
6+
labels:
7+
- "dependencies"
8+
schedule:
9+
interval: "daily"
10+
11+
- package-ecosystem: "gomod"
12+
directory: "/"
13+
labels:
14+
- "dependencies"
15+
schedule:
16+
interval: "daily"
17+
18+
- package-ecosystem: "github-actions"
19+
directory: "/"
20+
labels:
21+
- "dependencies"
22+
schedule:
23+
interval: "daily"

.github/workflows/ci.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- master
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Set up Go
15+
uses: actions/setup-go@v2
16+
with:
17+
go-version: 1.18
18+
19+
- name: Checkout code
20+
uses: actions/checkout@v2
21+
22+
- name: Download license information for dependencies
23+
env:
24+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
25+
run: make license-cache
26+
27+
- name: Check licenses
28+
env:
29+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
30+
run: make license-check
31+
32+
- name: Run checks
33+
run: |
34+
make check

.github/workflows/docker.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Docker
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
tags:
8+
- "[0-9]+.[0-9]+.[0-9]+"
9+
- "[0-9]+.[0-9]+.[0-9]+-dev.[0-9]+"
10+
- "[0-9]+.[0-9]+.[0-9]+-rc.[0-9]+"
11+
- "[0-9]+.[0-9]+.[0-9]+-alpha.[0-9]+"
12+
- "[0-9]+.[0-9]+.[0-9]+-beta.[0-9]+"
13+
14+
env:
15+
PLATFORMS: linux/amd64,linux/arm64,linux/arm/v7
16+
17+
jobs:
18+
docker:
19+
name: Docker
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Checkout code
23+
uses: actions/checkout@v2
24+
25+
- name: Set up QEMU
26+
uses: docker/setup-qemu-action@v1
27+
- name: Set up Docker Buildx
28+
uses: docker/setup-buildx-action@v1
29+
- name: Cache Docker layers
30+
uses: actions/cache@v2
31+
with:
32+
path: /tmp/.buildx-cache
33+
key: ${{ runner.os }}-buildx-${{ github.ref }}
34+
restore-keys: |
35+
${{ runner.os }}-buildx-
36+
37+
- name: Login to GitHub Container Registry
38+
uses: docker/login-action@v1
39+
with:
40+
registry: ghcr.io
41+
username: ${{ github.repository_owner }}
42+
password: ${{ secrets.CR_PAT }}
43+
44+
- name: Login to DockerHub
45+
uses: docker/login-action@v2
46+
with:
47+
username: ${{ secrets.DOCKERHUB_USERNAME }}
48+
password: ${{ secrets.DOCKERHUB_PASSWORD }}
49+
50+
- name: Determine tag or commit
51+
uses: haya14busa/action-cond@v1
52+
id: refortag
53+
with:
54+
cond: ${{ startsWith(github.ref, 'refs/tags/') }}
55+
if_true: ${{ github.ref }}
56+
if_false: latest
57+
58+
- name: Determine image tag
59+
id: imagetag
60+
run: echo "::set-output name=value::${TAG_OR_BRANCH##*/}"
61+
env:
62+
TAG_OR_BRANCH: ${{ steps.refortag.outputs.value }}
63+
64+
- name: Build allspark
65+
uses: docker/build-push-action@v3
66+
with:
67+
file: Dockerfile
68+
platforms: linux/amd64
69+
push: true
70+
cache-from: type=local,src=/tmp/.buildx-cache
71+
cache-to: type=local,dest=/tmp/.buildx-cache
72+
tags: |
73+
ghcr.io/banzaicloud/allspark:${{ steps.imagetag.outputs.value }}
74+
banzaicloud/allspark:${{ steps.imagetag.outputs.value }}

.licensei.toml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,27 @@ approved = [
77
]
88

99
ignored = [
10+
"google.golang.org/protobuf",
1011
]
12+
13+
[header]
14+
ignoreFiles = [
15+
"allspark.pb.go",
16+
"producer.go",
17+
"kafkaProduce.go",
18+
"kafkaConsume.go",
19+
"consumer.go",
20+
]
21+
template = """// Copyright © :YEAR: Banzai Cloud
22+
//
23+
// Licensed under the Apache License, Version 2.0 (the "License");
24+
// you may not use this file except in compliance with the License.
25+
// You may obtain a copy of the License at
26+
//
27+
// http://www.apache.org/licenses/LICENSE-2.0
28+
//
29+
// Unless required by applicable law or agreed to in writing, software
30+
// distributed under the License is distributed on an "AS IS" BASIS,
31+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
32+
// See the License for the specific language governing permissions and
33+
// limitations under the License."""

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ DOCKER_TAG ?= ${VERSION}
2828
# Dependency versions
2929
GOLANGCI_VERSION = 1.45.0
3030
GOLANG_VERSION = 1.18
31-
LICENSEI_VERSION = 0.3.1
31+
LICENSEI_VERSION = 0.6.1
3232

3333
# Add the ability to override some variables
3434
# Use with care
@@ -122,7 +122,7 @@ bin/licensei-${LICENSEI_VERSION}:
122122
.PHONY: license-check
123123
license-check: bin/licensei ## Run license check
124124
bin/licensei check
125-
./scripts/check-header.sh
125+
bin/licensei header
126126

127127
.PHONY: license-cache
128128
license-cache: bin/licensei ## Generate license cache

0 commit comments

Comments
 (0)