Skip to content

Commit

Permalink
add targets for testing internal path
Browse files Browse the repository at this point in the history
  • Loading branch information
ainghazal committed Feb 2, 2024
1 parent c84ad65 commit cf17b41
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 2 deletions.
57 changes: 57 additions & 0 deletions .github/workflows/build-refactor.yml
Original file line number Diff line number Diff line change
@@ -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

11 changes: 9 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit cf17b41

Please sign in to comment.