Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Brendan Le Glaunec <brendan.le-glaunec@epitech.eu>
  • Loading branch information
elivlo and Ullaakut committed Aug 20, 2021
1 parent 77f28ef commit 78008cb
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 31 deletions.
33 changes: 24 additions & 9 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,30 @@ on:
- 'examples/*'

jobs:
build:
check:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.16
- name: Check out source code
uses: actions/checkout@v2

- name: Install Go
uses: actions/setup-go@v2
with:
go-version: 1.16

- name: Cache Go modules
uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
# Here, we simply print the exact go version, to have it as part of the
# action's output, which might be convenient.
- name: Print Go version
run: go version

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

- name: Build examples
run: for dir in examples/*/; do go build -o $dir/bin $dir/main.go; done
69 changes: 47 additions & 22 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,53 @@ on:
- '**.go'

jobs:
go_test:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.16

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

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

- name: Test
run: go test -coverprofile=c.out ./...

- name: Create coverage report
run: go tool cover -func=c.out
- name: Check out source code
uses: actions/checkout@v2

- name: Install Go
uses: actions/setup-go@v2
with:
go-version: 1.16

- name: Cache Go modules
uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
# Here, we simply print the exact go version, to have it as part of the
# action's output, which might be convenient.
- name: Print Go version
run: go version

- name: Send coverage report
env:
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: goveralls -coverprofile=c.out -service=github
# This check makes sure that the `go.mod` and `go.sum` files for Go
# modules are always up-to-date.
- name: Verify Go modules
run: go mod tidy && git status && git --no-pager diff && git diff-index --quiet HEAD --

# This check makes sure that the source code is formatted according to the
# Go standard `go fmt` formatting.
- name: Verify source code formatting
run: go fmt ./... && git status && git --no-pager diff && git diff-index --quiet HEAD --

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

- name: Test
run: go test -coverprofile=c.out ./...

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

- 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

0 comments on commit 78008cb

Please sign in to comment.