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" - "checkout"
- run: *SETUP_VIRTUALENV - run: *SETUP_VIRTUALENV
- run: - run:
name: "Run test suite (python3.6)" name: "Limit Modules"
command: | command: |
# Constrain the modules exercised under Python 3 based on the list # Limit the modules exercised under Python 3 dynamically, based
# we keep in _python3. Exporting inside a command seems to be the # on the list we keep in allmydata.util._python3. Use BASH_ENV to
# preferred way of setting an environment variable (or otherwise # communicate this to the RUN_TESTS step:
# constraining the test run) dynamically:
# #
# https://ideas.circleci.com/ideas/CCI-I-67 # https://circleci.com/docs/2.0/env-vars/#using-parameters-and-bash-environment
#
# 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.
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))')" \ 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}
/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"
- run: *RUN_TESTS
- store_test_results: *STORE_TEST_RESULTS - store_test_results: *STORE_TEST_RESULTS
- store_artifacts: *STORE_TEST_LOG - store_artifacts: *STORE_TEST_LOG
- store_artifacts: *STORE_OTHER_ARTIFACTS - store_artifacts: *STORE_OTHER_ARTIFACTS