-
Notifications
You must be signed in to change notification settings - Fork 105
70 lines (61 loc) · 2.07 KB
/
check-formatting.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#
# Copyright 2022 Davide Bettio <davide@uninstall.it>
#
# SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later
#
name: "Check formatting"
on:
push:
paths:
- '.github/workflows/**'
- 'CMakeLists.txt'
- 'src/**'
- 'tests/**'
- '**/*.erl'
pull_request:
paths:
- '.github/workflows/**'
- 'CMakeLists.txt'
- 'src/**'
- 'tests/**'
- '**/*.erl'
jobs:
clang-format-check:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: erlef/setup-beam@v1
with:
otp-version: 24.3
elixir-version: 1.12
- name: "Install run-clang-format"
run: |
wget -q -O - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add -
echo "deb http://apt.llvm.org/focal/ llvm-toolchain-focal-13 main" | sudo tee -a /etc/apt/sources.list
echo "deb-src http://apt.llvm.org/focal/ llvm-toolchain-focal-13 main" | sudo tee -a /etc/apt/sources.list
sudo apt-get update
sudo apt-get install -y clang-format-13
curl -sSfL https://raw.githubusercontent.com/Sarcasm/run-clang-format/master/run-clang-format.py -o run-clang-format
chmod +x run-clang-format
- name: "Check formatting with clang-format"
run: |
./run-clang-format --style=file --clang-format-executable=clang-format-13 -r src/ tests/
- name: "Check formatting with Erlang fmt"
if: success() || failure()
run: |
cd ..
git clone --depth 1 -b v1.1.0 https://github.com/WhatsApp/erlfmt.git
cd erlfmt
rebar3 as release escriptize
cd ../AtomVM
find . -name *.erl | xargs ../erlfmt/_build/release/bin/erlfmt -c
- name: "Check formatting with Elixir mix format"
if: success() || failure()
run: |
cd libs/exavmlib/
mix format --check-formatted
- name: "Check formatting with prettier"
if: success() || failure()
run: |
npm install prettier
find ../src/platforms/emscripten/ ../examples/emscripten/ -name "*.js" -o -name "*.html" | xargs npx prettier -c