Use BASH_ENV to avoid duplication of job steps

This commit is contained in:
Chad Whitacre 2020-08-14 07:43:25 -04:00
parent ae87037e73
commit 647ed5d6e1

View File

@ -291,33 +291,18 @@ jobs:
- "checkout"
- run: *SETUP_VIRTUALENV
- run:
name: "Run test suite (python3.6)"
name: "Limit Modules"
command: |
# Constrain the modules exercised under Python 3 based on the list
# we keep in _python3. Exporting inside a command seems to be the
# preferred way of setting an environment variable (or otherwise
# constraining the test run) dynamically:
# Limit the modules exercised under Python 3 dynamically, based
# on the list we keep in allmydata.util._python3. Use BASH_ENV to
# communicate this to the RUN_TESTS step:
#
# https://ideas.circleci.com/ideas/CCI-I-67
#
# This seems to force a choice between DRY code with an overloaded
# RUN_TESTS, or an uncluttered RUN_TESTS and code duplication here.
# Que sera, sera.
# https://circleci.com/docs/2.0/env-vars/#using-parameters-and-bash-environment
export TAHOE_LAFS_TOX_ARGS="$(/tmp/tahoe-lafs.tox/${TAHOE_LAFS_TOX_ENVIRONMENT}/bin/python -c 'from allmydata.util._python3 import PORTED_TEST_MODULES; print(" ".join(PORTED_TEST_MODULES))')" \
/tmp/project/.circleci/run-tests.sh \
"/tmp/venv" \
"/tmp/project" \
"${ALLOWED_FAILURE}" \
"${ARTIFACTS_OUTPUT_PATH}" \
"${TAHOE_LAFS_TOX_ENVIRONMENT}" \
"${TAHOE_LAFS_TOX_ARGS}"
# trial output gets directed straight to a log. avoid the circleci
# timeout while the test suite runs.
no_output_timeout: "20m"
echo "export TAHOE_LAFS_TOX_ARGS=\"$(/tmp/tahoe-lafs.tox/${TAHOE_LAFS_TOX_ENVIRONMENT}/bin/python -c 'from allmydata.util._python3 import PORTED_TEST_MODULES; print(" ".join(PORTED_TEST_MODULES))')\"" >> ${BASH_ENV}
- run: *RUN_TESTS
- store_test_results: *STORE_TEST_RESULTS
- store_artifacts: *STORE_TEST_LOG
- store_artifacts: *STORE_OTHER_ARTIFACTS