-
Notifications
You must be signed in to change notification settings - Fork 190
136 lines (129 loc) · 4.84 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
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
name: SMARTS CI Format
on: [push, pull_request]
env:
venv_dir: .venv
jobs:
test-header:
runs-on: ubuntu-20.04
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
container: ghcr.io/smarts-project/smarts:v0.6.1-minimal
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Check header
run: |
cd $GITHUB_WORKSPACE
make header-test
test-docstring:
runs-on: ubuntu-20.04
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
container: ghcr.io/smarts-project/smarts:v0.6.1-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 examples,scenarios,docs \
--msg-template='{path}: line {line}: {msg_id}: {msg}' \
./smarts ./envision ./baselines
test-types:
runs-on: ubuntu-20.04
if: (github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository) && (github.ref != 'refs/heads/master')
container: ghcr.io/smarts-project/smarts:v0.6.1-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.8 -m venv ${{env.venv_dir}}
. ${{env.venv_dir}}/bin/activate
pip install wheel==0.38.4
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/master... | 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}}
test-docs:
runs-on: ubuntu-20.04
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
container: ghcr.io/smarts-project/smarts:v0.6.1-minimal
steps:
- 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 Enchant
run: |
apt-get update --fix-missing
apt-get install -y libenchant-dev
- name: Build Sphinx documentation
run: |
python3.8 -m venv ${{env.venv_dir}}
. ${{env.venv_dir}}/bin/activate
pip install --upgrade pip "setuptools<58.3.0"
pip install wheel==0.38.4
pip install .[camera_obs,doc,train,ray,envision,argoverse,opendrive,waymo,sumo]
cd ${GITHUB_WORKSPACE}/docs
make html SPHINXOPTS="-W -T -E -n --keep-going -b spelling"
- name: Check build output
run: |
cd $GITHUB_WORKSPACE
if [ -d "docs/_build/html" ]; then
echo "Sphinx build successful."
else
echo "Sphinx build failed."
exit 1
fi
test-package-conflicts:
runs-on: ubuntu-20.04
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
container: ghcr.io/smarts-project/smarts:v1.1.0-minimal
steps:
- name: Install packages
run: |
apt-get update --fix-missing
apt-get install -y python3.8-dev
- 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 with all extras and check for conflicts
run: |
python3.8 -m venv ${{env.venv_dir}}
. ${{env.venv_dir}}/bin/activate
pip install --upgrade pip "setuptools<58.3.0"
pip install wheel==0.38.4
pip install .[all]
pip check