-
Notifications
You must be signed in to change notification settings - Fork 2
84 lines (76 loc) · 2.5 KB
/
code_checks.yml
File metadata and controls
84 lines (76 loc) · 2.5 KB
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
name: Code Checks
on:
push:
branches: [main]
pull_request:
branches: [main]
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
# checks out ambersim
- uses: actions/checkout@v4
# checks the cache for pip packages
- uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-${{ hashFiles('pyproject.toml') }}
restore-keys: |
${{ runner.os }}-pip-
# download the cached artifacts
- name: Download mujoco artifact
id: download-artifact-mujoco
uses: dawidd6/action-download-artifact@v2
with:
workflow: mujoco_nightly.yml
name_is_regexp: true
name: "mujoco_wheel-*"
path: ${{ github.workspace }}
check_artifacts: true
search_artifacts: true
if_no_artifact_found: warn
- name: Download mjx artifact
id: download-artifact-mjx
uses: dawidd6/action-download-artifact@v2
with:
workflow: mujoco_nightly.yml
name_is_regexp: true
name: "mjx_wheel-*"
path: ${{ github.workspace }}
check_artifacts: true
search_artifacts: true
if_no_artifact_found: warn
- name: Install dependencies
working-directory: ${{ github.workspace }}
shell: bash -l {0}
run: |
python -m pip install --upgrade pip
bash ./ambersim/_scripts/install.sh -d # -d means dev, don't use -s because we manually install mj/mjx from source here
# upgrade mujoco to use nightly build
mujoco_whl_path=$(find ${{ github.workspace }} -name "mujoco-*.whl")
mjx_whl_path=$(find ${{ github.workspace }} -name "mujoco_mjx-*.whl")
if [ -n "$mujoco_whl_path" ]; then
pip install --no-deps --force-reinstall $mujoco_whl_path
fi
if [ -n "$mjx_whl_path" ]; then
pip install --no-deps --force-reinstall $mjx_whl_path
fi
# run all code checks
- name: Run black
shell: bash -l {0}
run: black --check .
- name: Run flake8
shell: bash -l {0}
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
- name: Run pyright
shell: bash -l {0}
run: |
pyright
- name: Test with pytest
shell: bash -l {0}
run: |
pytest