-
Notifications
You must be signed in to change notification settings - Fork 4
113 lines (95 loc) · 2.78 KB
/
code-quality.yml
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
---
name: Code Quality
# This workflow is triggered on pushes to the repository.
# yamllint disable rule:truthy
on: [push]
# yamllint enable
jobs:
pre_commit:
name: Pre-commit
runs-on: ubuntu-latest
steps:
- name: Checkout source code
uses: actions/checkout@v3
- name: Set up Node.js 16
uses: actions/setup-node@v3
with:
node-version: "16"
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10"
architecture: "x64"
- name: Set up Ruby 2.x
uses: actions/setup-ruby@v1
with:
ruby-version: "2.x"
- name: Set up Go 1.18
uses: actions/setup-go@v3
with:
go-version: "^1.18"
- name: Fix Go directory permissions
run: chmod -R o-rwx /opt/hostedtoolcache/go
- name: Install Python packages
run: |
python3 -m pip install --upgrade pip
pip3 install -r requirements.dev.txt
pre-commit --version
- name: Install Go packages
run: |
export PATH="$PATH:$GOPATH/bin"
go install mvdan.cc/sh/v3/cmd/shfmt@latest
shfmt -version
env:
GOPATH: /home/runner/go
- name: Install shellcheck
run: |
sudo snap install shellcheck
shellcheck --version
- name: Cache pre-commit dependencies
uses: actions/cache@v3
with:
path: ~/.cache/pre-commit/
# yamllint disable rule:line-length
key: |
${{ runner.os }}-pre-commit-${{ hashFiles('**/.pre-commit-config.yaml') }}
# yamllint enable
restore-keys: |
${{ runner.os }}-pre-commit-
- name: Run pre-commit hooks
run: |
export PATH="$PATH:$GOPATH/bin"
export SKIP=pylint,flake8
pre-commit run -a
env:
GOPATH: /home/runner/go
python:
name: Python
runs-on: ubuntu-latest
strategy:
matrix:
os: [ubuntu-latest]
python-version: ["3.8", "3.9", "3.10"]
steps:
- name: Checkout source code
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
architecture: x64
- name: Display Python version
run: python -c "import sys; print(sys.version)"
- name: Install Python requirements
run: |
python3 -m pip install --upgrade pip
pip3 install -r requirements.dev.txt
pre-commit --version
pylint --version
flake8 --version
- name: Lint with pylint
run: |
pylint machine scripts/*.py
- name: Lint with flake8
run: |
flake8 .