Skip to content

Commit

Permalink
chore: sync latest github workflows, settings, scans, and dev tooling (
Browse files Browse the repository at this point in the history
…#10)

Aligning repo with all default configuration:

- add tfplugindocs integration to generate readme on template
- pre-commit
- devcontainer (optional to use)
- default linting initialized in vscode
- github actions from standard actions
- renovate/mend integration
- mage tasks
  • Loading branch information
sheldonhull committed Sep 1, 2022
1 parent 3c0ab40 commit 192dcd8
Show file tree
Hide file tree
Showing 28 changed files with 1,242 additions and 61 deletions.
8 changes: 8 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export DIRENV_WARN_TIMEOUT='10s'
export DIRENV_LOG_FORMAT=""

source_env "$HOME"
source_env_if_exists ./env/.envrc
export PATH="${GOPATH}/bin:${PATH}"

export MAGEFILE_ENABLE_COLOR=1
87 changes: 86 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1,86 @@
* text eol=lf
# Prevents issues when working with multiple platforms as developers.
# For more useful information see this great article: https://www.aleksandrhovhannisyan.com/blog/crlf-vs-lf-normalizing-line-endings-in-git/
# Common settings that generally should always be used with your language specific settings
# CHECK FOR ISSUES: git ls-files --eol
# RESOLVE ISSUES: git add --renormalize .

# Auto detect text files and perform LF normalization
# https://www.davidlaing.com/2012/09/19/customise-your-gitattributes-to-become-a-git-ninja/
* text=auto eol=lf

#
# The above will handle all files NOT found below
#

# Documents
*.bibtex text diff=bibtex
*.doc diff=astextplain
*.DOC diff=astextplain
*.docx diff=astextplain
*.DOCX diff=astextplain
*.dot diff=astextplain
*.DOT diff=astextplain
*.pdf diff=astextplain
*.PDF diff=astextplain
*.rtf diff=astextplain
*.RTF diff=astextplain
*.md text diff=markdown
*.tex text diff=tex
*.adoc text
*.textile text
*.mustache text
*.csv text
*.tab text
*.tsv text
*.txt text
*.sql text

# Graphics
*.png binary
*.jpg binary
*.jpeg binary
*.gif binary
*.tif binary
*.tiff binary
*.ico binary
# SVG treated as text by default.
*.svg text
# If you want to treat it as binary,
# use the following line instead.
# *.svg binary
*.eps binary

# Scripts
*.bash text eol=lf
*.fish text eol=lf
*.sh text eol=lf
*.zsh text eol=lf
# These are explicitly windows files and should use crlf
*.bat text eol=crlf
*.cmd text eol=crlf
*.ps1 text eol=crlf

# Serialisation
*.json text
*.toml text
*.xml text
*.yaml text
*.yml text

# Archives
*.7z binary
*.gz binary
*.tar binary
*.tgz binary
*.zip binary

# Text files where line endings should be preserved
*.patch -text

#
# Exclude files from exporting
#

.gitattributes export-ignore
.gitignore export-ignore
.gitkeep export-ignore
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.github @DelineaXPM/dsv-admins
* @DelineaXPM/dsv-contributors
14 changes: 14 additions & 0 deletions .github/auto-assign.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
# Schema: https://github.com/kentaro-m/auto-assign-action
runOnDraft: true
addReviewers: true
addAssignees: author
numberOfReviewers: 0
reviewers:
reviewGroups:
useReviewGroups: false
# filterLabels:
# exclude:
# - wontmerge
# - wip
# - incomplete pr
25 changes: 25 additions & 0 deletions .github/workflows/assign.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
name: assign
on:
# pull_request: # For testing changes in branch
pull_request_target:
types: [opened, ready_for_review]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
assign:
name: assign
runs-on: ubuntu-latest
timeout-minutes: 5

permissions:
pull-requests: write
contents: read # Because it needs to read the configuration file
steps:
- uses: kentaro-m/auto-assign-action@60730395fd3afb76c7407e16cd4b144fbbcf28a6 # renovate: tag=v1
with:
configuration-path: .github/auto-assign.yml # Only needed if you use something other than .github/auto_assign.yml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
44 changes: 44 additions & 0 deletions .github/workflows/conventional-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
name: conventional-commit-pr-title
on:
pull_request_target:
# pull_request:
types:
- opened
- edited
- synchronize
jobs:
main:
name: conventional-commit-pr-title
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
pull-requests: read
steps:
- uses: amannn/action-semantic-pull-request@91682d013dea3ff257520b9b68c9cb93ced4fe9b # renovate: tag=v4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
types: |
feat
fix
chore
refactor
test
docs
style
perf
ci
build
revert
requireScope: false
subjectPattern: ^(?![A-Z]).+$
subjectPatternError: |
The subject "{subject}" found in the pull request title "{title}"
didn't match the configured pattern. Please ensure that the subject
doesn't start with an uppercase character.
ignoreLabels: |
ignore-semantic-pull-request
headerPattern: '^(\w*)(?:\(([\w$.\-*/ ]*)\))?: (.*)$'
headerPatternCorrespondence: type, scope, subject
wip: false # This requires elevated permissions, not using
23 changes: 23 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
name: lint
on:
pull_request:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
pull-requests: read
contents: read
jobs:
lint:
name: lint
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: checkout
uses: actions/checkout@v3
# Automatically caches for performance as well
# https://github.com/reviewdog/action-golangci-lint
- name: golangci-lint
uses: reviewdog/action-golangci-lint@70498f2d1f75a55ee9a4d719e74e21ed68aebea3 # renovate: tag=v2
28 changes: 28 additions & 0 deletions .github/workflows/stale.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
name: stale
on:
schedule:
- cron: 30 1 * * *

permissions:
issues: write
pull-requests: write

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
stale:
runs-on: ubuntu-latest
steps:
# Config Options: https://github.com/actions/stale#list-of-input-options
- uses: actions/stale@532554b8a8498a0e006fbcde824b048728c4178f # renovate: tag=v5
with:
days-before-stale: 30
days-before-close: 5
stale-issue-message: 🤖 This has been flagged as stale. If it is still relevant please post an update with context, otherwise this will shortly be closed. _You can always reopen a closed issue. This is not a permanent delete._
stale-pr-message: 🤖 This is being marked as stale due to no recent activity. Update to keep this open.
stale-issue-label: stale-issue
exempt-issue-labels: pinned
stale-pr-label: stale-pr
exempt-draft-pr: true
42 changes: 42 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
name: test
on:
pull_request:
push:
branches:
- main
tags:
- v*
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v3

# https://github.com/magnetikonline/action-golang-cache
- name: Setup Golang with cache
uses: magnetikonline/action-golang-cache@09043845c4b214830a4ae9eb6f5c61d3d3fd37b0 # renovate: tag=v3
with:
go-version-file: go.mod

- name: mage-tidy
uses: magefile/mage-action@5f7a9a23cfef763949ca41834b868167adbd1b59 # renovate: tag=v2
with:
version: latest
args: go:tidy

- name: mage-test
uses: magefile/mage-action@5f7a9a23cfef763949ca41834b868167adbd1b59 # renovate: tag=v2
with:
version: latest
args: go:testsum ./...
env:
# Race conditions will be hit due to the cli driven tasks and binaries being called.
GOTEST_DISABLE_RACE: 1
Loading

0 comments on commit 192dcd8

Please sign in to comment.