build: use GitHub actions to check code-style (#3138)

This commit is contained in:
Charles Kerr 2022-05-26 07:38:20 -05:00 committed by GitHub
parent 46eb379205
commit 50cb57784e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 23 additions and 39 deletions

22
.github/workflows/code-style.yml vendored Normal file
View File

@ -0,0 +1,22 @@
name: Code Style
on:
pull_request:
push:
branches:
- main
jobs:
formatting-check:
name: Formatting Check
runs-on: ubuntu-latest
steps:
- name: Install Dependencies
run: |
sudo apt-get install clang-format-12 npm yarn
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: Check
working-directory: .
run: |
./code_style.sh --check

View File

@ -75,12 +75,7 @@ If you're new to building programs from source code, this is typically easier th
You would want to setup your editor to make use of the .clang-format file located in the root of this repository and the eslint/prettier rules in web/package.json.
If for some reason you are unwilling or unable to do so, there is a shell script which you could run either directly or via docker-compose:
$ ./code_style.sh
or
$ docker-compose build --pull
$ docker-compose run --rm code_style
If for some reason you are unwilling or unable to do so, there is a shell script which you can use: `./code_style.sh`
## Sponsors

View File

@ -1,13 +0,0 @@
version: '3'
services:
code_style:
build: docker/code_style
volumes:
- .:/src
working_dir: /src
command:
- ./code_style.sh
- --check
environment:
HOME: /tmp

View File

@ -1,20 +0,0 @@
FROM mikedld/clang-format:12-debian AS clang_format
FROM debian:bullseye-slim AS final
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
ca-certificates \
curl \
gnupg2 \
&& curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \
&& echo "deb https://dl.yarnpkg.com/debian/ stable main" >> /etc/apt/sources.list.d/yarn.list \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
bash \
nodejs \
perl \
yarn \
&& rm -rf /var/lib/apt/lists/*
COPY --from=clang_format /usr/bin/clang-format /usr/bin/