forked from cad/ovpm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
91 changed files
with
14,453 additions
and
12,973 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: Go | ||
|
||
on: | ||
push: | ||
branches: [ master, dev ] | ||
pull_request: | ||
branches: [ master, dev ] | ||
|
||
jobs: | ||
test: | ||
name: Test | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v2-beta | ||
with: | ||
go-version: "^1.14.6" | ||
id: go | ||
|
||
- name: Check out code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Install OpenVPN | ||
run: sudo apt-get install -y openvpn | ||
|
||
- name: Get dependencies | ||
run: | | ||
go get -v -t -d ./... | ||
- name: Test | ||
run: make test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
name: Release | ||
on: | ||
push: | ||
tags: | ||
- 'v*' | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-go@v2 | ||
with: | ||
go-version: '^1.14.6' | ||
|
||
- name: Get the version | ||
id: get_version | ||
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\/v/} | ||
|
||
- name: Repo Tools | ||
run: | | ||
sudo apt-get update -y | ||
sudo apt install reprepro createrepo rsync -y | ||
mkdir -p /tmp/protoc | ||
pushd /tmp/protoc | ||
wget https://github.com/protocolbuffers/protobuf/releases/download/v3.12.3/protoc-3.12.3-linux-x86_64.zip | ||
unzip protoc-3.12.3-linux-x86_64.zip | ||
popd | ||
sudo chmod +x /tmp/protoc/bin/protoc | ||
sudo cp /tmp/protoc/bin/protoc /usr/bin/protoc | ||
sudo cp -r /tmp/protoc/include/* /usr/local/include/ | ||
sudo chmod -R 777 /usr/local/include/google | ||
sudo apt-get install autoconf automake libtool curl make g++ unzip -y | ||
go get -u github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway | ||
go get -u github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger | ||
go get -u github.com/golang/protobuf/protoc-gen-go | ||
go get github.com/kevinburke/go-bindata/... | ||
go get github.com/goreleaser/nfpm/cmd/nfpm@latest | ||
- name: Dist | ||
run: VERSION=${{ steps.get_version.outputs.VERSION }} make dist | ||
|
||
- name: Make DEB Repo | ||
run: | | ||
mkdir -p ./repo/deb/conf | ||
cp ./contrib/deb-repo-config ./repo/deb/conf/distributions | ||
cp ./dist/*.deb ./repo/deb | ||
reprepro -b ./repo/deb/ includedeb ovpm ./repo/deb/*.deb | ||
- name: Make RPM Repo | ||
run: | | ||
mkdir -p ./repo/rpm/ | ||
cp ./contrib/yumrepo.repo ./repo/rpm/ovpm.repo | ||
cp ./dist/*.rpm ./repo/rpm | ||
createrepo --database ./repo/rpm | ||
- name: Publish to GithubPages | ||
uses: JamesIves/[email protected] | ||
with: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
BRANCH: gh-pages | ||
FOLDER: repo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,9 @@ data_import/ | |
*.py[cod] | ||
production.conf | ||
credentialsrc | ||
coverage.txt | ||
bin/ | ||
bundle/ | ||
|
||
# C extensions | ||
.#* | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,67 @@ | ||
.PHONY: deps build | ||
.PHONY: deps build test bundle-webui clean-bundle bundle-swagger proto bundle build | ||
docker-build: | ||
docker run --rm -i -t -e TRAVIS_GO_VERSION=$(TRAVIS_GO_VERSION) -e TRAVIS_BUILD_NUMBER=$(TRAVIS_BUILD_NUMBER) -e TRAVIS_TAG=$(TRAVIS_TAG) -v `pwd`:/fs/src/github.com/cad/ovpm -w /fs/src/github.com/cad/ovpm cadthecoder/ovpm-builder:latest | ||
docker-build-shell: | ||
docker run --rm -i -t -e TRAVIS_GO_VERSION=$(TRAVIS_GO_VERSION) -e TRAVIS_BUILD_NUMBER=$(TRAVIS_BUILD_NUMBER) -e TRAVIS_TAG=$(TRAVIS_TAG) -v `pwd`:/fs/src/github.com/cad/ovpm -w /fs/src/github.com/cad/ovpm cadthecoder/ovpm-builder:latest /bin/bash | ||
|
||
deps: | ||
development-deps: | ||
# grpc related dependencies | ||
go get -u github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway | ||
go get -u github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger | ||
go get -u github.com/golang/protobuf/protoc-gen-go | ||
go get -u github.com/golang/protobuf/protoc-gen-go/... | ||
|
||
# static asset bundling | ||
go get github.com/kevinburke/go-bindata/... | ||
|
||
# for creating rpm, deb packages | ||
go get github.com/goreleaser/nfpm/cmd/nfpm@latest | ||
|
||
# webui related dependencies | ||
pacman -Sy npm | ||
pacman -Sy yarn | ||
|
||
# Runs unit tests. | ||
test: | ||
go test -count=1 -race -coverprofile=coverage.txt -covermode=atomic . | ||
|
||
proto: | ||
protoc -I/usr/local/include -I api/pb/ -I/usr/local/include -I$(shell go list -m -f "{{.Dir}}" github.com/grpc-ecosystem/grpc-gateway)/third_party/googleapis api/pb/user.proto api/pb/vpn.proto api/pb/network.proto api/pb/auth.proto --grpc-gateway_out=logtostderr=true:api/pb | ||
protoc -I/usr/local/include -I api/pb/ -I/usr/local/include -I$(shell go list -m -f "{{.Dir}}" github.com/grpc-ecosystem/grpc-gateway)/third_party/googleapis api/pb/user.proto api/pb/vpn.proto api/pb/network.proto api/pb/auth.proto --go_out=plugins=grpc:api/pb | ||
|
||
clean-bundle: | ||
@echo Cleaning up bundle/ | ||
rm -rf bundle/ | ||
mkdir -p bundle/ | ||
|
||
bundle-webui: | ||
@echo Bundling webui | ||
yarn --cwd webui/ovpm/ install | ||
yarn --cwd webui/ovpm/ build | ||
cp -r webui/ovpm/build/* bundle | ||
|
||
bundle-swagger: proto | ||
protoc -I/usr/local/include -I api/pb/ -I/usr/local/include -I$(shell go list -m -f "{{.Dir}}" github.com/grpc-ecosystem/grpc-gateway)/third_party/googleapis api/pb/user.proto api/pb/vpn.proto api/pb/network.proto api/pb/auth.proto --swagger_out=logtostderr=true:bundle | ||
|
||
bundle: clean-bundle bundle-webui bundle-swagger | ||
go-bindata -pkg bundle -o bundle/bindata.go bundle/... | ||
|
||
# Builds server and client binaries under ./bin folder. Accetps $VERSION env var. | ||
build: bundle | ||
@echo Building | ||
rm -rf bin/ | ||
mkdir -p bin/ | ||
#CGO_ENABLED=0 GOOS=linux go build -ldflags="-w -X 'github.com/cad/ovpm.Version=$(VERSION)' -extldflags '-static'" -o ./bin/ovpm ./cmd/ovpm | ||
#CGO_ENABLED=0 GOOS=linux go build -ldflags="-w -X 'github.com/cad/ovpm.Version=$(VERSION)' -extldflags '-static'" -o ./bin/ovpmd ./cmd/ovpmd | ||
|
||
# Link dynamically for now | ||
CGO_CFLAGS="-g -O2 -Wno-return-local-addr" go build -ldflags="-X 'github.com/cad/ovpm.Version=$(VERSION)'" -o ./bin/ovpm ./cmd/ovpm | ||
CGO_CFLAGS="-g -O2 -Wno-return-local-addr" go build -ldflags="-X 'github.com/cad/ovpm.Version=$(VERSION)'" -o ./bin/ovpmd ./cmd/ovpmd | ||
|
||
clean-dist: | ||
rm -rf dist/ | ||
mkdir -p dist/ | ||
|
||
# Builds rpm and dep packages under ./dist folder. Accepts $VERSION env var. | ||
dist: clean-dist build | ||
@echo Generating VERSION=$(VERSION) rpm and deb packages under dist/ | ||
nfpm pkg -t ./dist/ovpm.rpm | ||
nfpm pkg -t ./dist/ovpm.deb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.