8000 Initial commit · ravngr/github-workflows@74068f2 · GitHub
[go: up one dir, main page]

Skip to content

Commit 74068f2

Browse files
committed
Initial commit
0 parents  commit 74068f2

File tree

8 files changed

+202
-0
lines changed

8 files changed

+202
-0
lines changed

.codespellrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[codespell]
2+
skip = .git
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
---
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
pio-environment:
7+
description: 'PlatformIO environment name'
8+
required: true
9+
type: string
10+
11+
upload-firmware:
12+
description: 'If true firmware artefacts will be uploaded on completion'
13+
required: false
14+
default: false
15+
16+
17+
jobs:
18+
platformio-build:
19+
name: "Build firmware using PlatformIO"
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: "Checkout"
23+
uses: actions/checkout@v3
24+
25+
- name: "Setup Python"
26+
uses: actions/setup-python@v4
27+
with:
28+
python-version: '3.11'
29+
cache: 'pip'
30+
31+
- name: "Setup PlatformIO"
32+
run: |
33+
pip install platformio
34+
35+
- name: "Run build"
36+
run: |
37+
pio run -e "${{ inputs.pio-environment }}"
38+
39+
- name: "Upload firmware"
40+
if: ${{ inputs.upload-firmware == 'true' }}
41+
uses: actions/upload-artifact@v3
42+
with:
43+
name: firmware
44+
path: |
45+
"./.pio/build/${{ inputs.pio-environment }}/bootloader.*"
46+
"./.pio/build/${{ inputs.pio-environment }}/firmware.*"
47+
"./.pio/build/${{ inputs.pio-environment }}/project.checksum"

.github/workflows/pre-commit.yaml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
3+
on:
4+
workflow_call:
5+
6+
7+
jobs:
8+
pre-commit:
9+
name: "Run pre-commit checks"
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: "Checkout repository"
13+
uses: actions/checkout@v3
14+
15+
- name: "Install pre-commit"
16+
run: |
17+
python -m pip install pre-commit
18+
19+
- name: "Cache pre-commit environment"
20+
uses: actions/cache@v3
21+
with:
22+
path: ~/.cache/pre-commit
23+
key: pre-commit_${{ env.pythonLocation }}_${{ hashFiles('.pre-commit-config.yaml') }}
24+
25+
- name: "Run all pre-commit tests"
26+
run: |
27+
pre-commit run -a --color=always

.github/workflows/yamllint.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
3+
on:
4+
workflow_call:
5+
6+
7+
jobs:
8+
lint:
9+
name: "Lint YAML files using yamllint"
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: "Checkout configuration"
13+
uses: actions/checkout@v3
14+
15+
- name: "Run yamllint"
16+
uses: ibiqlik/action-yamllint@v3

.pre-commit-config.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
3+
repos:
4+
- repo: https://github.com/pre-commit/pre-commit-hooks
5+
rev: v2.3.0
6+
hooks:
7+
- id: check-added-large-files
8+
- id: end-of-file-fixer
9+
- id: mixed-line-ending
10+
args:
11+
- "--fix=lf"
12+
- id: trailing-whitespace
13+
14+
- repo: https://github.com/adrienverge/yamllint.git
15+
rev: v1.29.0
16+
hooks:
17+
- id: yamllint
18+
19+
- repo: https://github.com/codespell-project/codespell
20+
rev: v2.2.4
21+
hooks:
22+
- id: codespell

.yamllint

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
3+
extends: default
4+
5+
rules:
6+
braces:
7+
forbid: non-empty
8+
brackets:
9+
forbid: non-empty
10+
comments:
11+
require-starting-space: true
12+
ignore-shebangs: true
13+
comments-indentation: disable
14+
document-start:
15+
present: true
16+
empty-lines:
17+
max: 2
18+
indentation:
19+
spaces: 2
20+
key-duplicates: {}
21+
line-length:
22+
max: 120
23+
new-line-at-end-of-file: enable
24+
new-lines:
25+
type: unix
26+
trailing-spaces: {}
27+
truthy:
28+
allowed-values:
29+
- 'true'
30+
- 'false'
31+
- 'ON'
32+
- 'OFF'
33+
check-keys: false

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2023 Chris Harrison
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# github-workflows
2+
Repository for shared GitHub Action workflows.
3+
4+
## Workflows
5+
6+
### `platformio-build.yaml`
7+
Build [PlatformIO](https://platformio.org/) project and optionally upload firmware artefacts.
8+
9+
```yaml
10+
jobs:
11+
call-platformio-build:
12+
uses: ravngr/github-workflows/.github/workflows/platformio-build.yaml@main
13+
with:
14+
pio-environment: <environment>
15+
upload-firmware: false
16+
```
17+
18+
### `pre-commit.yaml`
19+
Runs [pre-commit](https://pre-commit.com/) against repository files.
20+
21+
```yaml
22+
jobs:
23+
call-pre-commit:
24+
uses: ravngr/github-workflows/.github/workflows/pre-commit.yaml@main
25+
```
26+
27+
### `yamllint.yaml`
28+
Runs [yamllint](https://www.yamllint.com/) against repository files.
29+
30+
```yaml
31+
jobs:
32+
call-yamllint:
33+
uses: ravngr/github-workflows/.github/workflows/yamllint.yaml@main
34+
```

0 commit comments

Comments
 (0)
0