-
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(build): various changes to build workflow
- Loading branch information
Showing
9 changed files
with
420 additions
and
58 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 @@ | ||
github: l3uddz |
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,18 @@ | ||
name: Remove old artifacts | ||
|
||
on: | ||
schedule: | ||
# Every day at 1am | ||
- cron: '0 1 * * *' | ||
|
||
jobs: | ||
remove-old-artifacts: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 10 | ||
|
||
steps: | ||
- name: Remove old artifacts | ||
uses: c-hive/gha-remove-artifacts@v1 | ||
with: | ||
age: '1 days' | ||
skip-tags: true |
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,80 @@ | ||
name: Build | ||
|
||
on: | ||
push: | ||
branches: | ||
- '*' | ||
tags: | ||
- 'v*' | ||
pull_request: | ||
types: | ||
- opened | ||
- reopened | ||
- edited | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
# checkout | ||
- name: checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
|
||
# setup go | ||
- name: go | ||
uses: actions/setup-go@v1 | ||
with: | ||
go-version: 1.14 | ||
- run: go version | ||
- run: go env | ||
|
||
# cache | ||
- name: cache | ||
uses: actions/cache@v1 | ||
with: | ||
path: vendor | ||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.os }}-go- | ||
# vendor | ||
- name: vendor | ||
run: | | ||
make vendor | ||
# build | ||
- name: build | ||
if: startsWith(github.ref, 'refs/tags/') == false | ||
run: | | ||
make snapshot | ||
# get tag name | ||
- name: tag_name | ||
if: startsWith(github.ref, 'refs/tags/') | ||
uses: olegtarasov/get-tag@v2 | ||
with: | ||
tagRegex: "v?(.+)" | ||
|
||
# publish | ||
- name: publish | ||
if: startsWith(github.ref, 'refs/tags/') | ||
env: | ||
TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
GITHUB_REF: ${{ github.ref }} | ||
run: | | ||
make publish | ||
# artifacts | ||
- name: artifact_linux | ||
uses: actions/upload-artifact@v2-preview | ||
with: | ||
name: build_linux | ||
path: dist/*linux* | ||
|
||
- name: artifact_darwin | ||
uses: actions/upload-artifact@v2-preview | ||
with: | ||
name: build_darwin | ||
path: dist/*darwin* |
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,14 @@ | ||
name: golangci-lint | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
golangci: | ||
name: lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: golangci-lint | ||
uses: golangci/golangci-lint-action@v1 | ||
with: | ||
version: v1.27 |
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,22 @@ | ||
run: | ||
timeout: 10m | ||
|
||
linters: | ||
enable: | ||
- bodyclose | ||
# - goimports | ||
- unconvert | ||
# - unparam | ||
- scopelint | ||
- dupl | ||
- interfacer | ||
- stylecheck | ||
|
||
issues: | ||
exclude-rules: | ||
- linters: | ||
- stylecheck | ||
text: "ST1003:" | ||
- linters: | ||
- scopelint | ||
text: 'Using the variable on range scope `tc` in function literal' |
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,63 @@ | ||
# https://goreleaser.com | ||
project_name: wantarr | ||
env: | ||
- GO111MODULE=on | ||
- CGO_ENABLED=1 | ||
|
||
# Build | ||
builds: | ||
- id: build_darwin | ||
env: | ||
- CC=o64-clang | ||
- CXX=o64-clang++ | ||
goos: | ||
- darwin | ||
goarch: | ||
- amd64 | ||
ldflags: | ||
- -s -w | ||
- -X "github.com/l3uddz/wantarr/build.Version={{ .Version }}" | ||
- -X "github.com/l3uddz/wantarr/build.GitCommit={{ .ShortCommit }}" | ||
- -X "github.com/l3uddz/wantarr/build.Timestamp={{ .Timestamp }}" | ||
flags: | ||
- -trimpath | ||
|
||
- id: build_linux | ||
goos: | ||
- linux | ||
goarch: | ||
- amd64 | ||
ldflags: | ||
- -linkmode external | ||
- -extldflags -static | ||
- -s -w | ||
- -X "github.com/l3uddz/wantarr/build.Version={{ .Version }}" | ||
- -X "github.com/l3uddz/wantarr/build.GitCommit={{ .ShortCommit }}" | ||
- -X "github.com/l3uddz/wantarr/build.Timestamp={{ .Timestamp }}" | ||
flags: | ||
- -trimpath | ||
- -tags=netgo | ||
- -v | ||
|
||
# Archive | ||
archives: | ||
- | ||
name_template: "{{ .ProjectName }}_v{{ .Version }}_{{ .Os }}_{{ .Arch }}" | ||
format: "binary" | ||
|
||
# Checksum | ||
checksum: | ||
name_template: "checksums.txt" | ||
algorithm: sha512 | ||
|
||
# Snapshot | ||
snapshot: | ||
name_template: "{{ .Major }}.{{ .Minor }}.{{ .Patch }}-dev+{{ .ShortCommit }}" | ||
|
||
# Changelog | ||
changelog: | ||
filters: | ||
exclude: | ||
- "^docs:" | ||
- "^test:" | ||
- "^Merge branch" |
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
Oops, something went wrong.