Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #179: Migration of current travis ci to github-actions ci. #244

Merged
merged 6 commits into from
May 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is $HOME value? Can we use $HOME to set the path?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the value for $HOME is /home/runner but it gives error if we try to assign value of GOPATH to a relative path.
Check error.
so I think we need to give absolute path which would be /home/runner or can keep the same value.

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