Skip to content

Commit c8f9b85

Browse files
authored
Fix Circle CI builds: Tox 4 compatibility, add external commands to allowlist (#9789)
* ./manage.py now required to be in "allowlist_externals" so we invoke it via python * Add sh+git to allowlist_externals * Try explicitly fetching main branch * Fail faster: Run pre-commit before anything else, move nvm installation to the end * Call with "base_python", that's the MOST correct way 💯 * Rename remaining white=>allow * Adjust tox.embedapi.ini for Tox 4 * Upper bound the testembedapi tox<4 * Add upper bound for tox * Revert a no-op change to env names in tox.embedapi.ini
1 parent e23df55 commit c8f9b85

File tree

3 files changed

+22
-14
lines changed

3 files changed

+22
-14
lines changed

.circleci/config.yml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
- checkout
1919
- run: git submodule sync
2020
- run: git submodule update --init
21-
- run: pip install --user tox
21+
- run: pip install --user 'tox<5'
2222
- run: tox -e py310
2323
- codecov/upload
2424

@@ -29,7 +29,7 @@ jobs:
2929
- checkout
3030
- run: git submodule sync
3131
- run: git submodule update --init
32-
- run: pip install --user tox
32+
- run: pip install --user 'tox<4'
3333
- run: tox -c tox.embedapi.ini
3434

3535
checks:
@@ -41,18 +41,20 @@ jobs:
4141
- checkout
4242
- run: git submodule sync
4343
- run: git submodule update --init
44-
- run: pip install --user tox
44+
- run: git fetch origin main # needed for comparisson in pre-commit
45+
- run: git branch --track main origin/main # needed for comparisson in pre-commit
46+
- run: pip install --user 'tox<5'
47+
- run: tox -e pre-commit
48+
- run: tox -e migrations
49+
- run: tox -e lint
50+
- run: tox -e docs
51+
- run: tox -e docs-dev
4552
- run: scripts/circle/install_node.sh
4653
- run:
4754
name: Add node to the path
4855
command: |
4956
echo 'export PATH=~/.nvm/versions/node/v${NODE_VERSION}/bin:$PATH' >> $BASH_ENV
5057
source $BASH_ENV
51-
- run: tox -e migrations
52-
- run: tox -e pre-commit
53-
- run: tox -e lint
54-
- run: tox -e docs
55-
- run: tox -e docs-dev
5658
- run: tox -e eslint
5759

5860
workflows:

tox.embedapi.ini

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
[tox]
2+
# NOTE: Currently tox 3 is required, breaks with tox 4, possibly basepython 3.10 needs to be defined
23
# NOTE: Sphinx 3.5 and 4.x < 4.2 fails with Python 3.10 because of a typing issue
34
#
45
# NOTE: Sphinx 1.8 and 2.0 are not tested anymore because of some
@@ -7,10 +8,12 @@ envlist = sphinx-{21,22,23,24,30,31,32,33,34,42,43,44,45,50,latest,24-docutils-0
78

89
[testenv]
910
description = run test suite for the EmbedAPIv3
11+
allowlist_externals =
12+
sh
1013
install_command =
1114
# Install requirements in multiple steps because we don't want to install
1215
# Sphinx from `requirements/pip.txt` but from the `deps=` field.
13-
/bin/sh -c ' \
16+
sh -c ' \
1417
cat {toxinidir}/requirements/pip.txt | grep -v "Sphinx" > {toxinidir}/requirements/embedapi.txt; \
1518
sed {toxinidir}/requirements/testing.txt -e "s|pip.txt|embedapi.txt|g" > {toxinidir}/requirements/testing.embedapi.txt; \
1619
pip install -r {toxinidir}/requirements/testing.embedapi.txt; \

tox.ini

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,16 @@ deps =
1818
basepython =
1919
python3.10
2020
commands =
21-
/bin/sh -c '\
21+
sh -c '\
2222
export DJANGO_SETTINGS_MODULE=readthedocs.settings.test; \
2323
pytest --cov-report=xml --cov-config .coveragerc --cov=. --pyargs readthedocs --suppress-no-test-exit-code -m "not proxito and not embed_api" {posargs:{env:TOX_POSARGS:-m "not search and not proxito and not embed_api"}}'
2424

25-
/bin/sh -c '\
25+
sh -c '\
2626
export DJANGO_SETTINGS_MODULE=readthedocs.settings.proxito.test; \
2727
pytest --cov-report=xml --cov-config .coveragerc --cov=. --cov-append --pyargs readthedocs -m proxito --suppress-no-test-exit-code {posargs}'
28+
allowlist_externals =
29+
sh
30+
git
2831

2932
[testenv:docs]
3033
description = Build readthedocs user documentation
@@ -49,7 +52,7 @@ commands =
4952
[testenv:migrations]
5053
description = check for missing migrations
5154
commands =
52-
./manage.py makemigrations --check --dry-run
55+
{base_python} manage.py makemigrations --check --dry-run
5356

5457
[testenv:lint]
5558
description = run linter (prospector) to ensure the source code corresponds to our coding standards
@@ -75,15 +78,15 @@ commands =
7578
pre-commit run --from-ref main --to-ref HEAD
7679

7780
[testenv:eslint]
78-
whitelist_externals = npm
81+
allowlist_externals = npm
7982
description = run the JavaScript linter (requires `npm install`)
8083
commands =
8184
npm run lint
8285

8386
[testenv:coverage]
8487
description = shows the coverage report
8588
deps = coverage
86-
whitelist_externals = echo
89+
allowlist_externals = echo
8790
commands =
8891
coverage report --show-missing
8992
coverage html

0 commit comments

Comments
 (0)