Skip to content

Commit

Permalink
normalize build / release with other repos
Browse files Browse the repository at this point in the history
  • Loading branch information
kmulvey committed May 10, 2024
1 parent afcf06e commit 205cd7d
Show file tree
Hide file tree
Showing 4 changed files with 176 additions and 83 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Build

on: push

jobs:
build:
name: imageupsizer build
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}

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

- name: Set up Go
uses: actions/setup-go@v5
with:
check-latest: true
cache: true
go-version: "1.22"

- name: Build & Test
run: |
go clean -r ./...
go mod tidy
go build -v -ldflags="-s -w" ./...
go test -v -race -count 1 -parallel 5 -covermode=atomic -coverprofile="coverage.out" ./...
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true # optional (default = false)

- name: golangci-lint
uses: golangci/golangci-lint-action@v4
with:
version: latest
args: --timeout=5m

- name: Govulncheck
uses: kmulvey/govulncheck-action@v1.2.0
33 changes: 33 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Release

on:
pull_request:
push:
# run only against tags
tags:
- "*"
jobs:
release:
name: imageupsizer release
runs-on: ubuntu-latest

steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v4
with:
fetch-depth: 0 # See: https://goreleaser.com/ci/actions/

- name: Set up Go
uses: actions/setup-go@v5
with:
check-latest: true
cache: true
go-version: "1.22"

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
version: latest
args: release --config .goreleaser.yaml --clean
env:
GITHUB_TOKEN: ${{ secrets.GO_RELEASER_GITHUB_TOKEN }}
68 changes: 0 additions & 68 deletions .github/workflows/release_build.yml

This file was deleted.

114 changes: 99 additions & 15 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -1,57 +1,141 @@
before:
hooks:
- go mod tidy

builds:

- id: imageupsizer
main: cmd/imageupsizer/main.go
main: ./cmd/imageupsizer
env:
- CGO_ENABLED=0
binary: imageupsizer
ldflags:
- -s -w -X main.build={{.Version}}
env:
- CGO_ENABLED=0
- -X go.szostok.io/version.version={{.Version}}
- -X go.szostok.io/version.buildDate={{.Date}}
goos:
- freebsd
- windows
- darwin
- linux
- js

goarch:
- amd64
- arm64

- id: manualmover
main: cmd/manual/main.go
binary: manualmover
- id: imageupsizer-manual
main: ./cmd/manual
env:
- CGO_ENABLED=0
binary: imageupsizer-manual
ldflags:
- -s -w -X main.build={{.Version}}
- -X go.szostok.io/version.version={{.Version}}
- -X go.szostok.io/version.buildDate={{.Date}}
goos:
- freebsd
- windows
- darwin
- linux
- js

goarch:
- amd64
- arm64

- id: imageupsizer-verify
main: ./cmd/verify
env:
- CGO_ENABLED=0
binary: imageupsizer-verify
ldflags:
- -s -w -X main.build={{.Version}}
- -X go.szostok.io/version.version={{.Version}}
- -X go.szostok.io/version.buildDate={{.Date}}
goos:
- freebsd
- windows
- darwin
- linux
- js

goarch:
- amd64
- arm64

archives:
- id: dist
- id: foo
name_template: >-
{{ .ProjectName }}_
{{- title .Os }}_
{{- if eq .Arch "amd64" }}x86_64
{{- else if eq .Arch "386" }}i386
{{- else }}{{ .Arch }}{{ end }}
checksum:
name_template: 'checksums.txt'

snapshot:
name_template: "{{ incpatch .Version }}-next"
changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'
name_template: "{{ incpatch .Version }}-snapshot"

nfpms:
# note that this is an array of nfpm configs
- # ID of the nfpm config, must be unique.
id: imageupsizer

package_name: imageupsizer

builds:
- imageupsizer
- imageupsizer-manual
- imageupsizer-verify

# Your app's vendor.
vendor: Kevin Mulvey

# Your app's homepage.
homepage: https://github.com/kmulvey/imageupsizer

# Your app's maintainer (probably you).
maintainer: Drummer <drum-roll@example.com>

# Your app's description.
description: |-
Automatically upscale images across multiple GPUs.
# Your app's license.
license: MIT

# Formats to be generated.
formats:
- apk
- deb
- rpm
- termux.deb
- archlinux

provides:
- imageupsizer
- imageupsizer-manual
- imageupsizer-verify

# Path that the binaries should be installed.
# Default: '/usr/bin'
bindir: /usr/bin

# Custom configuration applied only to the RPM packager.
rpm:
group: root
compression: lzma
# The package is signed if a key_file is set
#signature:
# PGP secret key file path (can also be ASCII-armored).
# The passphrase is taken from the environment variable
# `$NFPM_ID_RPM_PASSPHRASE` with a fallback to `$NFPM_ID_PASSPHRASE`,
# where ID is the id of the current nfpm config.
# The id will be transformed to uppercase.
# E.g. If your nfpm id is 'default' then the rpm-specific passphrase
# should be set as `$NFPM_DEFAULT_RPM_PASSPHRASE`
#
# Templates: allowed
#key_file: "/home/kmulvey/keys/sec.gpg"

0 comments on commit 205cd7d

Please sign in to comment.