Skip to content

Switch to Github Actions with auto binary release #128

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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 0 additions & 61 deletions .circleci/config.yml

This file was deleted.

32 changes: 32 additions & 0 deletions .github/goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# test this file with
# goreleaser --skip-publish --rm-dist --config .github/goreleaser.yml
builds:
- main: .
env:
- CGO_ENABLED=0
ldflags:
- -s -w -X main.version={{.Version}}
goos:
- linux
- darwin
- windows
goarch:
- amd64
- arm
- arm64
- 386
goarm:
- 6
- 7
archives:
- format: gz
files:
- none*
release:
prerelease: auto
changelog:
sort: asc
filters:
exclude:
- "^docs:"
- "^test:"
61 changes: 61 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: CI
on:
pull_request: {}
push: {}
workflow_dispatch:
inputs: {}
jobs:
# ================
# TEST JOB
# ================
test:
name: Test
strategy:
matrix:
go-version: [1.18.x, 1.19.x]
platform: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.platform }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go-version }}
check-latest: true
cache: true
- name: Build
run: go build -v .
- name: Test
run: go test -v ./...
# ================
# RELEASE JOB
# runs after a success test
# only runs on push "v*" tag
# ================
release:
name: Release
needs: test
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: '1.19'
check-latest: true
cache: true
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v3
with:
distribution: goreleaser
version: latest
args: release --rm-dist --config .github/goreleaser.yml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
19 changes: 0 additions & 19 deletions Godeps/Godeps.json

This file was deleted.

5 changes: 0 additions & 5 deletions Godeps/Readme

This file was deleted.

8 changes: 8 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module github.com/ddollar/forego

go 1.17

require (
github.com/daviddengcn/go-colortext v0.0.0-20150719211842-3b18c8575a43
github.com/subosito/gotenv v0.1.0
)
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
github.com/daviddengcn/go-colortext v0.0.0-20150719211842-3b18c8575a43 h1:WOjNHsegRa6W+i7+V0g9GlGTKj5c2CzvENZBOYLYxMQ=
github.com/daviddengcn/go-colortext v0.0.0-20150719211842-3b18c8575a43/go.mod h1:dv4zxwHi5C/8AeI+4gX4dCWOIvNi7I6JCSX0HvlKPgE=
github.com/subosito/gotenv v0.1.0 h1:qrPfMw+dkLrA77HtD6S3ppWB9JjV8jhKMmeSpnuvd3Q=
github.com/subosito/gotenv v0.1.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw=
8 changes: 4 additions & 4 deletions start_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ func TestPortFromEnv(t *testing.T) {
os.Setenv("PORT", "4000")
port, err = basePort(env)
if err != nil {
t.Fatal("Can not get port: %s", err)
t.Fatalf("Can not get port: %s", err)
}
if port != 4000 {
t.Fatal("Base port should be 4000")
Expand Down Expand Up @@ -162,14 +162,14 @@ func TestConfigBeOverrideByForegoFile(t *testing.T) {
}

if port != 15000 {
t.Fatal("port should be 15000, got %d", port)
t.Fatalf("port should be 15000, got %d", port)
}

if concurrency != "foo=2,bar=3" {
t.Fatal("concurrency should be 'foo=2,bar=3', got %s", concurrency)
t.Fatalf("concurrency should be 'foo=2,bar=3', got %s", concurrency)
}

if gracetime != 30 {
t.Fatal("gracetime should be 3, got %d", gracetime)
t.Fatalf("gracetime should be 3, got %d", gracetime)
}
}
22 changes: 0 additions & 22 deletions vendor/github.com/daviddengcn/go-colortext/.gitignore

This file was deleted.

27 changes: 0 additions & 27 deletions vendor/github.com/daviddengcn/go-colortext/LICENSE

This file was deleted.

21 changes: 0 additions & 21 deletions vendor/github.com/daviddengcn/go-colortext/README.md

This file was deleted.

47 changes: 0 additions & 47 deletions vendor/github.com/daviddengcn/go-colortext/ct.go

This file was deleted.

35 changes: 0 additions & 35 deletions vendor/github.com/daviddengcn/go-colortext/ct_ansi.go

This file was deleted.

Loading