Skip to content

Commit

Permalink
Merge pull request #23 from doyoubi/GithubActions
Browse files Browse the repository at this point in the history
Add github actions
  • Loading branch information
doyoubi authored Jan 3, 2021
2 parents 93f6470 + 4206172 commit 45f3046
Show file tree
Hide file tree
Showing 15 changed files with 1,375 additions and 1,267 deletions.
66 changes: 66 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
on:
push:
branches:
- master
pull_request: {}
name: Continuous Integration
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Install Golang
uses: actions/setup-go@v2
with:
go-version: '^1.15.6'
- name: Checkout sources
uses: actions/checkout@v1
- name: Go fmt
run: go fmt ./...
- name: Go vet
run: go vet ./...
- name: Run golint on ./controllers
uses: Jerome1337/golint-action@v1.0.2
with:
golint-path: ./controllers...
- name: Run golint on ./api/v1alpha1
uses: Jerome1337/golint-action@v1.0.2
with:
golint-path: ./api/v1alpha1...
- name: golangci-lint
uses: golangci/golangci-lint-action@v2
with:
version: v1.29
helm:
name: Helm
runs-on: ubuntu-latest
steps:
- name: Set up Helm
uses: azure/setup-helm@v1
with:
version: v3.4.0
- uses: actions/setup-python@v2
with:
python-version: 3.7
- name: Set up chart-testing
uses: helm/chart-testing-action@v2.0.1
- name: Checkout sources
uses: actions/checkout@v1
- name: Lint operator
run: ct lint --charts ./helm/undermoon-operator
- name: Lint cluster
run: ct lint --charts ./helm/undermoon-cluster
- name: Lint checker
run: ct lint --charts ./chaostest/undermoon-checker
unittest:
name: Unittest
runs-on: ubuntu-latest
steps:
- name: Install Golang
uses: actions/setup-go@v2
with:
go-version: '^1.15.6'
- name: Checkout sources
uses: actions/checkout@v1
- name: Run unittest
run: go test ./... -run '^(TestUnit)'
11 changes: 7 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ endif
# Image URL to use all building/pushing image targets
IMG ?= $(IMG_NAME):$(VERSION)
UNDERMOON_IMG ?= $(UNDERMOON_IMG_NAME):$(UNDERMOON_IMG_VERSION)
# Produce CRDs that work back to Kubernetes 1.11 (no version conversion)
CRD_OPTIONS ?= "crd:trivialVersions=true"
# Produce new api version
CRD_OPTIONS ?= "crd:crdVersions=v1"

# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
ifeq (,$(shell go env GOBIN))
Expand Down Expand Up @@ -83,7 +83,10 @@ vet:

# Generate code
generate: controller-gen
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..."
$(CONTROLLER_GEN) $(CRD_OPTIONS) \
object:headerFile="hack/boilerplate.go.txt" \
paths="./..." \
output:crd:artifacts:config=config/crd/bases

# TODO: add test when it's done.
# Build the docker image
Expand Down Expand Up @@ -131,7 +134,7 @@ endif

# Generate bundle manifests and metadata, then validate generated files.
.PHONY: bundle
bundle: manifests
bundle: manifests kustomize
operator-sdk generate kustomize manifests -q
cd config/manager && $(KUSTOMIZE) edit set image controller=$(IMG)
$(KUSTOMIZE) build config/manifests | operator-sdk generate bundle -q --overwrite --version $(VERSION) $(BUNDLE_METADATA_OPTS)
Expand Down
4 changes: 4 additions & 0 deletions Makefile.utils
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ lint:
helm lint helm/undermoon-operator --strict
helm lint helm/undermoon-cluster --strict
helm lint chaostest/undermoon-checker --strict
# Need to install https://github.com/helm/chart-testing-action
ct lint --charts ./helm/undermoon-operator
ct lint --charts ./helm/undermoon-cluster
ct lint --charts ./chaostest/undermoon-checker

unittest:
go test ./... -run '^(TestUnit)'
Expand Down
5 changes: 3 additions & 2 deletions PROJECT
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
domain: doyoubi.mydomain
layout: go.kubebuilder.io/v2
layout: go.kubebuilder.io/v3
projectName: undermoon-operator
repo: github.com/doyoubi/undermoon-operator
resources:
Expand All @@ -8,4 +8,5 @@ resources:
version: v1alpha1
version: 3-alpha
plugins:
go.sdk.operatorframework.io/v2-alpha: {}
manifests.sdk.operatorframework.io/v2: {}
scorecard.sdk.operatorframework.io/v2: {}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Undermoon Operator
# Undermoon Operator ![Continuous Integration](https://github.com/doyoubi/undermoon-operator/workflows/Continuous%20Integration/badge.svg)
Kubernetes operator for easy `Redis Cluster` management
based on [undermoon](https://github.com/doyoubi/undermoon)
using [operator-sdk](https://sdk.operatorframework.io/).
Expand Down
2 changes: 1 addition & 1 deletion api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions chaostest/undermoon-checker/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,7 @@ type: application
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0

maintainers:
- name: doyoubi
email: doyoubihgx@gmail.com
Loading

0 comments on commit 45f3046

Please sign in to comment.