From cf17b413b40cbdff98f4e1cb254dc34359edfe80 Mon Sep 17 00:00:00 2001 From: ain ghazal Date: Fri, 2 Feb 2024 19:36:38 +0100 Subject: [PATCH] add targets for testing internal path --- .github/workflows/build-refactor.yml | 57 ++++++++++++++++++++++++++++ Makefile | 11 +++++- 2 files changed, 66 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/build-refactor.yml diff --git a/.github/workflows/build-refactor.yml b/.github/workflows/build-refactor.yml new file mode 100644 index 00000000..a822bf03 --- /dev/null +++ b/.github/workflows/build-refactor.yml @@ -0,0 +1,57 @@ +name: build-refactor +# this action is covering internal/ tree with go1.21 + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + short-tests: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: setup go + uses: actions/setup-go@v2 + with: + go-version: '1.21' + - name: Run short tests + run: go test --short -cover ./internal/... + + gosec: + runs-on: ubuntu-latest + env: + GO111MODULE: on + steps: + - name: Checkout Source + uses: actions/checkout@v2 + - name: Run Gosec security scanner + uses: securego/gosec@master + with: + args: '-no-fail ./...' + + coverage-threshold: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: setup go + uses: actions/setup-go@v2 + with: + go-version: '1.21' + - name: Ensure coverage threshold + run: make test-coverage-threshold-refactor + + integration: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: setup go + uses: actions/setup-go@v2 + with: + go-version: '1.21' + - name: run integration tests + run: go test -v ./tests/integration + diff --git a/Makefile b/Makefile index 620f0bbb..dec4c815 100644 --- a/Makefile +++ b/Makefile @@ -31,10 +31,17 @@ test: GOFLAGS='-count=1' go test -v ./... test-coverage: - go test -coverprofile=coverage.out ./vpn ./internal/... + go test -coverprofile=coverage.out ./vpn + +test-coverage-refactor: + go test -coverprofile=coverage.out ./internal/... test-coverage-threshold: - go test --short -coverprofile=cov-threshold.out ./vpn ./internal/... + go test --short -coverprofile=cov-threshold.out ./vpn + ./scripts/go-coverage-check.sh cov-threshold.out ${COVERAGE_THRESHOLD} + +test-coverage-threshold-refactor: + go test --short -coverprofile=cov-threshold.out ./internal/... ./scripts/go-coverage-check.sh cov-threshold.out ${COVERAGE_THRESHOLD} test-short: