Skip to content

Commit 50a1cab

Browse files
committed
[actions] cache the tox venvs
1 parent a0005f2 commit 50a1cab

File tree

3 files changed

+66
-26
lines changed

3 files changed

+66
-26
lines changed

.github/workflows/pre-merge.yaml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,31 +27,31 @@ jobs:
2727

2828
steps:
2929
- uses: actions/checkout@v3
30-
- name: Poetry Cache Dir
30+
- name: Poetry Venv Dir
3131
run: |
32-
echo "POETRY_CACHE_DIR=$(poetry config virtualenvs.path)" >> $GITHUB_ENV
32+
echo "VENV_DIR=$(poetry config virtualenvs.path)" >> $GITHUB_ENV
3333
34-
- name: Poetry Cache from Cache
34+
- name: Restore the Cache
3535
id: cache-deps
3636
uses: actions/cache@v3
3737
with:
38-
path: ${{ env.POETRY_CACHE_DIR }}
38+
path: ${{ env.VENV_DIR }}
3939
# bump the suffix if you need to force-refresh the cache
40-
key: poetry-cache-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }}-1
40+
key: py-trees-ci-cache-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock', '**/tox.ini') }}-1
4141

4242
# Install all deps, sans the project (--no-root)
43-
- name: Install Dependencies
43+
- name: Poetry - Install Dependencies
4444
run: poetry install --no-interaction --no-root
4545
if: steps.cache-deps.outputs.cache-hit != 'true'
4646

4747
# Project is installed separately to avoid always invalidating the cache
48-
- name: Install Project
48+
- name: Poetry - Install Project
4949
run: poetry install --no-interaction
5050

5151
# TODO: Caching above doesn't make much sense when tox effectively re-installs deps
52-
- name: Tests
53-
run: poetry run tox -e ${{ matrix.python-py-version }}
54-
- name: Formatters, Linters
55-
run: poetry run tox -e check
56-
- name: MyPy
57-
run: poetry run tox -e my${{ matrix.python-py-version }}
52+
- name: Tox - Tests
53+
run: poetry run tox --workdir ${{ env.VENV_DIR }} -e ${{ matrix.python-py-version }}
54+
- name: Tox - Formatters, Linters
55+
run: poetry run tox --workdir ${{ env.VENV_DIR }} -e check
56+
- name: Tox - MyPy
57+
run: poetry run tox --workdir ${{ env.VENV_DIR }} -e my${{ matrix.python-py-version }}

.github/workflows/update-poetry-cache.yaml

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
################################################################################
2-
# Store a cache for dependencies on every merge to devel.
2+
# Ensure poetry and tox installed dependencies are in the cache.
33
#
4-
# All PR's have access to devel's caches. This makes sure it gets generated and
5-
# is available for the next PR. Otherwise every PR will always generate a cache
6-
# for the first commit of the PR (subsequent commits will reuse that).
4+
# All PR's can reuse devel's caches, but a PR's cache cannot be reused from
5+
# one PR to the next. This jobs' sole purpose is to make sure every PR updates
6+
# devel's cache (if changes are needed) on merging.
77
#
88
# https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows
99
################################################################################
@@ -34,21 +34,25 @@ jobs:
3434

3535
steps:
3636
- uses: actions/checkout@v3
37-
- name: Poetry Cache Dir
37+
- name: Poetry Venv Dir
3838
run: |
39-
echo "POETRY_CACHE_DIR=$(poetry config virtualenvs.path)" >> $GITHUB_ENV
39+
echo "VENV_DIR=$(poetry config virtualenvs.path)" >> $GITHUB_ENV
4040
41-
- name: Poetry Cache from Cache
41+
- name: Restore the Cache
4242
id: cache-deps
4343
uses: actions/cache@v3
4444
with:
45-
path: ${{ env.POETRY_CACHE_DIR }}
45+
path: ${{ env.VENV_DIR }}
4646
# bump the suffix if you need to force-refresh the cache
47-
key: poetry-cache-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }}-1
47+
key: py-trees-ci-cache-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock', '**/tox.ini') }}-1
4848

4949
# Install all deps, sans the project (--no-root)
50-
- name: Install Dependencies
50+
- name: Poetry - Install Dependencies
5151
run: poetry install --no-interaction --no-root
5252
if: steps.cache-deps.outputs.cache-hit != 'true'
5353

54+
- name: Tox - Install Dependencies
55+
run: poetry run tox --workdir ${{ env.VENV_DIR }} --notest -e ${{ matrix.python-py-version }} check my${{ matrix.python-py-version }}
56+
if: steps.cache-deps.outputs.cache-hit != 'true'
57+
5458

README.md

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,48 @@ PyTrees is a python implementation of behaviour trees designed to facilitate the
1414
* Python decorators for enabling meta behaviours
1515
* Render trees to dot graphs or visualise with ascii graphs on stdout
1616

17-
## Docs and Demos
18-
19-
Core API documentation (also includes some explanation concerning the demo scripts):
17+
## Documentation
2018

2119
[![devel][docs-devel-image]][docs-devel] [![2.1.x][docs-2.1.x-image]][docs-2.1.x] [![0.7.x][docs-0.7.x-image]][docs-0.7.x] [![0.6.x][docs-0.6.x-image]][docs-0.6.x]
2220

21+
## Getting Started
22+
23+
VSCode and a [py38 DevContainer](.devcontainer/devcontainer.json) on CodeSpaces will set you up with an environment
24+
for running demos, tests and/or creating PRs in less than five minutes. If you're just looking for releases,
25+
fetch them from [PyPi](https://pypi.org/project/py-trees/).
26+
27+
1. Fork the project to your personal account
28+
2. Click on Code -> Codespaces -> + Create a Codespace
29+
3. Be froody
30+
31+
```
32+
(docker) zen@py_trees:/workspaces/py_trees$ poetry install
33+
(docker) zen@py_trees:/workspaces/py_trees$ poetry shell
34+
35+
(py-trees-py3.8) (docker) zen@py_trees:/workspaces/py_trees$ py-trees-demo-<tab>-<tab>
36+
py-trees-demo-action-behaviour py-trees-demo-context-switching py-trees-demo-logging
37+
py-trees-demo-behaviour-lifecycle py-trees-demo-display-modes py-trees-demo-pick-up-where-you-left-off
38+
py-trees-demo-blackboard py-trees-demo-dot-graphs py-trees-demo-selector
39+
py-trees-demo-blackboard-namespaces py-trees-demo-either-or py-trees-demo-sequence
40+
py-trees-demo-blackboard-remappings py-trees-demo-eternal-guard py-trees-demo-tree-stewardship
41+
42+
(py-trees-py3.8) (docker) zen@py_trees:/workspaces/py_trees$ py-trees-demo-blackboard
43+
*******************************************************************************
44+
Blackboard
45+
*******************************************************************************
46+
47+
Demonstrates usage of the blackboard and related behaviours.
48+
49+
A sequence is populated with a few behaviours that exercise
50+
reading and writing on the Blackboard in interesting ways.
51+
52+
*******************************************************************************
53+
54+
[DEBUG] Writer : BlackboardWriter.__init__()
55+
...
56+
...
57+
```
58+
2359
If you're really looking for something more edifying than hello world examples, walk through the [ros tutorials](https://py-trees-ros-tutorials.readthedocs.io/en/release-2.0.x/index.html) which incrementally step through the process of building a scenario handling layer for a robot.
2460

2561
There are also runtime visualisation tools - refer to the [py_trees_ros_viewer/README](https://github.com/splintered-reality/py_trees_ros_viewer/blob/devel/README.md) as an example implementation of the underlying [py_trees_js](https://github.com/splintered-reality/py_trees_js) library.

0 commit comments

Comments
 (0)