Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
35 changes: 25 additions & 10 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,43 @@ on:
- 'examples/*'

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

steps:
- name: Check out source code
uses: actions/checkout@v2
uses: actions/checkout@v6
with:
fetch-depth: 0

- name: Install Go
uses: actions/setup-go@v4
id: install-go
uses: actions/setup-go@v6
with:
go-version: "1.20.0"
go-version-file: 'go.mod'
cache: false

- name: Cache Go modules
uses: actions/cache@v2
- name: Cache Go mod
id: gomod
uses: actions/cache@v5
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
${{ runner.os }}-go-mod-

- name: Cache Go build
uses: actions/cache@v5
with:
path: ~/.cache/go-build
key: ${{ runner.os }}-go-build-${{ github.ref_name }}
restore-keys: |
${{ runner.os }}-go-build-

- name: Download dependencies
run: go mod download
if: steps.gomod.outputs.cache-hit != 'true'

# 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

Expand Down
88 changes: 50 additions & 38 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,55 +12,67 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out source code
uses: actions/checkout@v2
uses: actions/checkout@v6
with:
fetch-depth: 0

- name: Install Go
uses: actions/setup-go@v4
id: install-go
uses: actions/setup-go@v6
with:
go-version: "1.20.0"
go-version-file: 'go.mod'
cache: false

- name: Cache Go modules
uses: actions/cache@v2
- name: Cache Go mod
id: gomod
uses: actions/cache@v5
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
key: ${{ runner.os }}-go-mod-${{ 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

# 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 --
${{ runner.os }}-go-mod-

- name: Install nmap
run: sudo apt install -y nmap
- name: Cache Go build
uses: actions/cache@v5
with:
path: ~/.cache/go-build
key: ${{ runner.os }}-go-build-${{ github.ref_name }}
restore-keys: |
${{ runner.os }}-go-build-

- name: Test
run: go test -coverprofile=c.out ./...
- name: Download dependencies
run: go mod download
if: steps.gomod.outputs.cache-hit != 'true'

- name: Install goveralls
run: go install github.com/mattn/goveralls@latest
- name: Download nmap
run: sudo apt-get install -y nmap

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

- name: Run Linter
uses: golangci/golangci-lint-action@v9
with:
version: v2.7.2

- name: Send coverage report
env:
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: goveralls -coverprofile=c.out -service=github
- name: Setup gotestsum
uses: gertd/action-gotestsum@v3.0.0
with:
gotestsum_version: v1.13.0

- name: Install staticcheck
run: go install honnef.co/go/tools/cmd/staticcheck@v0.4.3
- name: Run Tests
env:
TEST_DIR: ${{ inputs.TEST_DIR }}
run: |
GOTESTSUM_FLAGS="--junitfile tests.xml --format pkgname -- -cover -race"
if [ -z "$TEST_DIR" ]; then
gotestsum $GOTESTSUM_FLAGS ./...
else
gotestsum $GOTESTSUM_FLAGS ./$TEST_DIR/...
fi

- name: Run staticcheck for possible optimizations
run: staticcheck -tests=false
- name: Test Summary
uses: test-summary/action@v2
with:
paths: "tests.xml"
if: always()
101 changes: 1 addition & 100 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,100 +1 @@
## Golang
vendor/*

### Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib

### Test binary, built with `go test -c`
*.test

### Output of the go coverage tool, specifically when used with LiteIDE
*.out

## MacOS

### General
.DS_Store

## IDEs

### VSCode

.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json

### JetBrains
.idea

# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm, Goland
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf

# Generated files
.idea/**/contentModel.xml

# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml

# Gradle
.idea/**/gradle.xml
.idea/**/libraries

# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/modules.xml
# .idea/*.iml
# .idea/modules

# CMake
cmake-build-*/

# Mongo Explorer plugin
.idea/**/mongoSettings.xml

# File-based project format
*.iws

# IntelliJ
out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

# Editor-based Rest Client
.idea/httpRequests

# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser
dist
Loading