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

Switch test and build to GitHub actions #91

Merged
merged 7 commits into from
Aug 23, 2021
Merged
Show file tree
Hide file tree
Changes from 5 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
22 changes: 22 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: build

on:
push:
branches: [ master ]
pull_request:
paths:
- 'examples/*'

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.16
elivlo marked this conversation as resolved.
Show resolved Hide resolved

- name: Build examples
run: for dir in examples/*/; do go build -o $dir/bin $dir/main.go; done

35 changes: 35 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: test

on:
push:
branches: [ master ]
pull_request:
paths:
- '**.go'

jobs:
go_test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.16
elivlo marked this conversation as resolved.
Show resolved Hide resolved

- name: Install goveralls
run: go install github.com/mattn/goveralls@latest

- name: Install nmap
run: sudo apt install -y nmap

- name: Test
elivlo marked this conversation as resolved.
Show resolved Hide resolved
run: go test -coverprofile=c.out ./...

- name: Create coverage report
run: go tool cover -func=c.out

- name: Send coverage report
env:
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: goveralls -coverprofile=c.out -service=github
24 changes: 0 additions & 24 deletions .travis.yml

This file was deleted.

12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,16 @@
<a href="https://goreportcard.com/report/github.com/Ullaakut/nmap">
<img src="https://goreportcard.com/badge/github.com/Ullaakut/nmap">
</a>
<a href="https://travis-ci.org/Ullaakut/nmap">
<img src="https://travis-ci.org/Ullaakut/nmap.svg?branch=master">
<a href="https://github.com/Ullaakut/nmap/actions/workflows/build.yml">
<img src="https://github.com/Ullaakut/nmap/actions/workflows/build.yml/badge.svg">
</a>
<a href="https://coveralls.io/github/Ullaakut/nmap?branch=master">
<img src="https://coveralls.io/repos/github/Ullaakut/nmap/badge.svg?branch=master">
<a href="https://github.com/Ullaakut/nmap/actions/workflows/test.yml">
<img src="https://github.com/Ullaakut/nmap/actions/workflows/test.yml/badge.svg">
</a>
<a href='https://coveralls.io/github/Ullaakut/nmap'>
<img src='https://coveralls.io/repos/github/Ullaakut/nmap/badge.svg' alt='Coverage Status' />
</a>

<p>

This library aims at providing idiomatic `nmap` bindings for go developers, in order to make it easier to write security audit tools using golang.
Expand Down
2 changes: 1 addition & 1 deletion nmap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ func TestRunWithProgress(t *testing.T) {

compareWholeRun: true,
expectedResult: r,
expectedProgress: []float32{56.66, 81.95, 87.84, 94.43, 97.76, 97.76},
expectedProgress: []float32{3.22, 56.66, 77.02, 81.95, 86.79, 87.84},
Ullaakut marked this conversation as resolved.
Show resolved Hide resolved
expectedErr: nil,
},
}
Expand Down
7 changes: 6 additions & 1 deletion tests/scripts/fake_nmap_delay.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
#!/bin/bash
input=$1
count=0
while IFS= read -r line
do
echo "$line"
sleep .5
if [ $count -gt 13 ] && [ $count -lt 23 ]
then
sleep 1
fi
(( count++ ))
done < "$input"