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

First draft of GitHub Action #309

Merged
merged 3 commits into from
Jun 7, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
36 changes: 36 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: ZGrab2 build action
on: [push, pull_request]
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.16

- name: Set up Docker for integration tests
uses: docker-practice/actions-setup-docker@master

- name: Check out source
uses: actions/checkout@v2

- name: Install goimports
run: sudo apt install golang-golang-x-tools
Copy link
Member

Choose a reason for hiding this comment

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

Why do we need goimports?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Apparently goimports didn't need to be installed separately in TravisCI (based on the .travis.yml), but it does in GitHub Actions. It is used in the Makefile:

goimports -w -l $(GO_FILES)

I didn't try to understand why the Makefile was the way it was, so it's possible that the Makefile needs cleaning up as well.

Copy link
Member

Choose a reason for hiding this comment

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

Let's skip checking formatting in CI for now.


- name: Build
run: |
go get -t ./...
make

- name: Test
run: make clean zgrab2 test
continue-on-error: true

- name: Integration test
run: make integration-test
continue-on-error: true

- name: Integration cleanup
run: ./integration_tests/cleanup.sh
Copy link
Member

Choose a reason for hiding this comment

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

I think we can just drop the integration tests from CI. I'm pretty sure we broke them when we switched to Go modules. Did you have any luck getting them to run locally?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, I didn't successfully get this running locally. If you or someone else has a better understanding of how it should work, that might help with troubleshooting. I thought about reverting the repo to the last commit where TravisCI successfully passed and checking if the tests worked locally for me then, but I didn't go that far.

Since I did not get these tests working, I could remove my edits of the runner-base.Dockerfile file. I only modified it while trying to get it working and it's possible my edits, while minor, might move the file further from a functioning state.

Copy link
Member

Choose a reason for hiding this comment

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

I'd leave the Dockerfile alone, and drop the integration tests from CI. Can you file a follow up issue to figure out:

  1. What they did
  2. How to run them now that Go modules exist?

@justinbastress might have insights, he wrote them originally, back in the dark days of Go development.

6 changes: 1 addition & 5 deletions docker-runner/runner-base.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
FROM golang:1.9
FROM golang:1.16
# Base image that already has the pre-requisites downloaded.

WORKDIR /go/src/github.com/zmap

RUN go-wrapper download github.com/zmap/zgrab2

WORKDIR /go/src/github.com/zmap/zgrab2

RUN go get -v ./...
Expand Down