Skip to content
This repository was archived by the owner on Aug 28, 2025. It is now read-only.

Commit 226bb97

Browse files
committed
CI: add more inter. testing
* use caching
1 parent a875f79 commit 226bb97

File tree

2 files changed

+31
-12
lines changed

2 files changed

+31
-12
lines changed

.actions/test_cli.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,18 @@
99
_PATH_DIR_TITANIC = os.path.join(_PATH_TEMPLATES, "titanic")
1010

1111

12+
def _path_in_dir(fname: str, folder: str = _PATH_ROOT) -> str:
13+
return os.path.join(folder, fname)
14+
15+
1216
@pytest.mark.parametrize(
1317
"cmd,args",
1418
[
1519
("list_dirs", []),
1620
("list_dirs", [".", ".ipynb"]),
1721
("bash_render", [_PATH_DIR_SIMPLE]),
1822
("bash_test", [_PATH_DIR_SIMPLE]),
19-
# ("group_folders", [_PATH_SIMPLE]),
23+
("group_folders", [_path_in_dir("master-diff.txt"), _path_in_dir("dirs-b1.txt"), _path_in_dir("dirs-b2.txt")]),
2024
("augment_script", [_PATH_DIR_SIMPLE]),
2125
("copy_notebooks", [_PATH_ROOT]),
2226
("update_env_details", [_PATH_DIR_SIMPLE]),

.github/workflows/ci_test-acts.yml

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ on: # Trigger the workflow on push or pull request, but only for the main branc
66
pull_request:
77
branches: [main]
88

9+
defaults:
10+
run:
11+
shell: bash
12+
913
jobs:
1014
pytest-internal:
1115

@@ -14,17 +18,32 @@ jobs:
1418
fail-fast: false
1519
matrix:
1620
os: [ubuntu-20.04 ]
17-
python-version: ["3.9"]
21+
python-version: ["3.7", "3.9"]
1822
# Timeout: https://stackoverflow.com/a/59076067/4521646
19-
timeout-minutes: 10
23+
timeout-minutes: 15
2024

2125
steps:
2226
- uses: actions/checkout@v2
27+
with:
28+
fetch-depth: 0 # fetch all history for all branches and tags
2329
- name: Set up Python ${{ matrix.python-version }}
2430
uses: actions/setup-python@v2
2531
with:
2632
python-version: ${{ matrix.python-version }}
2733

34+
# Note: This uses an internal pip API and may not always work
35+
# https://github.com/actions/cache/blob/master/examples.md#multiple-oss-in-a-workflow
36+
- name: Get pip cache dir
37+
id: pip-cache
38+
run: echo "::set-output name=dir::$(pip cache dir)"
39+
40+
- name: pip cache
41+
uses: actions/cache@v2
42+
with:
43+
path: ${{ steps.pip-cache.outputs.dir }}
44+
key: ${{ runner.os }}-pip-py${{ matrix.python-version }}-${{ hashFiles('.actions/requirements.txt') }}-${{ hashFiles('requirements/default.txt') }}
45+
restore-keys: ${{ runner.os }}-pip-py${{ matrix.python-version }}-
46+
2847
- name: Install requirements
2948
run: |
3049
pip --version
@@ -33,22 +52,18 @@ jobs:
3352
# this is needed to be able to run package version parsing test
3453
pip install -q matplotlib -r requirements/default.txt --find-links https://download.pytorch.org/whl/cpu/torch_stable.html
3554
36-
- name: Convert templates
55+
- name: Prepare dummy inputs
3756
run: |
3857
jupytext --set-formats ipynb,py:percent templates/simple/template.py
3958
jupytext --set-formats ipynb,py:percent templates/titanic/tutorial.py
4059
# mv templates/simple/template.ipynb templates/simple.ipynb
60+
git diff --name-only HEAD~3 > master-diff.txt
61+
python .actions/assistant.py list_dirs "" > dirs-b1.txt
62+
python .actions/assistant.py list_dirs --include_file_ext=".ipynb" > dirs-b2.txt
4163
4264
- name: Testing
4365
run: |
44-
coverage run -m pytest .actions -v --junitxml="junit/test-results-${{ runner.os }}-${{ matrix.python-version }}.xml"
45-
46-
- name: Upload pytest test results
47-
uses: actions/upload-artifact@v2
48-
with:
49-
name: pytest-results-${{ runner.os }}-${{ matrix.python-version }}
50-
path: junit/test-results-${{ runner.os }}-${{ matrix.python-version }}.xml
51-
if: failure()
66+
coverage run -m pytest .actions -v
5267
5368
- name: Statistics
5469
if: success()

0 commit comments

Comments
 (0)