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

Create GH Actions workflow for build&test of Go client #2318

Merged
merged 10 commits into from
Feb 10, 2021
42 changes: 42 additions & 0 deletions .github/workflows/client.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Go

#TODO: extend the conditions once workflow gets tested together with other workflows
on:
push:
branches:
- master
Copy link
Contributor

Choose a reason for hiding this comment

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

One thing that may be worth considering here, if we're continuing to run the Circle build, is to change this filter to run on certain branches (e.g. rfc-18/*) and change Circle to not run on that filter. This effectively gives you a branch namespace to use for the work.

Copy link
Member

Choose a reason for hiding this comment

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

Implemented in #2329

pull_request:
workflow_dispatch:

jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: satackey/[email protected]
continue-on-error: true # ignore the failure of a step and avoid terminating the job
Copy link
Contributor

Choose a reason for hiding this comment

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

I'll flag that the comment here mostly seems to be repeating what the flag already communicates (unlike if: always() which isn't as obvious).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're right. I'm not changing it though, as this fragment of code will be removed once #2331 gets merged to master.

- name: Run Docker build
run: |
docker build \
--target gobuild \
--tag go-build-env .
docker build \
--tag keep-client .
- name: Create and enter test results directory
michalinacienciala marked this conversation as resolved.
Show resolved Hide resolved
run: |
mkdir -p $GITHUB_WORKSPACE/test-results/
Copy link
Member

Choose a reason for hiding this comment

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

Maybe we could simplify it and do just mkdir test-results? In the next step, we've got to use $GITHUB_WORKSPACE to define the volume as a path, but I believe we don't need it here.

- name: Run Go tests
run: |
docker run \
--volume $GITHUB_WORKSPACE/test-results:/mnt/test-results \
--workdir /go/src/github.com/keep-network/keep-core \
go-build-env \
gotestsum --junitfile /mnt/test-results/unit-tests.xml
- name: Publish Unit Test results
uses: EnricoMi/[email protected]
if: always() # guarantees that this action always runs, even if earlier steps fail
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
files: ./test-results/unit-tests.xml
check_name: Go Test Results # name under which test results will be presented in GitHub (optional)
comment_on_pr: false # turns off commenting on Pull Requests