Skip to content

Commit

Permalink
Add CI steps (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
maruina authored Feb 10, 2021
1 parent bb060b5 commit a6324bc
Show file tree
Hide file tree
Showing 8 changed files with 145 additions and 2 deletions.
7 changes: 7 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: 2
updates:
# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
20 changes: 20 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Lint

on:
push:
tags:
- v*
branches:
- main
pull_request:

jobs:
golangci:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: golangci-lint
uses: golangci/golangci-lint-action@v2
with:
version: v1.36
36 changes: 36 additions & 0 deletions .github/workflows/release-artifacts.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Release Artifacts

on:
push:
tags:
- '*'

jobs:
release:
name: release
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: ^1.15

- name: Check out code
uses: actions/checkout@v2

- name: Get dependencies
run: go mod download

- name: Get tag
uses: olegtarasov/get-tag@v2
id: tagName

- name: Build on PR
id: docker_build
uses: docker/build-push-action@v2
with:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
registry: docker.pkg.github.com
repository: ${{ github.repository }}/argocd-progressive-rollout
tags: ${{ steps.tagName.outputs.tag }}
17 changes: 17 additions & 0 deletions .github/workflows/release-notes.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Release Drafter

on:
push:
# branches to consider in the event; optional, defaults to all
branches:
- main

jobs:
update_release_draft:
name: release-notes
runs-on: ubuntu-latest
steps:
# Drafts your next Release notes as Pull Requests are merged into "master"
- uses: release-drafter/release-drafter@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
62 changes: 62 additions & 0 deletions .github/workflows/test-build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Test and Build

on:
push:
pull_request:

jobs:
test-build:
name: test-build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- uses: actions/setup-go@v2
with:
go-version: ^1.15

- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: go

- name: Install kubebuilder
run: |
set -x
version=2.3.1
os=$(go env GOOS)
arch=$(go env GOARCH)
curl -Ls https://go.kubebuilder.io/dl/${version}/${os}/${arch} -o /tmp/kubebuilder_${version}.tar.gz
shasum -a 256 -c kubebuilder_sha256.txt
tar -xzf /tmp/kubebuilder_${version}.tar.gz -C /tmp/
sudo mv /tmp/kubebuilder_${version}_${os}_${arch} /usr/local/kubebuilder
export PATH=$PATH:/usr/local/kubebuilder/bin
- name: Get dependencies
run: go mod download

- name: Test
run: make test

- name: Build
run: make manager

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1

- name: Build on PR
uses: docker/build-push-action@v2
with:
push: false
tags: main
if: github.event_name == 'pull_request'

- name: Build and publish a latest docker image when merge in main
uses: docker/build-push-action@v2
with:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
registry: docker.pkg.github.com
repository: ${{ github.repository }}/argocd-progressive-rollout
tags: main
if: github.event_name != 'pull_request'
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ all: manager

# Run tests
test: generate fmt vet manifests
go test ./... -coverprofile cover.out
go test -v -covermode=atomic -coverprofile=coverage.out -race ./...

# Build manager binary
manager: generate fmt vet
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/Skyscanner/argocd-progressive-rollout

go 1.13
go 1.15

require (
github.com/go-logr/logr v0.1.0
Expand Down
1 change: 1 addition & 0 deletions kubebuilder_sha256.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ff496970f209706763f2aba2bdcefc2de8d00085b3b972b5790117b59ea4ed10 /tmp/kubebuilder_2.3.1.tar.gz

0 comments on commit a6324bc

Please sign in to comment.