Skip to content

Commit

Permalink
Merge pull request #52 from PasteUs/dev
Browse files Browse the repository at this point in the history
Finish #49, #50, #12
  • Loading branch information
LucienShui authored Nov 23, 2019
2 parents 92639b8 + 498b33e commit 78cb828
Show file tree
Hide file tree
Showing 45 changed files with 604 additions and 439 deletions.
66 changes: 0 additions & 66 deletions .drone.yml

This file was deleted.

12 changes: 12 additions & 0 deletions .github/config/config.mysql.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"address": "0.0.0.0",
"port": 8000,
"database": {
"type": "mysql",
"username": "username",
"password": "password",
"server": "localhost",
"port": 4399,
"database": "pasteme"
}
}
12 changes: 12 additions & 0 deletions .github/config/config.sqlite3.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"address": "0.0.0.0",
"port": 8000,
"database": {
"type": "sqlite3",
"username": "username",
"password": "password",
"server": "localhost",
"port": 4399,
"database": "pasteme"
}
}
21 changes: 21 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name-template: 'release-v$NEXT_PATCH_VERSION'
tag-template: 'release-v$NEXT_PATCH_VERSION'
categories:
- title: 'Features'
labels:
- 'feature'
- 'enhancement'
- title: 'Bug Fixes'
labels:
- 'fix'
- 'bugfix'
- 'bug'
- title: 'Maintenance'
labels:
- 'chore'
- 'documentation'
change-template: '- $TITLE (#$NUMBER) @$AUTHOR'
template: |
# Changes
$CHANGES
File renamed without changes.
50 changes: 50 additions & 0 deletions .github/workflows/dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Publish for dev

on:
push:
branches:
- dev

jobs:

release:
if: github.repository == 'PasteUs/PasteMeGoBackend'
name: Build with go ${{ matrix.go_version }} on ${{ matrix.os }} and upload
runs-on: ${{ matrix.os }}

strategy:
matrix:
go_version: [1.13]
os: [ubuntu-latest]

steps:

- name: Set up Go ${{ matrix.go_version }}
uses: actions/setup-go@v1
with:
go-version: ${{ matrix.go_version }}
id: go

- name: Check out code into the Go module directory
uses: actions/checkout@v1

- name: Get dependencies
run: |
go get -v -t -d ./...
if [ -f Gopkg.toml ]; then
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
dep ensure
fi
- name: Build
run: |
GOARCH=amd64 GOOS=linux go build -v -o pastemed .
- name: Publish Docker
uses: LucienShui/[email protected]
with:
name: registry.cn-hangzhou.aliyuncs.com/pasteus/pasteme-go-backend:beta
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
registry: registry.cn-hangzhou.aliyuncs.com
dockerfile: Dockerfile
50 changes: 50 additions & 0 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Publish for master

on:
push:
branches:
- master

jobs:

release:
if: github.repository == 'PasteUs/PasteMeGoBackend'
name: Build with go ${{ matrix.go_version }} on ${{ matrix.os }} and upload
runs-on: ${{ matrix.os }}

strategy:
matrix:
go_version: [1.13]
os: [ubuntu-latest]

steps:

- name: Set up Go ${{ matrix.go_version }}
uses: actions/setup-go@v1
with:
go-version: ${{ matrix.go_version }}
id: go

- name: Check out code into the Go module directory
uses: actions/checkout@v1

- name: Get dependencies
run: |
go get -v -t -d ./...
if [ -f Gopkg.toml ]; then
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
dep ensure
fi
- name: Build
run: |
GOARCH=amd64 GOOS=linux go build -v -o pastemed .
- name: Publish Docker
uses: LucienShui/[email protected]
with:
name: registry.cn-hangzhou.aliyuncs.com/pasteus/pasteme-go-backend:latest
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
registry: registry.cn-hangzhou.aliyuncs.com
dockerfile: Dockerfile
17 changes: 17 additions & 0 deletions .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Release Drafter

on:
push:
branches:
- master

jobs:
draft_release:
if: github.repository == 'PasteUs/PasteMeGoBackend'
name: Draft release
runs-on: ubuntu-latest
steps:
- uses: toolmantim/[email protected]
name: Draft
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_PASSWORD }}
117 changes: 117 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
name: Go Test
on: [pull_request]
jobs:

build:
strategy:
matrix:
go_version: [1.12, 1.13]
os: [ubuntu-latest]

name: Build with go ${{ matrix.go_version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}

steps:
- name: Set up Go ${{ matrix.go_version }}
uses: actions/setup-go@v1
with:
go-version: ${{ matrix.go_version }}
id: go

- name: Check out code into the Go module directory
uses: actions/checkout@v1

- name: Get dependencies
run: |
go get -v -t -d ./...
if [ -f Gopkg.toml ]; then
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
dep ensure
fi
- name: Build
run: |
GOARCH=amd64 GOOS=linux go build -v -o pastemed .
test_with_mysql:
strategy:
matrix:
# go_version: [1.12, 1.13]
# remove 1.13 for https://github.com/golang/go/issues/31859
go_version: [1.12]
mysql_version: [5.5, 5.7, 8]
os: [ubuntu-latest]

name: Test with go ${{ matrix.go_version }} using mysql:${{ matrix.mysql_version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}

services:
mysql:
image: mysql:${{ matrix.mysql_version }}
env:
MYSQL_USER: username
MYSQL_PASSWORD: password
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: pasteme
ports:
- 4399:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3

steps:
- name: Set up Go ${{ matrix.go_version }}
uses: actions/setup-go@v1
with:
go-version: ${{ matrix.go_version }}
id: go

- name: Check out code into the Go module directory
uses: actions/checkout@v1

- name: Get dependencies
run: |
go get -v -t -d ./...
if [ -f Gopkg.toml ]; then
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
dep ensure
fi
- name: Test
run: |
rm -f pasteme.db server/pasteme.db
cp .github/config/config.mysql.json server/config.json
bash gotest.sh
test_with_sqlite3:
strategy:
matrix:
# go_version: [1.12, 1.13]
# remove 1.13 for https://github.com/golang/go/issues/31859
go_version: [1.12]
os: [ubuntu-latest]

name: Test with go ${{ matrix.go_version }} using sqlite3 on ${{ matrix.os }}
runs-on: ${{ matrix.os }}

steps:
- name: Set up Go ${{ matrix.go_version }}
uses: actions/setup-go@v1
with:
go-version: ${{ matrix.go_version }}
id: go

- name: Check out code into the Go module directory
uses: actions/checkout@v1

- name: Get dependencies
run: |
go get -v -t -d ./...
if [ -f Gopkg.toml ]; then
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
dep ensure
fi
- name: Test
run: |
rm -f pasteme.db server/pasteme.db
cp .github/config/config.sqlite3.json server/config.json
bash gotest.sh
Loading

0 comments on commit 78cb828

Please sign in to comment.