Skip to content

Commit

Permalink
Issue GitHub action (#280)
Browse files Browse the repository at this point in the history
* initial changes for github action

Signed-off-by: anishakj <[email protected]>

* Fixed compilation error

Signed-off-by: anishakj <[email protected]>

* Fixed compilation error

Signed-off-by: anishakj <[email protected]>

* Added changes for pushing

Signed-off-by: anishakj <[email protected]>

* Added changes for pushing

Signed-off-by: anishakj <[email protected]>

* Fixed error

Signed-off-by: anishakj <[email protected]>

* Changed tag in Makefile

Signed-off-by: anishakj <[email protected]>

* Removed the commented line

Signed-off-by: anishakj <[email protected]>
  • Loading branch information
anishakj authored Dec 8, 2020
1 parent 9bdc9a2 commit ce7b41d
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 1 deletion.
71 changes: 71 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# workflow name
name: CI

# on events
on:
push:
branches:
- master
pull_request:
branches:
- master

# jobs to run
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.13.8
uses: actions/setup-go@v2
with:
go-version: 1.13.8
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Gofmt and License checks
run: make check
- name: unit tests
run: make test
- name: Codecov
uses: codecov/[email protected]
- name: Set env
run: |
echo "KUBERNETES_VERSION=v1.15.0" >> $GITHUB_ENV
echo "OPERATOR_SDK_VERSION=v0.17.0" >> $GITHUB_ENV
echo "MINIKUBE_VERSION=v1.11.0" >> $GITHUB_ENV
echo "KUBERNETES_CONFIG_FILE=$HOME/.kube/config" >> $GITHUB_ENV
echo "CHANGE_MINIKUBE_NONE_USER=true" >> $GITHUB_ENV
- name: minikube setup
run: |
curl -Lo kubectl https://storage.googleapis.com/kubernetes-release/release/$KUBERNETES_VERSION/bin/linux/amd64/kubectl && chmod +x kubectl && sudo mv kubectl /usr/local/bin/
curl -Lo minikube https://storage.googleapis.com/minikube/releases/$MINIKUBE_VERSION/minikube-linux-amd64 && chmod +x minikube && sudo mv minikube /usr/local/bin/
curl -Lo operator-sdk https://github.com/operator-framework/operator-sdk/releases/download/$OPERATOR_SDK_VERSION/operator-sdk-$OPERATOR_SDK_VERSION-x86_64-linux-gnu && chmod +x operator-sdk && sudo mv operator-sdk /usr/local/bin/
sudo mount --make-rshared /
CHANGE_MINIKUBE_NONE_USER=true
export KUBERNETES_CONFIG_FILE=$HOME/.kube/config
export KUBERNETES_CONFIG_FILE=$HOME/.kube/config;export CHANGE_MINIKUBE_NONE_USER=true;sudo minikube start --vm-driver=none --bootstrapper=kubeadm --kubernetes-version=$KUBERNETES_VERSION
echo "minikube started, updating context"
export KUBERNETES_CONFIG_FILE=$HOME/.kube/config;export CHANGE_MINIKUBE_NONE_USER=true; sudo minikube update-context
echo "context is updated"
#JSONPATH='{range .items[*]}{@.metadata.name}:{range @.status.conditions[*]}{@.type}={@.status};{end}{end}'; until kubectl get nodes -o jsonpath="$JSONPATH" 2>&1 | grep -q "Ready=True"; do sleep 1; done
sleep 60
sudo kubectl create clusterrolebinding add-on-cluster-admin --clusterrole=cluster-admin --serviceaccount=kube-system:default
echo "created cluster role"
sudo kubectl cluster-info
echo "cluster info"
sudo kubectl -n kube-system get pod -o wide
- name: E2E
run: sudo make test-e2e
publish:
name: Publish docker image
runs-on: ubuntu-latest
needs: build
if: github.event_name == 'release' && github.event.action == 'created'
steps:
- name: Pushing docker images
run: sudo make push
- name: Uploading binary files
uses: actions/upload-artifact@v2
with:
name: zookeeper-exporter
path: bin/zookeeper-exporter*
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ TEST_REPO=testzkop/$(PROJECT_NAME)
APP_REPO=pravega/$(APP_NAME)
ALTREPO=emccorp/$(PROJECT_NAME)
APP_ALTREPO=emccorp/$(APP_NAME)
VERSION=$(shell git describe --always --tags --dirty | sed "s/\(.*\)-g`git rev-parse --short HEAD`/\1/")
VERSION=$(shell git describe --always --tags --dirty | tr -d "v" | sed "s/\(.*\)-g`git rev-parse --short HEAD`/\1/")
GIT_SHA=$(shell git rev-parse --short HEAD)
TEST_IMAGE=$(TEST_REPO)-testimages:$(VERSION)
DOCKER_TEST_PASS=testzkop@123
Expand Down

0 comments on commit ce7b41d

Please sign in to comment.