-
Notifications
You must be signed in to change notification settings - Fork 0
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
add github actions #1
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,54 @@ | ||||||||
name: Build | ||||||||
|
||||||||
on: [pull_request] | ||||||||
|
||||||||
jobs: | ||||||||
unit-tests: | ||||||||
name: vet and test | ||||||||
runs-on: ubuntu-latest | ||||||||
steps: | ||||||||
- uses: actions/setup-go@v2 | ||||||||
with: | ||||||||
go-version: 1.12 | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. suggestion (performance): Consider upgrading Go version from 1.12 to a more recent stable version. Using an outdated Go version may miss out on performance improvements, bug fixes, and new language features. It's recommended to use a more recent stable version across all jobs.
Suggested change
|
||||||||
- uses: actions/checkout@v2 | ||||||||
with: | ||||||||
path: src/github.com/go-ping/ping | ||||||||
- run: | | ||||||||
export GOPATH=$GITHUB_WORKSPACE | ||||||||
cd $GITHUB_WORKSPACE/src/github.com/go-ping/ping | ||||||||
go get ./... | ||||||||
go vet ./... | ||||||||
go test ./... -cover -race | ||||||||
|
||||||||
build-ping-cmd: | ||||||||
name: build ping command and run | ||||||||
runs-on: ubuntu-latest | ||||||||
steps: | ||||||||
- uses: actions/setup-go@v2 | ||||||||
with: | ||||||||
go-version: 1.12 | ||||||||
- uses: actions/checkout@v2 | ||||||||
with: | ||||||||
path: src/github.com/go-ping/ping | ||||||||
- run: | | ||||||||
export GOPATH=$GITHUB_WORKSPACE | ||||||||
cd $GITHUB_WORKSPACE/src/github.com/go-ping/ping | ||||||||
go build -race -o ping_linux ./cmd/ping/ping.go | ||||||||
sudo ./ping_linux --privileged -c 2 www.google.com | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚨 suggestion (security): Document the need for sudo privileges in the build-ping-cmd job. Running the built binary with sudo privileges may be necessary for ICMP packets, but it has security implications. Consider adding a comment explaining why this is required.
Suggested change
|
||||||||
sudo ./ping_linux --privileged -c 3 -i 200ms www.google.com | ||||||||
sudo ./ping_linux --privileged -c 10 -i 100ms -t 1s www.google.com | ||||||||
|
||||||||
x-platform-build: | ||||||||
name: cross platform build | ||||||||
runs-on: ubuntu-latest | ||||||||
steps: | ||||||||
- uses: actions/setup-go@v2 | ||||||||
with: | ||||||||
go-version: 1.12 | ||||||||
- uses: actions/checkout@v2 | ||||||||
with: | ||||||||
path: src/github.com/aws/amazon-ecs-agent | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. issue (typo): Correct the checkout path in the x-platform-build job. The checkout path in this job differs from the others, using 'aws/amazon-ecs-agent' instead of 'go-ping/ping'. This appears to be a copy-paste error that should be fixed. |
||||||||
- run: | | ||||||||
export GOPATH=$GITHUB_WORKSPACE | ||||||||
cd $GITHUB_WORKSPACE/src/github.com/go-ping/ping | ||||||||
GOOS=darwin go build -o ping_darwin ./cmd/ping/ping.go |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: Consider optimizing job configurations to reduce repetition.
The setup steps are repeated across all three jobs. Consider creating a composite action or using a matrix strategy to reduce duplication and improve maintainability.