Skip to content

Commit

Permalink
Merge pull request #10 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 cfc11c0 + fb30cd4 commit 5a64ca7
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 64 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
54 changes: 27 additions & 27 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,47 +6,47 @@ 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: Save GitHub Starred Repo Information
folder: Formula
homepage: https://github.com/bbkane/starghaze
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
goarch:
- amd64
# - i386 # does anyone care about i386?
goos:
- linux
- windows
- darwin
goarch:
- amd64
# - i386 # does anyone care about i386?
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/starghaze"
description: "Save GitHub Starred Repo Information"
- '^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: "Save information about your GitHub starred repos into Google Sheets, Zinc, and SQLite!"
homepage: "https://github.com/bbkane/starghaze"
owner: bbkane
token: '{{ .Env.KEY_GITHUB_GORELEASER_TO_HOMEBREW_TAP }}'
description: Save information about your GitHub starred repos into Google Sheets, Zinc, and SQLite!
homepage: https://github.com/bbkane/starghaze
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 5a64ca7

Please sign in to comment.