diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 000000000..08301b77e --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,62 @@ +name: CI +on: + push: + pull_request: +jobs: + build: + runs-on: ubuntu-latest + env: + GO111MODULE: on + GOPATH: /home/runner/work/botkube + GOBIN: /home/runner/work/botkube/bin + steps: + - name: Checkout + uses: actions/checkout@v1 + - name: Setup Go + uses: actions/setup-go@v1 + with: + go-version: 1.13 + - name: install golint + run: | + go get -u golang.org/x/lint/golint + - name: Before build + run: | + echo Workflow trigger - ${{ github.event_name }} + ./hack/verify-gofmt.sh + ./hack/verify-govet.sh + ./hack/verify-golint.sh + go mod verify + - name: make test, make build, make docker-image + run: | + make test + make + make container-image + - name: Push docker images + if: success() && github.event_name == 'push' && endsWith(github.ref ,'develop') + run: | + docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} + docker push infracloudio/botkube:latest + - name: Install helm + if: success() && github.event_name == 'push' && endsWith(github.ref ,'develop') + run: | + curl https://raw.githubusercontent.com/kubernetes/helm/master/scripts/get > get_helm.sh + chmod +x get_helm.sh + ./get_helm.sh + helm lint helm/botkube + - name: Release Helm template + if: success() && github.event_name == 'push' && endsWith(github.ref ,'develop') + run: | + cd .. + git config --global user.email "botkube-ci@infracloud.io" + git config --global user.name "BotKube CI" + git clone https://github.com/infracloudio/charts.git + cd charts + git fetch + git branch + git pull origin gh-pages + helm init --client-only + helm package --app-version v9.99.9-dev --version v9.99.9-dev ${{ github.workspace }}/helm/botkube/ + helm repo index --url https://infracloudio.github.io/charts --merge index.yaml . + git add . + git commit -m "Update BotKube latest helm chart" + git push https://${{ secrets.GH_TOKEN }}@github.com/infracloudio/charts.git diff --git a/hack/verify-golint.sh b/hack/verify-golint.sh index a5b9bf2e3..ab44f776c 100755 --- a/hack/verify-golint.sh +++ b/hack/verify-golint.sh @@ -31,7 +31,7 @@ find_files() { \) -name '*.go' } -bad_files=$(find_files | xargs -I@ bash -c "golint @") +bad_files=$(find_files | xargs -I@ bash -c "$GOPATH/bin/golint @") if [[ -n "${bad_files}" ]]; then echo "${bad_files}" exit 1