Skip to content

Format example.

Format example. #8158

Workflow file for this run

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