Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: move workflows to github actions #15

Merged
merged 2 commits into from
Sep 16, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
ci: move workflows to github actions
  • Loading branch information
asdwsda committed Sep 16, 2022
commit c4b144da8b6198e339b35bcded312a6470fc0fbd
61 changes: 0 additions & 61 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,72 +3,11 @@ version: 2.1
orbs:
docker: banzaicloud/docker@0.0.7

jobs:
build:
docker:
- image: cimg/go:1.18
environment:
GOFLAGS: -mod=readonly
steps:
- checkout

- restore_cache:
name: Restore build dependencies
keys:
- build-deps-v1-{{ .Branch }}-{{ checksum "Makefile" }}

- restore_cache:
name: Restore Go module cache
keys:
- gomod-v1-{{ .Branch }}-{{ checksum "go.sum" }}
- gomod-v1-{{ .Branch }}
- gomod-v1-master
- gomod-v1

- run:
name: Download Go module cache
command: go mod download

- save_cache:
name: Save Go module cache
key: gomod-v1-{{ .Branch }}-{{ checksum "go.sum" }}
paths:
- /home/circleci/go/pkg/mod

- restore_cache:
name: Restore license cache
keys:
- licensei-v1-{{ .Branch }}-{{ checksum "go.sum" }}

- run:
name: Download license information for dependencies
command: make license-cache

- save_cache:
name: Save license cache
key: licensei-v1-{{ .Branch }}-{{ checksum "go.sum" }}
paths:
- .licensei.cache

- run:
name: Run checks
command: make check

- save_cache:
name: Save build dependencies
key: build-deps-v1-{{ .Branch }}-{{ checksum "Makefile" }}
paths:
- bin/

- store_test_results:
path: build/test_results/

workflows:
version: 2
ci:
jobs:
- build

- docker/build:
name: Docker build
executor: docker/machine-dlc
Expand Down
23 changes: 23 additions & 0 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
version: 2

updates:
- package-ecosystem: "docker"
directory: "/"
labels:
- "dependencies"
schedule:
interval: "daily"

- package-ecosystem: "gomod"
directory: "/"
labels:
- "dependencies"
schedule:
interval: "daily"

- package-ecosystem: "github-actions"
directory: "/"
labels:
- "dependencies"
schedule:
interval: "daily"
34 changes: 34 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: CI

on:
pull_request:
push:
branches:
- master

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.18

- name: Checkout code
uses: actions/checkout@v2

- name: Download license information for dependencies
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: make license-cache

- name: Check licenses
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: make license-check

- name: Run checks
run: |
make check
74 changes: 74 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Docker

on:
push:
branches:
- master
tags:
- "[0-9]+.[0-9]+.[0-9]+"
- "[0-9]+.[0-9]+.[0-9]+-dev.[0-9]+"
- "[0-9]+.[0-9]+.[0-9]+-rc.[0-9]+"
- "[0-9]+.[0-9]+.[0-9]+-alpha.[0-9]+"
- "[0-9]+.[0-9]+.[0-9]+-beta.[0-9]+"

env:
PLATFORMS: linux/amd64,linux/arm64,linux/arm/v7

jobs:
docker:
name: Docker
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.ref }}
restore-keys: |
${{ runner.os }}-buildx-

- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.CR_PAT }}

- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}

- name: Determine tag or commit
uses: haya14busa/action-cond@v1
id: refortag
with:
cond: ${{ startsWith(github.ref, 'refs/tags/') }}
if_true: ${{ github.ref }}
if_false: latest

- name: Determine image tag
id: imagetag
run: echo "::set-output name=value::${TAG_OR_BRANCH##*/}"
env:
TAG_OR_BRANCH: ${{ steps.refortag.outputs.value }}

- name: Build allspark
uses: docker/build-push-action@v3
with:
file: Dockerfile
platforms: linux/amd64
push: true
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
tags: |
ghcr.io/banzaicloud/allspark:${{ steps.imagetag.outputs.value }}
banzaicloud/allspark:${{ steps.imagetag.outputs.value }}