mirror of
https://codeberg.org/Codeberg-CI/examples.git
synced 2025-09-10 12:24:54 -04:00
Linters and related fixes (#39)
- Add yamllint - Add markdownlint - Add precommit config - Add editorconfig - Rename `.yml` to `.yaml` - Add CI workflow to enforce lint rules Configs are taken from Woodpecker org lint rules. Reviewed-on: https://codeberg.org/Codeberg-CI/examples/pulls/39 Co-authored-by: pat-s <patrick.schratz@gmail.com> Co-committed-by: pat-s <patrick.schratz@gmail.com>
This commit is contained in:
parent
73ef96d755
commit
8df9d19ef4
10
.editorconfig
Normal file
10
.editorconfig
Normal file
@ -0,0 +1,10 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
tab_width = 2
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
60
.gitignore
vendored
Normal file
60
.gitignore
vendored
Normal file
@ -0,0 +1,60 @@
|
||||
# File created using '.gitignore Generator' for Visual Studio Code: https://bit.ly/vscode-gig
|
||||
# Created by https://www.toptal.com/developers/gitignore/api/visualstudiocode,macos
|
||||
# Edit at https://www.toptal.com/developers/gitignore?templates=visualstudiocode,macos
|
||||
|
||||
### macOS ###
|
||||
# General
|
||||
.DS_Store
|
||||
.AppleDouble
|
||||
.LSOverride
|
||||
|
||||
# Icon must end with two \r
|
||||
Icon
|
||||
|
||||
|
||||
# Thumbnails
|
||||
._*
|
||||
|
||||
# Files that might appear in the root of a volume
|
||||
.DocumentRevisions-V100
|
||||
.fseventsd
|
||||
.Spotlight-V100
|
||||
.TemporaryItems
|
||||
.Trashes
|
||||
.VolumeIcon.icns
|
||||
.com.apple.timemachine.donotpresent
|
||||
|
||||
# Directories potentially created on remote AFP share
|
||||
.AppleDB
|
||||
.AppleDesktop
|
||||
Network Trash Folder
|
||||
Temporary Items
|
||||
.apdisk
|
||||
|
||||
### macOS Patch ###
|
||||
# iCloud generated files
|
||||
*.icloud
|
||||
|
||||
### VisualStudioCode ###
|
||||
.vscode/*
|
||||
!.vscode/settings.json
|
||||
!.vscode/tasks.json
|
||||
!.vscode/launch.json
|
||||
!.vscode/extensions.json
|
||||
!.vscode/*.code-snippets
|
||||
|
||||
# Local History for Visual Studio Code
|
||||
.history/
|
||||
|
||||
# Built Visual Studio Code Extensions
|
||||
*.vsix
|
||||
|
||||
### VisualStudioCode Patch ###
|
||||
# Ignore all local history of files
|
||||
.history
|
||||
.ionide
|
||||
|
||||
# End of https://www.toptal.com/developers/gitignore/api/visualstudiocode,macos
|
||||
|
||||
# Custom rules (everything added below won't be overriden by 'Generate .gitignore File' if you use 'Update' option)
|
||||
|
143
.markdownlint.yaml
Normal file
143
.markdownlint.yaml
Normal file
@ -0,0 +1,143 @@
|
||||
# markdownlint YAML configuration
|
||||
# https://github.com/DavidAnson/markdownlint/blob/main/schema/.markdownlint.yaml
|
||||
|
||||
# Default state for all rules
|
||||
default: true
|
||||
|
||||
# Path to configuration file to extend
|
||||
extends: null
|
||||
|
||||
# MD003/heading-style/header-style - Heading style
|
||||
MD003:
|
||||
# Heading style
|
||||
style: 'atx'
|
||||
|
||||
# MD004/ul-style - Unordered list style
|
||||
MD004:
|
||||
style: 'dash'
|
||||
|
||||
# MD007/ul-indent - Unordered list indentation
|
||||
MD007:
|
||||
# Spaces for indent
|
||||
indent: 2
|
||||
# Whether to indent the first level of the list
|
||||
start_indented: false
|
||||
|
||||
# MD009/no-trailing-spaces - Trailing spaces
|
||||
MD009:
|
||||
# Spaces for line break
|
||||
br_spaces: 2
|
||||
# Allow spaces for empty lines in list items
|
||||
list_item_empty_lines: false
|
||||
# Include unnecessary breaks
|
||||
strict: false
|
||||
|
||||
# MD010/no-hard-tabs - Hard tabs
|
||||
MD010:
|
||||
# Include code blocks
|
||||
code_blocks: true
|
||||
|
||||
# MD012/no-multiple-blanks - Multiple consecutive blank lines
|
||||
MD012:
|
||||
# Consecutive blank lines
|
||||
maximum: 1
|
||||
|
||||
# MD013/line-length - Line length
|
||||
MD013:
|
||||
# Number of characters
|
||||
line_length: 500
|
||||
# Number of characters for headings
|
||||
heading_line_length: 100
|
||||
# Number of characters for code blocks
|
||||
code_block_line_length: 80
|
||||
# Include code blocks
|
||||
code_blocks: false
|
||||
# Include tables
|
||||
tables: false
|
||||
# Include headings
|
||||
headings: true
|
||||
# Include headings
|
||||
headers: true
|
||||
# Strict length checking
|
||||
strict: false
|
||||
# Stern length checking
|
||||
stern: false
|
||||
|
||||
# MD022/blanks-around-headings/blanks-around-headers - Headings should be surrounded by blank lines
|
||||
MD022:
|
||||
# Blank lines above heading
|
||||
lines_above: 1
|
||||
# Blank lines below heading
|
||||
lines_below: 1
|
||||
|
||||
# MD024/no-duplicate-heading/no-duplicate-header - Multiple headings with the same content
|
||||
MD024:
|
||||
# Only check sibling headings
|
||||
allow_different_nesting: true
|
||||
|
||||
# MD025/single-title/single-h1 - Multiple top-level headings in the same document
|
||||
MD025:
|
||||
# Heading level
|
||||
level: 1
|
||||
# RegExp for matching title in front matter
|
||||
front_matter_title: "^\\s*title\\s*[:=]"
|
||||
|
||||
# MD026/no-trailing-punctuation - Trailing punctuation in heading
|
||||
MD026:
|
||||
# Punctuation characters
|
||||
punctuation: '.,;:!。,;:!'
|
||||
|
||||
# MD029/ol-prefix - Ordered list item prefix
|
||||
MD029:
|
||||
# List style
|
||||
style: 'one_or_ordered'
|
||||
|
||||
# MD030/list-marker-space - Spaces after list markers
|
||||
MD030:
|
||||
# Spaces for single-line unordered list items
|
||||
ul_single: 1
|
||||
# Spaces for single-line ordered list items
|
||||
ol_single: 1
|
||||
# Spaces for multi-line unordered list items
|
||||
ul_multi: 1
|
||||
# Spaces for multi-line ordered list items
|
||||
ol_multi: 1
|
||||
|
||||
# MD033/no-inline-html - Inline HTML
|
||||
MD033:
|
||||
# Allowed elements
|
||||
allowed_elements: [details, summary, img, a, br, p]
|
||||
|
||||
# MD035/hr-style - Horizontal rule style
|
||||
MD035:
|
||||
# Horizontal rule style
|
||||
style: '---'
|
||||
|
||||
# MD036/no-emphasis-as-heading/no-emphasis-as-header - Emphasis used instead of a heading
|
||||
MD036:
|
||||
# Punctuation characters
|
||||
punctuation: '.,;:!?。,;:!?'
|
||||
|
||||
# MD041/first-line-heading/first-line-h1 - First line in a file should be a top-level heading
|
||||
MD041:
|
||||
# Heading level
|
||||
level: 1
|
||||
# RegExp for matching title in front matter
|
||||
front_matter_title: "^\\s*title\\s*[:=]"
|
||||
|
||||
# MD044/proper-names - Proper names should have the correct capitalization
|
||||
MD044:
|
||||
# List of proper names
|
||||
# names:
|
||||
# Include code blocks
|
||||
code_blocks: false
|
||||
|
||||
# MD046/code-block-style - Code block style
|
||||
MD046:
|
||||
# Block style
|
||||
style: 'fenced'
|
||||
|
||||
# MD048/code-fence-style - Code fence style
|
||||
MD048:
|
||||
# Code fence style
|
||||
style: 'backtick'
|
31
.pre-commit-config.yaml
Normal file
31
.pre-commit-config.yaml
Normal file
@ -0,0 +1,31 @@
|
||||
# cSpell:ignore checkmake hadolint autofix autoupdate
|
||||
repos:
|
||||
- repo: meta
|
||||
hooks:
|
||||
- id: check-hooks-apply
|
||||
- id: check-useless-excludes
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: v4.5.0
|
||||
hooks:
|
||||
- id: end-of-file-fixer
|
||||
- id: trailing-whitespace
|
||||
- repo: https://github.com/igorshubovych/markdownlint-cli
|
||||
rev: v0.38.0
|
||||
hooks:
|
||||
- id: markdownlint
|
||||
- repo: https://github.com/pre-commit/mirrors-prettier
|
||||
rev: v3.1.0
|
||||
hooks:
|
||||
- id: prettier
|
||||
- repo: https://github.com/adrienverge/yamllint.git
|
||||
rev: v1.33.0
|
||||
hooks:
|
||||
- id: yamllint
|
||||
args: [--strict, -c=.yamllint.yaml]
|
||||
- repo: local
|
||||
hooks:
|
||||
- id: yaml-file-extension
|
||||
name: Check if YAML files has *.yaml extension.
|
||||
entry: YAML filenames must have .yaml extension.
|
||||
language: fail
|
||||
files: .yml$
|
28
.woodpecker.yaml
Normal file
28
.woodpecker.yaml
Normal file
@ -0,0 +1,28 @@
|
||||
steps:
|
||||
editor-config:
|
||||
image: mstruebing/editorconfig-checker:2.7.2
|
||||
depends_on: []
|
||||
|
||||
woodpecker-cli:
|
||||
depends_on: []
|
||||
image: woodpeckerci/woodpecker-cli:v2.2.2-alpine
|
||||
commands:
|
||||
- woodpecker-cli lint C/
|
||||
- woodpecker-cli lint Docker/
|
||||
- woodpecker-cli lint Golang/
|
||||
- woodpecker-cli lint Hugo/
|
||||
- woodpecker-cli lint Jekyll/.woodpecker/jekyll.yaml
|
||||
- woodpecker-cli lint KiCad/.woodpecker.yaml
|
||||
- woodpecker-cli lint Mdbook/
|
||||
- woodpecker-cli lint NodeJS/
|
||||
- woodpecker-cli lint Python/
|
||||
- woodpecker-cli lint Rust/
|
||||
- woodpecker-cli lint StandardML/
|
||||
- woodpecker-cli lint Tectonic/
|
||||
- woodpecker-cli lint Typst/
|
||||
|
||||
yamllint:
|
||||
depends_on: []
|
||||
image: cytopia/yamllint:alpine-1
|
||||
commands:
|
||||
- yamllint --strict -c=.yamllint.yaml .
|
@ -1,21 +0,0 @@
|
||||
steps:
|
||||
editor-config:
|
||||
image: mstruebing/editorconfig-checker
|
||||
group: lint
|
||||
|
||||
woodpecker-cli:
|
||||
group: lint
|
||||
image: woodpeckerci/woodpecker-cli:next-alpine
|
||||
commands:
|
||||
- woodpecker-cli lint golang/*.yml
|
||||
- woodpecker-cli lint Docker/*.yml
|
||||
- woodpecker-cli lint Hugo/*.yml
|
||||
- woodpecker-cli lint Jekyll/jekyll.yml
|
||||
- woodpecker-cli lint C/*.yml
|
||||
- woodpecker-cli lint Rust/
|
||||
- woodpecker-cli lint Python/
|
||||
- woodpecker-cli lint StandardML/
|
||||
- woodpecker-cli lint tectonic/
|
||||
- woodpecker-cli lint NodeJS/11ty.yml
|
||||
- woodpecker-cli lint KiCad/kibot.yml
|
||||
- woodpecker-cli lint mdbook/*.yml
|
9
.yamllint.yaml
Normal file
9
.yamllint.yaml
Normal file
@ -0,0 +1,9 @@
|
||||
extends: default
|
||||
|
||||
ignore-from-file:
|
||||
- .gitignore
|
||||
|
||||
rules:
|
||||
line-length: disable
|
||||
document-start: disable
|
||||
comments: disable
|
@ -4,7 +4,7 @@ steps:
|
||||
# this step gets ran on "master" and "dev" branch.
|
||||
# also runs on pull requests targeting these branch.
|
||||
when:
|
||||
branch: [ master, dev ]
|
||||
branch: [master, dev]
|
||||
commands: |
|
||||
# alpine uses build-base for dev utilies such as system headers, make etc.
|
||||
apk add --no-cache build-base gcc >/dev/null
|
@ -13,7 +13,7 @@ steps:
|
||||
# this step gets run on "master" and "dev" branches.
|
||||
# also runs on pull requests targeting these branches.
|
||||
when:
|
||||
branch: [ master, dev ]
|
||||
branch: [master, dev]
|
||||
commands: |
|
||||
# Possible profiles:
|
||||
# android-arm64-v8a.txt
|
@ -15,7 +15,7 @@ steps:
|
||||
# this step gets run on "master" and "dev" branches.
|
||||
# also runs on pull requests targeting these branches.
|
||||
when:
|
||||
branch: [ master, dev ]
|
||||
branch: [master, dev]
|
||||
commands: |
|
||||
mkdir build && cd build
|
||||
meson ..
|
@ -1,10 +1,10 @@
|
||||
# Replace 'APPLICATIONNAME' with the name of your golang project
|
||||
|
||||
FROM golang:1.17 AS certs
|
||||
FROM golang AS certs
|
||||
|
||||
FROM scratch
|
||||
|
||||
# copy certs from golang:1.17 image
|
||||
# copy certs from golang image
|
||||
COPY --from=certs /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
|
||||
|
||||
# Copy prebuild Go binary into container
|
@ -1,8 +1,7 @@
|
||||
steps:
|
||||
# Builds your Go application
|
||||
build:
|
||||
# Set your preferred Go version:
|
||||
image: golang:1.17
|
||||
image: golang
|
||||
environment:
|
||||
# Needed if you want to cross-compile and package the binary in a container.
|
||||
- CGO_ENABLED=0
|
@ -1,6 +1,6 @@
|
||||
steps:
|
||||
build:
|
||||
image: golang:1.17
|
||||
image: golang
|
||||
commands:
|
||||
- go get
|
||||
- go build
|
@ -30,12 +30,12 @@ steps:
|
||||
commands:
|
||||
- hugo --minify
|
||||
when:
|
||||
event: [ pull_request, push ]
|
||||
event: [pull_request, push]
|
||||
|
||||
publish:
|
||||
image: bitnami/git
|
||||
# Must be set in Woodpecker configuration
|
||||
secrets: [ mail, codeberg_token ]
|
||||
secrets: [mail, codeberg_token]
|
||||
environment:
|
||||
- HUGO_OUTPUT=public
|
||||
commands:
|
@ -3,7 +3,7 @@ url: https://www.myjekyllsite.TLD
|
||||
description: This is a beautiful page.
|
||||
remote_theme: pages-themes/cayman@v0.2.0
|
||||
plugins:
|
||||
- jekyll-remote-theme # add this line to the plugins list if you already have one
|
||||
- jekyll-remote-theme # add this line to the plugins list if you already have one
|
||||
# The keep_files are needed to preserve git metadata when building
|
||||
keep_files: [ .domains, LICENSE, .git, .gitignore ]
|
||||
exclude: [ domains ]
|
||||
keep_files: [.domains, LICENSE, .git, .gitignore]
|
||||
exclude: [domains]
|
@ -23,7 +23,7 @@ steps:
|
||||
build:
|
||||
# Use the official jekyll build container
|
||||
image: jekyll/jekyll
|
||||
secrets: [ cbtoken, cbmail ]
|
||||
secrets: [cbtoken, cbmail]
|
||||
commands:
|
||||
# Avoid permission denied errors
|
||||
- chmod -R a+w .
|
@ -14,8 +14,7 @@ preflight:
|
||||
# you can use this to raise errors in DRC or ERC
|
||||
|
||||
outputs:
|
||||
|
||||
- name: 'gerbers'
|
||||
- name: "gerbers"
|
||||
comment: "Gerbers for production"
|
||||
type: gerber
|
||||
dir: kibot/gerber
|
||||
@ -39,14 +38,14 @@ outputs:
|
||||
- from_output: "gerber-drill"
|
||||
dest: /
|
||||
|
||||
- name: 'ibom'
|
||||
type: 'ibom'
|
||||
- name: "ibom"
|
||||
type: "ibom"
|
||||
comment: "ibom for your convenience"
|
||||
dir: kibot
|
||||
|
||||
- name: 'schematic-pdf'
|
||||
comment: 'schematic for your convenience'
|
||||
type: 'pdf_sch_print'
|
||||
- name: "schematic-pdf"
|
||||
comment: "schematic for your convenience"
|
||||
type: "pdf_sch_print"
|
||||
dir: kibot
|
||||
|
||||
- name: "production-files"
|
||||
|
@ -17,7 +17,7 @@ clone:
|
||||
|
||||
when:
|
||||
branch: master
|
||||
event: [ push, cron ]
|
||||
event: [push, cron]
|
||||
|
||||
steps:
|
||||
build:
|
||||
@ -27,7 +27,7 @@ steps:
|
||||
|
||||
publish:
|
||||
image: bitnami/git
|
||||
secrets: [ mail, codeberg_token ]
|
||||
secrets: [mail, codeberg_token]
|
||||
environment:
|
||||
- MDBOOK_OUTPUT=book
|
||||
commands:
|
@ -25,7 +25,7 @@ steps:
|
||||
build:
|
||||
# Use the official jekyll build container
|
||||
image: node
|
||||
secrets: [ cbtoken, cbmail, cbusername, sourcerepo, destrepo ]
|
||||
secrets: [cbtoken, cbmail, cbusername, sourcerepo, destrepo]
|
||||
commands:
|
||||
# Avoid permission denied errors
|
||||
- chmod -R a+w .
|
@ -1,9 +1,7 @@
|
||||
|
||||
# This config shows how to handle Python-CI focusing on code quality
|
||||
# was taken from https://codeberg.org/sail.black/serial-sphinx/src/branch/main/.woodpecker.yml
|
||||
# check there for license information
|
||||
|
||||
|
||||
steps:
|
||||
standardize:
|
||||
image: python:3.9-buster
|
||||
@ -32,12 +30,9 @@ steps:
|
||||
- python -m pip install -r requirements.txt
|
||||
- pytest tests/
|
||||
|
||||
|
||||
|
||||
matrix:
|
||||
TAG:
|
||||
- 3.7
|
||||
- 3.9
|
||||
- 3.8
|
||||
- 3.10
|
||||
|
@ -26,7 +26,7 @@ steps:
|
||||
|
||||
publish:
|
||||
image: bitnami/git:2
|
||||
secrets: [ cbtoken ]
|
||||
secrets: [cbtoken]
|
||||
commands:
|
||||
# config git to commit and push changes
|
||||
- git config --global --add safe.directory $CI_WORKSPACE/public
|
@ -27,7 +27,14 @@ Pull requests are welcome!
|
||||
|
||||
## More examples from Codeberg
|
||||
|
||||
[https://codeberg.org/explore/repos?q=woodpecker-ci&topic=1](https://codeberg.org/explore/repos?q=woodpecker-ci&topic=1)
|
||||
[Codeberg repos with Woodpecker YAML files](https://codeberg.org/explore/repos?q=woodpecker-ci&topic=1)
|
||||
|
||||
[1]: https://github.com/GoogleContainerTools/kaniko
|
||||
[2]: https://codeberg.org/woodpecker-plugins/plugin-docker-buildx
|
||||
|
||||
## How to add a new example
|
||||
|
||||
1. Create a new subdirectory with a descriptive name. Capitalize the first letter.
|
||||
1. If you only add one file: name it `.woodpecker.yaml`. If you want to add multiple files: add a `.woodpecker` directory and use descriptive names for the individual yaml files.
|
||||
1. Add your example to the README table while respecting the alphabetical order.
|
||||
1. Add your new subdirectory to the "woodpecker-cli" step in `.woodpecker.yaml` so it is getting linted over time.
|
||||
|
Loading…
x
Reference in New Issue
Block a user