Skip to content

Commit

Permalink
feat: Add testing scripts (#570)
Browse files Browse the repository at this point in the history
Adds some new testing scripts and uses them in GH actions.

Signed-off-by: Tim Downey <tim.downey@broadcom.com>
  • Loading branch information
ctlong authored Apr 22, 2024
1 parent ee1724b commit 0f6570a
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 42 deletions.
42 changes: 0 additions & 42 deletions .github/workflows/go.yml

This file was deleted.

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

on:
push:
branches:
- v[0-9]*
pull_request:
branches:
- v[0-9]*

jobs:
unit-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: "src/go.mod"
- run: ./scripts/subtests/unit-test

lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: "src/go.mod"
- run: ./scripts/subtests/lint
18 changes: 18 additions & 0 deletions scripts/subtests/lint
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash

set -eux
set -o pipefail

SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"

set +e
golangci_lint_executable=$(which golangci-lint)
set -e
if [ -z "${golangci_lint_executable}" ] || [ ! -x "${golangci_lint_executable}" ]; then
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
fi

pushd "${SCRIPT_DIR}/../../src" > /dev/null
golangci-lint run ./...
popd > /dev/null

11 changes: 11 additions & 0 deletions scripts/subtests/unit-test
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

set -eux
set -o pipefail

SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"

pushd "${SCRIPT_DIR}/../../src" > /dev/null
go run github.com/onsi/ginkgo/v2/ginkgo -r --randomize-all --randomize-suites --fail-on-pending --keep-going --race --trace
popd > /dev/null

10 changes: 10 additions & 0 deletions scripts/test
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

set -eux
set -o pipefail

SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"

"${SCRIPT_DIR}/subtests/lint"
"${SCRIPT_DIR}/subtests/unit-test"

0 comments on commit 0f6570a

Please sign in to comment.