Skip to content

Commit

Permalink
Refactor workflows etc (#39)
Browse files Browse the repository at this point in the history
Move GoReleaser from Drone to GitHub Actions.
Add 'make all' to workflows.
Move version details out to dedicated external package.
Various tooling updates.
  • Loading branch information
jlucktay authored Nov 7, 2021
1 parent b7f47fc commit 6cedcdc
Show file tree
Hide file tree
Showing 19 changed files with 309 additions and 130 deletions.
56 changes: 0 additions & 56 deletions .drone.yml

This file was deleted.

2 changes: 2 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
max_line_length = 120
tab_width = 2
trim_trailing_whitespace = true

# Go
Expand Down
11 changes: 11 additions & 0 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly

- package-ecosystem: gomod
directory: "/"
schedule:
interval: weekly
7 changes: 0 additions & 7 deletions .github/dependabot.yml

This file was deleted.

File renamed without changes.
56 changes: 56 additions & 0 deletions .github/workflows/go.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Go

on:
push:
branches:
- main
paths:
- "**.go"

pull_request:
branches:
- main
paths:
- "**.go"

permissions:
contents: read

jobs:
build:
name: Test and lint and build

strategy:
matrix:
go-version:
- 1.14.x
- 1.15.x
- 1.16.x
platform:
- ubuntu-latest
- macos-latest

runs-on: ${{ matrix.platform }}

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

- name: Check out code
uses: actions/checkout@v2

- name: Update 'make' and run 'make all' on Linux
if: ${{ matrix.platform == 'ubuntu-latest' }}
run: |
sudo apt-get update
sudo apt-get --only-upgrade install build-essential
make all
# Cannot use Docker on macOS runners: https://github.community/t/why-is-docker-not-installed-on-macos/17017
- name: Install 'make' and run 'make test' on macOS
if: ${{ matrix.platform == 'macos-latest' }}
run: |
brew install make
/usr/local/opt/make/libexec/gnubin/make test
30 changes: 30 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: goreleaser

on:
push:
tags:
- v*

permissions:
contents: write

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.16

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26 changes: 26 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,29 @@
# Created by https://www.toptal.com/developers/gitignore/api/go
# Edit at https://www.toptal.com/developers/gitignore?templates=go

### Go ###
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib

# Test binary, built with `go test -c`
*.test

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

# Dependency directories (remove the comment below to include it)
# vendor/

### Go Patch ###
/vendor/
/Godeps/

# End of https://www.toptal.com/developers/gitignore/api/go

# Binary
goppuku

Expand Down
3 changes: 2 additions & 1 deletion .golangci.yml → .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ issues:
- ^should have a package comment, unless it's in another file for this package$
max-issues-per-linter: 0
max-same-issues: 0
new-from-rev: origin/main

linters-settings:
dogsled:
Expand All @@ -21,7 +22,7 @@ linters-settings:
errorf: true

gci:
local-prefixes: go.jlucktay.dev/factorio-server-kit/goppuku
local-prefixes: go.jlucktay.dev/goppuku

goconst:
min-len: 3
Expand Down
41 changes: 41 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
builds:
- flags:
- -trimpath
- -v

ldflags:
- >
-X 'go.jlucktay.dev/version.buildDate={{ .Date }}'
-X 'go.jlucktay.dev/version.builtBy=GoReleaser'
-X 'go.jlucktay.dev/version.commit={{ .ShortCommit }}'
-X 'go.jlucktay.dev/version.executable={{ .ProjectName }}'
-X 'go.jlucktay.dev/version.version={{ .Version }}'
env:
- CGO_ENABLED=0

goos:
- linux
- windows
- darwin

# Set the modified timestamp on the output binary, typically you would do this to ensure a build was reproducible.
mod_timestamp: "{{ .CommitTimestamp }}"

archives:
- replacements:
"386": i386
amd64: x86_64
darwin: Darwin
linux: Linux
windows: Windows

snapshot:
name_template: "{{ incpatch .Version }}-next"

checksum:
name_template: checksums.txt
algorithm: sha256

changelog:
sort: asc
23 changes: 0 additions & 23 deletions .goreleaser.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"gopls": {
"local": "go.jlucktay.dev/goppuku"
"formatting.local": "go.jlucktay.dev/goppuku"
}
}
Loading

0 comments on commit 6cedcdc

Please sign in to comment.