build: use GitHub actions to check code-style (#3138)
This commit is contained in:
parent
46eb379205
commit
50cb57784e
|
@ -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
|
|
@ -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.
|
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:
|
If for some reason you are unwilling or unable to do so, there is a shell script which you can use: `./code_style.sh`
|
||||||
|
|
||||||
$ ./code_style.sh
|
|
||||||
or
|
|
||||||
$ docker-compose build --pull
|
|
||||||
$ docker-compose run --rm code_style
|
|
||||||
|
|
||||||
## Sponsors
|
## Sponsors
|
||||||
|
|
||||||
|
|
|
@ -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
|
|
|
@ -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/
|
|
Loading…
Reference in New Issue