Skip to content

Commit

Permalink
Merge branch 'release/v0.2.8'
Browse files Browse the repository at this point in the history
  • Loading branch information
cad committed Jul 27, 2020
2 parents 78fc40b + 9000211 commit 9624e2b
Show file tree
Hide file tree
Showing 91 changed files with 14,453 additions and 12,973 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/go.yml
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
61 changes: 61 additions & 0 deletions .github/workflows/release.yml
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ data_import/
*.py[cod]
production.conf
credentialsrc
coverage.txt
bin/
bundle/

# C extensions
.#*
Expand Down
41 changes: 0 additions & 41 deletions .travis.yml

This file was deleted.

11 changes: 9 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
# Change Log

## [Unreleased](https://github.com/cad/ovpm/tree/HEAD)
## [v0.2.8](https://github.com/cad/ovpm/tree/v0.2.8)

[Full Changelog](https://github.com/cad/ovpm/compare/v0.2.6...HEAD)
- WebUI: dependency updates and switched to yarn (thanks to @drac) [\#92](https://github.com/cad/ovpm/pull/92)
- CI: switched to Github Actions
- Minor fixes.


## [v0.2.7](https://github.com/cad/ovpm/tree/v0.2.7)

[Full Changelog](https://github.com/cad/ovpm/compare/v0.2.6...v0.2.7)

**Implemented enhancements:**

Expand Down
62 changes: 58 additions & 4 deletions Makefile
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
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# OVPM - OpenVPN Management Server

[![Build Status](https://travis-ci.org/cad/ovpm.svg?branch=master)](https://travis-ci.org/cad/ovpm)
![Build Status](https://github.com/cad/ovpm/workflows/Go/badge.svg)
[![GitHub version](https://badge.fury.io/gh/cad%2Fovpm.svg)](https://badge.fury.io/gh/cad%2Fovpm)
[![codecov](https://codecov.io/gh/cad/ovpm/branch/master/graph/badge.svg)](https://codecov.io/gh/cad/ovpm)
[![GoDoc](https://godoc.org/github.com/cad/ovpm?status.svg)](https://godoc.org/github.com/cad/ovpm)
Expand Down Expand Up @@ -34,6 +34,8 @@ Here is a little demo of what it looks on terminal to init the server, create a

```bash
# Add YUM Repo
$ sudo yum install yum-utils -y
$ sudo yum install epel-release -y
$ sudo yum-config-manager --add-repo https://cad.github.io/ovpm/rpm/ovpm.repo

# Install OVPM
Expand Down
Loading

0 comments on commit 9624e2b

Please sign in to comment.