Skip to content

Commit

Permalink
chore: Add generic CI workflows.
Browse files Browse the repository at this point in the history
  • Loading branch information
yonas committed Oct 18, 2024
1 parent a8cec36 commit 2cd466c
Show file tree
Hide file tree
Showing 19 changed files with 1,393 additions and 2 deletions.
16 changes: 16 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file

version: 2
updates:
- package-ecosystem: "cargo" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
5 changes: 5 additions & 0 deletions .github/linters/.jscpd.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"ignore": [
"**/.github/workflows/**"
]
}
40 changes: 40 additions & 0 deletions .github/workflows/changelog.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
name: Changelog

on:
push:
tags:
- "v*.*.*"

jobs:
changelog:
name: Generate and publish changelog
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Generate a changelog
uses: orhun/git-cliff-action@v4
id: git-cliff
with:
config: cliff.toml
args: --verbose --latest --strip header
env:
OUTPUT: CHANGES.md
GITHUB_REPO: ${{ github.repository }}

- name: Polish changelog
shell: bash
run: sed -i '1,2d' CHANGES.md

- name: Upload the changelog
uses: ncipollo/release-action@v1
with:
# draft: true
allowUpdates: true
bodyFile: CHANGES.md
44 changes: 44 additions & 0 deletions .github/workflows/linting.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
name: Linting

on:
workflow_call:
pull_request:
push:
branches:
- main

permissions:
contents: read
pull-requests: read
packages: read
statuses: write

jobs:
super-linter:
name: Super Linter
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Super-linter
uses: github/super-linter@latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

conventional_commits:
name: Check conventional commit compliance
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Conventional commit check
uses: cocogitto/cocogitto-action@main
30 changes: 30 additions & 0 deletions .github/workflows/testing.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
name: Tests

on: # yamllint disable-line rule:truthy
pull_request:
push:
branches:
- main

permissions:
contents: read
packages: read
statuses: write

jobs:
tests:
name: Run tests
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Build
run: task build

- name: Run tests
run: task test
79 changes: 79 additions & 0 deletions .goji.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
{
"noemoji": false,
"scopes": [
"home",
"accounts",
"ci"
],
"signoff": true,
"skipquestions": null,
"subjectmaxlength": 100,
"types": [
{
"emoji": "",
"code": ":sparkles:",
"description": "Introduce new features.",
"name": "feat"
},
{
"emoji": "🐛",
"code": ":bug:",
"description": "Fix a bug.",
"name": "fix"
},
{
"emoji": "📚",
"code": ":books:",
"description": "Documentation change.",
"name": "docs"
},
{
"emoji": "🎨",
"code": ":art:",
"description": "Improve structure/format of the code.",
"name": "refactor"
},
{
"emoji": "🧹",
"code": ":broom:",
"description": "A chore change.",
"name": "chore"
},
{
"emoji": "🧪",
"code": ":test_tube:",
"description": "Add a test.",
"name": "test"
},
{
"emoji": "🚑️",
"code": ":ambulance:",
"description": "Critical hotfix.",
"name": "hotfix"
},
{
"emoji": "⚰️",
"code": ":coffin:",
"description": "Remove dead code.",
"name": "deprecate"
},
{
"emoji": "⚡️",
"code": ":zap:",
"description": "Improve performance.",
"name": "perf"
},
{
"emoji": "🚧",
"code": ":construction:",
"description": "Work in progress.",
"name": "wip"
},
{
"emoji": "📦",
"code": ":package:",
"description": "Add or update compiled files or packages.",
"name": "package"
}
]
}
2 changes: 2 additions & 0 deletions .lefthook-local.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# If the path contains spaces, you need to quote it.
rc: '"${XDG_CONFIG_HOME:-$HOME/.config}/lefthookrc"'
36 changes: 36 additions & 0 deletions .lefthook.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
[pre-commit]
parallel = true

[pre-commit.commands.lint]
run = "just --timestamp lint"
glob = "*.go"
stage_fixed = true

[pre-commit.commands.format]
run = "just --timestamp format"
glob = "*.go"
stage_fixed = true

[pre-commit.commands.build]
run = "just --timestamp build"
glob = "*.go"

[pre-commit.commands.audit]
run = "just --timestamp audit"

#[commit-msg.commands.cog-verify]
#run = "cog verify -i '{1}'"

#[commit-msg.commands.cog-check]
#run = "cog check"

# Build commit message
[prepare-commit-msg.commands.commitzen]
interactive = true
run = "just --timestamp prepare-commit-msg {1}"
[commit-msg.commands.commitzen.env]
LEFTHOOK = 0

# Validate commit messages
[commit-msg.commands.commitzen]
run = "just --timestamp lint-commit-msg {1}"
76 changes: 76 additions & 0 deletions .woodpecker/default.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
when:
- event: push
branch: main

clone:
git:
image: /usr/local/bin/plugin-git
settings:
lfs: false

steps:
- name: date
image: sh
commands:
- date

- name: Self-check
image: sh
commands:
- task --list

- name: Setup
image: sh
environment:
GITEA_TOKEN:
from_secret: Gitea Token
secrets: [ "Gitea Token" ]
detach: true
commands:
- task setup

- name: Logs
image: sh
environment:
GITEA_TOKEN:
from_secret: Gitea Token
secrets: [ "Gitea Token" ]
detach: true
commands:
- task queue

- name: Testing
image: sh
environment:
GITEA_TOKEN:
from_secret: Gitea Token
secrets: [ "Gitea Token" ]
commands:
- task test

- name: Clean
image: sh
environment:
GITEA_TOKEN:
from_secret: Gitea Token
secrets: [ "Gitea Token" ]
commands:
- task teardown

- name: Build
image: sh
environment:
GITEA_TOKEN:
from_secret: Gitea Token
secrets: [ "Gitea Token" ]
commands:
- task build

- name: Upload packages
image: sh
environment:
GITEA_TOKEN:
from_secret: Gitea Token
secrets: [ "Gitea Token" ]
commands:
- task upload
46 changes: 44 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,44 @@
# generic-template
GitHub Actions, Woodpecker CI, and Lefthook pre-commit scripts
# Generic Template

GitHub Actions, Woodpecker CI, and Lefthook pre-commit scripts.

## Features
- GitHub Actions integration
- Woodpecker CI integration
- Lefthook pre-commit scripts
- just and go-task task runners
- pipelight CI pipelines
- goji commitizen commit message linting
- git-cliff keep-a-changelog changelog generator
- lychee dead link checker
- minijinja templating
- treefmt code formatting
- trivy and trufflehog security scanning
- venom and hurl test suites
- rspress and mdbook documentation sites
- abc and xyz todo list / kanban manager

## Install
- install just: `cargo install --git https://github.com/casey/just@latest`
- run `just install`

## Build

```sh
just build
```

## Dependencies
- hurl
- git-cliff
- goji
- just
- lychee
- lefthook
- minijinja
- pipelight
- task
- treefmt
- trivy
- trufflehog
- venom
4 changes: 4 additions & 0 deletions TODO.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# TODO

1. CLI todo list manager
2. CLI kanban tui
Loading

0 comments on commit 2cd466c

Please sign in to comment.