Switched from custom pre-commit script to using the pre-commit tool
All checks were successful
Build and deploy automation_rs / Run pre-commit checks (push) Successful in 4m1s
Build and deploy automation_rs / Build automation_rs (push) Successful in 4m31s
Build and deploy automation_rs / Build Docker image (push) Successful in 50s
Build and deploy automation_rs / Deploy Docker container (push) Successful in 32s
All checks were successful
Build and deploy automation_rs / Run pre-commit checks (push) Successful in 4m1s
Build and deploy automation_rs / Build automation_rs (push) Successful in 4m31s
Build and deploy automation_rs / Build Docker image (push) Successful in 50s
Build and deploy automation_rs / Deploy Docker container (push) Successful in 32s
This commit is contained in:
parent
794b8eef19
commit
113f9f926c
|
@ -1,15 +0,0 @@
|
|||
#!/bin/sh
|
||||
set -o nounset # Fail on use of unset variable.
|
||||
set -o errexit # Exit on command failure.
|
||||
set -o pipefail # Exit on failure of any command in a pipeline.
|
||||
set -o errtrace # Trap errors in functions and subshells.
|
||||
set -o noglob # Disable filename expansion (globbing),
|
||||
# since it could otherwise happen during
|
||||
# path splitting.
|
||||
shopt -s inherit_errexit # Inherit the errexit option status in subshells.
|
||||
|
||||
set -x
|
||||
|
||||
git update-index --refresh
|
||||
cargo clippy --all-targets --all -- -D warnings
|
||||
cargo fmt -- --check
|
|
@ -7,6 +7,47 @@ on:
|
|||
- feature/**
|
||||
|
||||
jobs:
|
||||
check:
|
||||
name: Run pre-commit checks
|
||||
runs-on: ubuntu-latest
|
||||
container: catthehacker/ubuntu:act-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup go
|
||||
uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: ">=1.20.1"
|
||||
- name: Calculate cache hash
|
||||
uses: https://gitea.com/actions/go-hashfiles@v0.0.1
|
||||
id: hash-go
|
||||
with:
|
||||
patterns: |
|
||||
.pre-commit-config.yaml
|
||||
- name: Setup cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.cache/pre-commit
|
||||
key: pre-commit-3|${{ steps.hash-go.outputs.hash }}
|
||||
|
||||
- name: Install pre-commit
|
||||
run: python -m pip install pre-commit
|
||||
shell: bash
|
||||
|
||||
- name: Setup Rust
|
||||
uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||
with:
|
||||
rustflags: ""
|
||||
|
||||
- name: Set rustup default
|
||||
run: rustup default stable
|
||||
shell: bash
|
||||
|
||||
- name: Run pre-commit
|
||||
run: pre-commit run --show-diff-on-failure --color=always --all-files
|
||||
shell: bash
|
||||
|
||||
build:
|
||||
name: Build automation_rs
|
||||
runs-on: ubuntu-latest
|
||||
|
@ -20,12 +61,6 @@ jobs:
|
|||
with:
|
||||
rustflags: ""
|
||||
|
||||
- name: Formatting
|
||||
uses: actions-rust-lang/rustfmt@v1
|
||||
|
||||
- name: Clippy
|
||||
run: cargo clippy --all-targets --all -- -D warnings
|
||||
|
||||
- name: Build
|
||||
run: cargo build --release
|
||||
|
||||
|
@ -38,7 +73,7 @@ jobs:
|
|||
container:
|
||||
name: Build Docker image
|
||||
runs-on: ubuntu-latest
|
||||
needs: [build]
|
||||
needs: [build, checks]
|
||||
container: catthehacker/ubuntu:act-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
|
|
32
.pre-commit-config.yaml
Normal file
32
.pre-commit-config.yaml
Normal file
|
@ -0,0 +1,32 @@
|
|||
repos:
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: v4.6.0
|
||||
hooks:
|
||||
- id: trailing-whitespace
|
||||
- id: end-of-file-fixer
|
||||
- id: check-yaml
|
||||
- id: check-toml
|
||||
- id: check-added-large-files
|
||||
- id: check-merge-conflict
|
||||
|
||||
- repo: https://github.com/doublify/pre-commit-rust
|
||||
rev: v1.0
|
||||
hooks:
|
||||
- id: clippy
|
||||
- id: fmt
|
||||
|
||||
- repo: https://github.com/JohnnyMorganz/StyLua
|
||||
rev: v0.20.0
|
||||
hooks:
|
||||
- id: stylua
|
||||
|
||||
- repo: https://github.com/crate-ci/typos
|
||||
rev: v1.21.0
|
||||
hooks:
|
||||
- id: typos
|
||||
args: ["--force-exclude"]
|
||||
|
||||
- repo: https://github.com/pryorda/dockerfilelint-precommit-hooks
|
||||
rev: v0.1.0
|
||||
hooks:
|
||||
- id: dockerfilelint
|
|
@ -1,11 +1,12 @@
|
|||
# automation_rs
|
||||
|
||||
Custom home automation solution with google-home integration
|
||||
Custom home automation solution with Google Home integration and lua scripting.
|
||||
|
||||
## Development
|
||||
|
||||
Make sure to setup git hooks by running
|
||||
This repository uses [pre-commit](https://pre-commit.com) to make sure everything is ready to go when committing.
|
||||
Install the pre-commit hooks by running the following command:
|
||||
|
||||
```sh
|
||||
git config --local core.hooksPath .git-hooks/
|
||||
```bash
|
||||
pre-commit install
|
||||
```
|
||||
|
|
Loading…
Reference in New Issue
Block a user