Skip to content

Commit

Permalink
Fixes #179: Migration of current travis ci to github-actions ci. (#244)
Browse files Browse the repository at this point in the history
##### ISSUE TYPE
<!--- Pick one below and delete the rest: -->
 - Feature Pull Request

Fix for issue [githib-actions](#179)

##### SUMMARY

-  Updated the golint path to $GOPATH/bin/golint to fix github-actions build failure.
-  Added docker push action step in current CI steps.
-  Added helm release step along with missing "helm init".

Checklist for Enabling github actions:
make sure to add below secrets in repo/settings/secrets
- GH_TOKEN(github access token of **charts** repo)
- DOCKER_USERNAME and DOCKER_PASSWORD (for **infracloud/botkube** repo).
- That's it, by merging this PR, first github-actions workflow for botkube should be triggered :) 

For reference the tested CI workflows on my repos:

- [with helm release](https://github.com/ameydev/botkube/runs/434885674?check_suite_focus=true)
- [Normal workflow with docker push and helm release skipped](https://github.com/ameydev/botkube/runs/434903893?check_suite_focus=true)
  • Loading branch information
ameydev authored May 14, 2020
1 parent f90361d commit 03707b3
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 1 deletion.
62 changes: 62 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion hack/verify-golint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 03707b3

Please sign in to comment.