Skip to content

Commit

Permalink
Merge pull request #6 from bbkane/git-xargs/format-yaml
Browse files Browse the repository at this point in the history
Format yaml and add lint
  • Loading branch information
bbkane authored Nov 15, 2023
2 parents 36ec3cb + b93d4ee commit 2a4ce35
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 65 deletions.
30 changes: 14 additions & 16 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,3 @@
name: CI

on:
push:
branches:
- master
pull_request:
workflow_call:

permissions:
contents: read

jobs:
setup:
name: CI
Expand All @@ -18,18 +6,28 @@ jobs:
# https://github.com/marketplace/actions/checkout`
- name: Checkout Repo
uses: actions/checkout@v3

# https://github.com/marketplace/actions/setup-go-environment
- name: Set up Go 1.x >= 1.18
uses: actions/setup-go@v3
with:
go-version-file: go.mod
# requires go.sum file (i.e., external libraries)
cache: true

go-version-file: go.mod
# https://github.com/marketplace/actions/run-golangci-lint#how-to-use
- name: golangci-lint
uses: golangci/golangci-lint-action@v3

- name: go test
run: go test -v ./...
- name: Install yamllint
run: pip install yamllint
- name: Lint YAML files
run: yamllint .
name: CI
on: # yamllint disable-line rule:truthy
pull_request:
push:
branches:
- master
workflow_call:
permissions:
contents: read
32 changes: 14 additions & 18 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,38 +1,34 @@
name: Release

on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
permissions:
contents: write

jobs:
ci:
uses: ./.github/workflows/ci.yml
setup:
name: Release
runs-on: ubuntu-latest
needs: ci
runs-on: ubuntu-latest
steps:
# https://github.com/marketplace/actions/checkout`
- name: Checkout Repo
uses: actions/checkout@v3

# https://github.com/marketplace/actions/setup-go-environment
- name: Set up Go 1.x >= 1.18
uses: actions/setup-go@v3
with:
go-version-file: go.mod
# requires go.sum file (i.e., external libraries)
cache: true

go-version-file: go.mod
# https://github.com/marketplace/actions/goreleaser-action
- name: Run GoReleaser
- env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
KEY_GITHUB_GORELEASER_TO_HOMEBREW_TAP: ${{ secrets.KEY_GITHUB_GORELEASER_TO_HOMEBREW_TAP }}
name: Run GoReleaser
uses: goreleaser/goreleaser-action@v3
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
KEY_GITHUB_GORELEASER_TO_HOMEBREW_TAP: ${{ secrets.KEY_GITHUB_GORELEASER_TO_HOMEBREW_TAP }}
version: latest
name: Release
on: # yamllint disable-line rule:truthy
push:
tags:
- v[0-9]+.[0-9]+.[0-9]+
permissions:
contents: write
56 changes: 28 additions & 28 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,49 +6,49 @@ before:
- go mod download
# you may remove this if you don't need go generate
# - go generate ./...
# https://goreleaser.com/customization/homebrew/
brews:
- caveats: |
Unfortunately, Apple wants to charge developers $100/year to distribute
their apps without a big scary "... the developer cannot be verified"
warning. I'm not willing to pay that to give away free apps.
See https://www.macworld.com/article/3140183/how-to-install-an-app-in-macos-sierra-thats-not-signed-by-a-developer.html to work around that
description: GNU Stow alternative for dotfiles
folder: Formula
homepage: https://github.com/bbkane/fling
tap:
name: homebrew-tap
owner: bbkane
# Optionally a token can be provided, if it differs from the token provided to GoReleaser
token: '{{ .Env.KEY_GITHUB_GORELEASER_TO_HOMEBREW_TAP }}'
builds:
- env:
- CGO_ENABLED=0
goos:
- linux
- windows
- darwin
goarch:
- amd64
- arm
- arm64
# - i386 # does anyone care about i386?
goos:
- linux
- windows
- darwin
ldflags:
- -s -w -X main.version=v{{.Version}} -X main.commit={{.Commit}} -X main.date={{.Date}} -X main.builtBy=goreleaser
checksum:
name_template: "checksums.txt"
changelog:
sort: asc
filters:
exclude:
- "^docs:"
- "^test:"
# https://goreleaser.com/customization/homebrew/
brews:
- tap:
owner: bbkane
name: homebrew-tap
# Optionally a token can be provided, if it differs from the token provided to GoReleaser
token: "{{ .Env.KEY_GITHUB_GORELEASER_TO_HOMEBREW_TAP }}"
folder: Formula
caveats: |
Unfortunately, Apple wants to charge developers $100/year to distribute
their apps without a big scary "... the developer cannot be verified"
warning. I'm not willing to pay that to give away free apps.
See https://www.macworld.com/article/3140183/how-to-install-an-app-in-macos-sierra-thats-not-signed-by-a-developer.html to work around that
homepage: "https://github.com/bbkane/fling"
description: "GNU Stow alternative for dotfiles"
- '^docs:'
- '^test:'
sort: asc
checksum:
name_template: checksums.txt
# https://goreleaser.com/customization/scoop/
scoop:
bucket:
owner: bbkane
name: scoop-bucket
token: "{{ .Env.KEY_GITHUB_GORELEASER_TO_HOMEBREW_TAP }}"
description: "fling computes and creates/removes the minimal amount of symlinks needed in a directory to refer to files and directories in another directory, similar to GNU Stow. I use fling to manage my dotfiles"
homepage: "https://github.com/bbkane/fling"
owner: bbkane
token: '{{ .Env.KEY_GITHUB_GORELEASER_TO_HOMEBREW_TAP }}'
description: fling computes and creates/removes the minimal amount of symlinks needed in a directory to refer to files and directories in another directory, similar to GNU Stow. I use fling to manage my dotfiles
homepage: https://github.com/bbkane/fling
license: MIT
11 changes: 11 additions & 0 deletions .yamllint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
extends: default
rules:
comments:
ignore-shebangs: true
min-spaces-from-content: 1
require-starting-space: true
document-start: disable
key-duplicates: disable
key-ordering: enable
line-length: disable
trailing-spaces: disable
8 changes: 5 additions & 3 deletions lefthook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@
# https://github.com/evilmartians/lefthook/blob/master/docs/configuration.md

pre-commit:
parallel: true
commands:
golangci-lint:
run: golangci-lint run
go-test:
run: go test ./...
golangci-lint:
run: golangci-lint run
yamllint:
run: yamllint .
parallel: true

0 comments on commit 2a4ce35

Please sign in to comment.