Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: remove legacy package #72

Merged
merged 15 commits into from
Apr 15, 2024
66 changes: 0 additions & 66 deletions .github/workflows/build-refactor.yml

This file was deleted.

38 changes: 30 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,42 @@
name: build
# this action is covering internal/ tree with go1.20

on:
push:
branches:
- main
- 'main'
pull_request:
branches:
- main
- 'main'

jobs:
short-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: setup go
uses: actions/setup-go@v2
uses: actions/setup-go@v5
with:
go-version: '1.20'
- name: Run short tests
run: go test --short -cover ./vpn
run: go test --short -cover ./internal/...

lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Lint with revive action, from pre-built image
uses: docker://morphy/revive-action:v2
with:
path: "internal/..."

gosec:
runs-on: ubuntu-latest
env:
GO111MODULE: on
steps:
- name: Checkout Source
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Run Gosec security scanner
uses: securego/gosec@master
with:
Expand All @@ -35,10 +45,22 @@ jobs:
coverage-threshold:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: setup go
uses: actions/setup-go@v2
uses: actions/setup-go@v5
with:
go-version: '1.20'
- name: Ensure coverage threshold
run: make test-coverage-threshold

integration:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: setup go
uses: actions/setup-go@v5
with:
go-version: '1.20'
- name: run integration tests
run: go run ./tests/integration

37 changes: 7 additions & 30 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,7 @@ build-rel:
@GOOS=windows go build ${FLAGS} -o minivpn.exe

build-race:
@go build -race

build-ping:
@go build -v ./cmd/vpnping

build-ndt7:
@go build -o ndt7 ./cmd/ndt7
@go build -race ./cmd/minivpn

bootstrap:
@./scripts/bootstrap-provider ${PROVIDER}
Expand All @@ -45,18 +39,14 @@ test-combined-coverage:
scripts/go-coverage-check.sh ./coverage/profile.out ${COVERAGE_THRESHOLD}

test-coverage-threshold:
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-refactor.out ./internal/...
./scripts/go-coverage-check.sh cov-threshold-refactor.out ${COVERAGE_THRESHOLD}

test-short:
go test -race -short -v ./...

test-ping:
./minivpn -c data/${PROVIDER}/config -t ${TARGET} -n ${COUNT} ping
./minivpn -c data/${PROVIDER}/config -ping

integration-server:
# this needs the container from https://github.com/ainghazal/docker-openvpn
Expand All @@ -66,20 +56,14 @@ test-fetch-config:
rm -rf data/tests
mkdir -p data/tests && curl 172.17.0.2:8080/ > data/tests/config

test-ping-local:
# run the integration-server first
./minivpn -c data/tests/config -t 172.17.0.1 -n ${COUNT} ping

test-local: test-fetch-config test-ping-local

qa:
@# all the steps at once
cd tests/integration && ./run-server.sh &
sleep 5 # 5secs should be enough, increase this if not.
@rm -rf data/tests
@mkdir -p data/tests && curl 172.17.0.2:8080/ > data/tests/config
@sleep 1
./minivpn -c data/tests/config -t 172.17.0.1 -n ${COUNT} ping
./minivpn -c data/tests/config -ping
@docker stop ovpn1

integration:
Expand All @@ -88,17 +72,6 @@ integration:
filternet-qa:
cd tests/qa && ./run-filternet.sh remote-block-all

coverage:
go test -coverprofile=coverage.out ./vpn
go tool cover -html=coverage.out

coverage-ping:
go test -coverprofile=coverage-ping.out ./extras/ping
go tool cover -html=coverage-ping.out

proxy:
./minivpn -c data/${PROVIDER}/config proxy

backup-data:
@tar cvzf ../data-vpn-`date +'%F'`.tar.gz

Expand All @@ -122,5 +95,9 @@ go-sec:
go-revive:
revive internal/...

install-linters:
go install github.com/mgechev/revive@latest
go install github.com/securego/gosec/v2/cmd/gosec@latest

clean:
@rm -f coverage.out
29 changes: 0 additions & 29 deletions extras/example_pinger_test.go

This file was deleted.

134 changes: 0 additions & 134 deletions extras/ndt7.go

This file was deleted.

Loading
Loading