forked from huawei-noah/SMARTS
-
Notifications
You must be signed in to change notification settings - Fork 0
79 lines (73 loc) · 2.81 KB
/
ci-format.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
name: SMARTS CI Format
on: [push, pull_request]
env:
venv_dir: .venv
jobs:
test-header:
runs-on: ubuntu-18.04
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
container: huaweinoah/smarts:v0.4.18-minimal
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Check header
run: |
cd $GITHUB_WORKSPACE
make header-test
test-docstring:
runs-on: ubuntu-18.04
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
container: huaweinoah/smarts:v0.4.18-minimal
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Check docstring
run: |
cd $GITHUB_WORKSPACE
pip install --upgrade pip
pip install pylint
pylint -d all \
-e missing-function-docstring \
-e missing-class-docstring \
-s n \
--ignore marl_benchmark,examples,scenarios,docs,manager_pb2_grpc.py,worker_pb2_grpc.py \
--msg-template='{path}: line {line}: {msg_id}: {msg}' \
./smarts ./envision ./baselines
test-types:
runs-on: ubuntu-18.04
if: (github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository) && (github.ref != 'refs/heads/master')
container: huaweinoah/smarts:v0.4.18-minimal
steps:
- name: Install packages
run: |
add-apt-repository -y ppa:git-core/ppa
apt-get update
apt-get install -y git
- name: Add safe directory
run: git config --global --add safe.directory $GITHUB_WORKSPACE
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Install SMARTS
run: |
python3.7 -m venv ${{env.venv_dir}}
. ${{env.venv_dir}}/bin/activate
pip install --upgrade pip wheel
pip install -e .[dev,camera-obs,train,test]
- name: Get changed files on branch since branching
id: changed-files
shell: bash
run: |
cd $GITHUB_WORKSPACE
CHANGED=$(git diff --diff-filter="AM" --name-only --ignore-submodules=all origin/develop... | awk -v d=" " '{s=(NR==1?s:s d)$0}END{print s}')
declare -A SEEN
UNIQUE=()
for file in ${CHANGED[@]}; do filename=$(basename $file); if [ ! -v "SEEN[$filename]" ]; then SEEN[$filename]+=1; UNIQUE+=($file); fi; done
OUT=$( IFS=$' '; echo "${UNIQUE[*]}")
echo "::set-output name=changed_files::$OUT"
- name: Check types
if: contains(steps.changed-files.outputs.changed_files, '.py')
run: |
. ${{env.venv_dir}}/bin/activate
pytype -d pyi-error,import-error ${{steps.changed-files.outputs.changed_files}}