Skip to content

Commit 25280e7

Browse files
authored
Adds clang-format, nixfmt, and shellcheck in CI. (#77)
Signed-off-by: Nathan Ringo <me@remexre.com>
1 parent 6be106f commit 25280e7

File tree

4 files changed

+63
-40
lines changed

4 files changed

+63
-40
lines changed

.devcontainer/Dockerfile

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,23 @@
44

55
FROM docker.io/alpine:3.21
66
RUN apk add --no-interactive \
7-
bash \
8-
binutils-riscv-none-elf \
9-
busybox-extras \
10-
coreutils \
11-
gcc-riscv-none-elf \
12-
gdb-multiarch \
13-
git \
14-
make \
15-
mdbook \
16-
minicom \
17-
openssh \
18-
perl \
19-
python3 \
20-
qemu-system-riscv64 \
21-
reuse \
22-
tar \
23-
zstd
7+
bash \
8+
binutils-riscv-none-elf \
9+
busybox-extras \
10+
clang-extra-tools \
11+
coreutils \
12+
gcc-riscv-none-elf \
13+
gdb-multiarch \
14+
git \
15+
make \
16+
mdbook \
17+
minicom \
18+
openssh \
19+
perl \
20+
python3 \
21+
qemu-system-riscv64 \
22+
reuse \
23+
shellcheck \
24+
tar \
25+
tio \
26+
zstd

.github/workflows/lint.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# SPDX-FileCopyrightText: 2025 ukoOS Contributors
2+
#
3+
# SPDX-License-Identifier: GPL-3.0-or-later
4+
5+
name: Linting
6+
on:
7+
push:
8+
pull_request:
9+
jobs:
10+
lint:
11+
runs-on: 'ubuntu-latest'
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v4
15+
- name: Install Nix
16+
uses: cachix/install-nix-action@v31
17+
with:
18+
github_access_token: ${{ secrets.GITHUB_TOKEN }}
19+
- name: Set up Cachix
20+
uses: cachix/cachix-action@v14
21+
with:
22+
name: ukoos
23+
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
24+
- name: Check REUSE
25+
run: |
26+
nix develop --command reuse lint
27+
- name: Check formatting
28+
run: |
29+
nix fmt -- --ci
30+
nix develop --command \
31+
find -name '*.c' -or -name '*.h' \
32+
-exec clang-format --dry-run -Werror -- {} +
33+
- name: Lint configure script
34+
run: |
35+
# TODO: Any other shell scripts should end up here.
36+
nix develop --command \
37+
shellcheck configure

.github/workflows/reuse-lint.yml

Lines changed: 0 additions & 23 deletions
This file was deleted.

flake.nix

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,15 @@
9090
];
9191
nativeBuildInputs = [
9292
pkgs.bear
93+
pkgs.clang-tools
9394
pkgs.dtc
9495
pkgs.gdb
9596
pkgs.minicom
97+
pkgs.nixfmt-rfc-style
9698
pkgs.qemu
9799
pkgs.reuse
100+
pkgs.shellcheck
101+
pkgs.tio
98102
];
99103
shellHook = ''
100104
export CC=riscv64-none-elf-gcc
@@ -103,6 +107,8 @@
103107
'';
104108
};
105109

110+
formatter = pkgs.nixfmt-tree;
111+
106112
packages = ukoos-packages // {
107113
default = packages."ukoos/milkv-duos";
108114

0 commit comments

Comments
 (0)