mirror of
https://github.com/luxfi/netrunner.git
synced 2026-07-27 00:04:23 +00:00
- Update golangci-lint from v1.49 to v2.1.6 in lint.sh - Add GOWORK=off to workflow env for workspace isolation - Add CGO_ENABLED=0 to unit tests (avoids luxfi/accel C headers) - Update GitHub Actions: checkout v4, setup-go v5, upload-artifact v4 - Update OS matrix: ubuntu-22.04, macos-14 - Run go mod tidy for updated checksums
53 lines
1.0 KiB
Bash
Executable File
53 lines
1.0 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
set -o errexit
|
|
set -o pipefail
|
|
set -e
|
|
|
|
if ! [[ "$0" =~ scripts/lint.sh ]]; then
|
|
echo "must be run from repository root"
|
|
exit 255
|
|
fi
|
|
|
|
if [ "$#" -eq 0 ]; then
|
|
# by default, check all source code
|
|
# to test only "node" package do:
|
|
# ./scripts/lint.sh ./node/...
|
|
TARGET="./..."
|
|
else
|
|
TARGET="${1}"
|
|
fi
|
|
|
|
TESTS=${TESTS:-"golangci_lint"}
|
|
|
|
function test_golangci_lint {
|
|
go install -v github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.1.6
|
|
golangci-lint run --config .golangci.yml
|
|
}
|
|
|
|
# find_go_files [package]
|
|
# all go files except generated ones
|
|
function find_go_files {
|
|
local target="${1}"
|
|
go fmt -n "${target}" | grep -Eo "([^ ]*)$" | grep -vE "(\\.pb\\.go|\\.pb\\.gw.go)"
|
|
}
|
|
|
|
function run {
|
|
local test="${1}"
|
|
shift 1
|
|
echo "START: '${test}' at $(date)"
|
|
if "test_${test}" "$@" ; then
|
|
echo "SUCCESS: '${test}' completed at $(date)"
|
|
else
|
|
echo "FAIL: '${test}' failed at $(date)"
|
|
exit 255
|
|
fi
|
|
}
|
|
|
|
echo "Running '$TESTS' at: $(date)"
|
|
for test in $TESTS; do
|
|
run "${test}" "${TARGET}"
|
|
done
|
|
|
|
echo "ALL SUCCESS!"
|