Skip to content

Commit

Permalink
👷 Add a lint workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
ad2ien committed Mar 3, 2024
1 parent a36f98c commit 0a623d3
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 14 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
name: Build debian package

on:
pull_request:
branches: [main]
push:
branches:
- main

branches: [main]
workflow_call:

jobs:
build:
runs-on: ubuntu-latest
Expand All @@ -20,11 +20,11 @@ jobs:
- name: Install toolchain
uses: dtolnay/rust-toolchain@stable

- name: Cargo lint
run: cargo fmt --all -- --check

- name: Cargo test
run: cargo test

- name: Cargo build
run: cargo build --release

- name: Create debian package
run: ./debian-build.sh
run: cargo build
30 changes: 30 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Lint

on:
pull_request:
branches: [main]
push:
branches: [main]

workflow_call:

jobs:
lint-markdown:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Lint markdown files
uses: avto-dev/markdown-lint@v1.5.0
with:
args: "**/*.md"

lint-yaml:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Lint yaml files
uses: ibiqlik/action-yamllint@v3.1.1
2 changes: 2 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ on:
types: [created]

jobs:
lint:
uses: ./.github/workflows/lint.yml
build-ok:
uses: ./.github/workflows/build.yml

Expand Down
2 changes: 2 additions & 0 deletions .markdownlint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
line-length: false
MD038: false
6 changes: 6 additions & 0 deletions .yamllint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
extends: default
rules:
document-start: disable
line-length:
max: 160
level: warning
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,6 @@ Only tried on Pop!_OS 22.04 LTS. Should work on any Debian based distri with X11

## TODO

- [x] uninstall should remove service
- [x] config file for a debian package?
- [x] man page
- [ ] CI lint
- [ ] debian package lint warnings
- [ ] remove test from build script
- [ ] readme badges rust & lint
Expand Down
2 changes: 0 additions & 2 deletions debian-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ echo "📝 Make man..."
# docker run --rm -v $(pwd):/working -w /working pandoc/minimal:3 --to man man.md -o capslock-auto-switch.1
gzip -c -n -9 ./capslock-auto-switch.1 > ./${DEBIAN_FOLDER}/usr/share/man/man1/capslock-auto-switch.1.gz

echo "🧪 run tests..."
cargo test
echo "🦀 run build..."
cargo build --release
strip target/release/$BINARY_NAME
Expand Down

0 comments on commit 0a623d3

Please sign in to comment.