2020-08-07 23:17:07 +08:00
version : 2.1
2022-10-12 04:31:24 +08:00
setup : true
2020-08-07 23:17:07 +08:00
orbs :
2022-10-12 04:31:24 +08:00
continuation : circleci/continuation@0.1.0
2020-08-07 23:17:07 +08:00
2022-10-12 04:31:24 +08:00
parameters :
nightly :
type : boolean
default : false
2020-08-07 23:17:07 +08:00
2018-12-21 05:33:39 +08:00
jobs :
2023-01-03 23:19:38 +08:00
# Ensure running with CircleCI/huggingface
check_circleci_user :
docker :
2023-03-17 05:59:23 +08:00
- image : cimg/python:3.8.12
2023-01-03 23:19:38 +08:00
parallelism : 1
steps :
- run : echo $CIRCLE_PROJECT_USERNAME
- run : |
if [ "$CIRCLE_PROJECT_USERNAME" = "huggingface" ]; then
exit 0
else
echo "The CI is running under $CIRCLE_PROJECT_USERNAME personal account. Please follow https://support.circleci.com/hc/en-us/articles/360008097173-Troubleshooting-why-pull-requests-are-not-triggering-jobs-on-my-organization- to fix it."; exit -1
fi
2022-09-16 21:19:51 +08:00
# Fetch the tests to run
fetch_tests :
2019-09-26 16:15:53 +08:00
working_directory : ~/transformers
2019-09-24 19:25:50 +08:00
docker :
2023-03-17 05:59:23 +08:00
- image : cimg/python:3.8.12
2019-09-24 19:25:50 +08:00
parallelism : 1
steps :
- checkout
2023-07-05 22:49:10 +08:00
- run : pip install --upgrade --upgrade-strategy eager pip
- run : pip install -U --upgrade-strategy eager GitPython
- run : pip install -U --upgrade-strategy eager .
2022-09-16 21:19:51 +08:00
- run : mkdir -p test_preparation
2023-08-12 03:07:08 +08:00
- run : python utils/tests_fetcher.py | tee tests_fetched_summary.txt
2021-07-14 22:56:55 +08:00
- store_artifacts :
2023-08-12 03:07:08 +08:00
path : ~/transformers/tests_fetched_summary.txt
2021-07-14 22:56:55 +08:00
- run : |
2022-09-16 21:19:51 +08:00
if [ -f test_list.txt ]; then
2022-10-08 06:01:58 +08:00
cp test_list.txt test_preparation/test_list.txt
2022-09-16 21:19:51 +08:00
else
touch test_preparation/test_list.txt
fi
2023-05-25 21:38:21 +08:00
- run : |
if [ -f examples_test_list.txt ]; then
mv examples_test_list.txt test_preparation/examples_test_list.txt
else
touch test_preparation/examples_test_list.txt
fi
2023-06-07 01:35:24 +08:00
- run : |
if [ -f filtered_test_list_cross_tests.txt ]; then
mv filtered_test_list_cross_tests.txt test_preparation/filtered_test_list_cross_tests.txt
else
touch test_preparation/filtered_test_list_cross_tests.txt
fi
2023-05-17 05:29:02 +08:00
- run : |
if [ -f doctest_list.txt ]; then
cp doctest_list.txt test_preparation/doctest_list.txt
else
touch test_preparation/doctest_list.txt
fi
2022-10-19 01:47:36 +08:00
- run : |
if [ -f test_repo_utils.txt ]; then
mv test_repo_utils.txt test_preparation/test_repo_utils.txt
else
touch test_preparation/test_repo_utils.txt
fi
- run : python utils/tests_fetcher.py --filter_tests
2022-10-08 06:01:58 +08:00
- run : |
if [ -f test_list.txt ]; then
mv test_list.txt test_preparation/filtered_test_list.txt
else
touch test_preparation/filtered_test_list.txt
fi
2022-10-12 04:31:24 +08:00
- store_artifacts :
path : test_preparation/test_list.txt
2023-05-17 05:29:02 +08:00
- store_artifacts :
path : test_preparation/doctest_list.txt
2022-10-08 06:01:58 +08:00
- store_artifacts :
path : ~/transformers/test_preparation/filtered_test_list.txt
2022-09-29 21:36:42 +08:00
- store_artifacts :
2022-10-12 04:31:24 +08:00
path : test_preparation/examples_test_list.txt
- run : python .circleci/create_circleci_config.py --fetcher_folder test_preparation
2022-09-29 21:36:42 +08:00
- run : |
2022-10-12 04:31:24 +08:00
if [ ! -s test_preparation/generated_config.yml ]; then
echo "No tests to run, exiting early!"
circleci-agent step halt
fi
- run : cp test_preparation/generated_config.yml test_preparation/generated_config.txt
- store_artifacts :
path : test_preparation/generated_config.txt
2023-04-29 04:25:34 +08:00
- store_artifacts :
path : test_preparation/filtered_test_list_cross_tests.txt
2022-10-12 04:31:24 +08:00
- continuation/continue :
configuration_path : test_preparation/generated_config.yml
2022-01-10 20:53:20 +08:00
2022-09-16 21:19:51 +08:00
# To run all tests for the nightly build
fetch_all_tests :
working_directory : ~/transformers
docker :
2023-03-17 05:59:23 +08:00
- image : cimg/python:3.8.12
2022-09-16 21:19:51 +08:00
parallelism : 1
steps :
2022-10-21 22:26:30 +08:00
- checkout
2023-07-05 22:49:10 +08:00
- run : pip install --upgrade --upgrade-strategy eager pip
- run : pip install -U --upgrade-strategy eager GitPython
- run : pip install -U --upgrade-strategy eager .
2022-09-16 21:19:51 +08:00
- run : |
mkdir test_preparation
2022-10-24 22:00:02 +08:00
echo -n "tests" > test_preparation/test_list.txt
2023-05-25 21:38:21 +08:00
echo -n "all" > test_preparation/examples_test_list.txt
2022-10-24 22:00:02 +08:00
echo -n "tests/repo_utils" > test_preparation/test_repo_utils.txt
- run : |
echo -n "tests" > test_list.txt
python utils/tests_fetcher.py --filter_tests
mv test_list.txt test_preparation/filtered_test_list.txt
2022-10-12 04:31:24 +08:00
- run : python .circleci/create_circleci_config.py --fetcher_folder test_preparation
- run : cp test_preparation/generated_config.yml test_preparation/generated_config.txt
2021-08-10 20:54:52 +08:00
- store_artifacts :
2022-10-12 04:31:24 +08:00
path : test_preparation/generated_config.txt
- continuation/continue :
configuration_path : test_preparation/generated_config.yml
2021-08-10 20:54:52 +08:00
2019-12-21 22:49:11 +08:00
check_code_quality :
working_directory : ~/transformers
docker :
2023-03-17 05:59:23 +08:00
- image : cimg/python:3.8.12
2021-07-06 23:46:39 +08:00
resource_class : large
2021-05-04 21:53:44 +08:00
environment :
TRANSFORMERS_IS_CI : yes
2022-07-26 23:57:59 +08:00
PYTEST_TIMEOUT : 120
2019-12-21 22:49:11 +08:00
parallelism : 1
steps :
- checkout
2020-08-07 14:48:59 +08:00
- restore_cache :
keys :
2023-07-18 19:45:00 +08:00
- v0.7-code_quality-pip-{{ checksum "setup.py" }}
- v0.7-code-quality-pip
2023-06-23 05:16:35 +08:00
- restore_cache :
keys :
2023-07-18 19:45:00 +08:00
- v0.7-code_quality-site-packages-{{ checksum "setup.py" }}
2023-07-05 22:49:10 +08:00
- v0.7-code-quality-site-packages
- run : pip install --upgrade --upgrade-strategy eager pip
- run : pip install -U --upgrade-strategy eager .[all,quality]
2020-08-07 14:48:59 +08:00
- save_cache :
2023-07-18 19:45:00 +08:00
key : v0.7-code_quality-pip-{{ checksum "setup.py" }}
2020-08-07 14:48:59 +08:00
paths :
- '~/.cache/pip'
2023-06-23 05:16:35 +08:00
- save_cache :
2023-07-18 19:45:00 +08:00
key : v0.7-code_quality-site-packages-{{ checksum "setup.py" }}
2023-06-23 05:16:35 +08:00
paths :
- '~/.pyenv/versions/'
2022-11-03 03:52:39 +08:00
- run :
name : Show installed libraries and their versions
command : pip freeze | tee installed.txt
- store_artifacts :
path : ~/transformers/installed.txt
2023-11-17 00:43:19 +08:00
- run : ruff check examples tests src utils
- run : ruff format tests src utils --check
2021-03-20 04:17:13 +08:00
- run : python utils/custom_init_isort.py --check_only
2022-05-17 01:24:20 +08:00
- run : python utils/sort_auto_mappings.py --check_only
2022-07-07 20:17:58 +08:00
- run : python utils/check_doc_toc.py
2020-11-04 05:57:12 +08:00
2019-12-21 03:56:59 +08:00
check_repository_consistency :
2019-12-06 04:24:57 +08:00
working_directory : ~/transformers
docker :
2023-03-17 05:59:23 +08:00
- image : cimg/python:3.8.12
2021-11-04 05:43:19 +08:00
resource_class : large
environment :
TRANSFORMERS_IS_CI : yes
2022-07-26 23:57:59 +08:00
PYTEST_TIMEOUT : 120
2019-12-06 04:24:57 +08:00
parallelism : 1
steps :
- checkout
2021-11-04 05:43:19 +08:00
- restore_cache :
keys :
2023-07-18 19:45:00 +08:00
- v0.7-repository_consistency-pip-{{ checksum "setup.py" }}
- v0.7-repository_consistency-pip
2023-06-23 05:16:35 +08:00
- restore_cache :
keys :
2023-07-18 19:45:00 +08:00
- v0.7-repository_consistency-site-packages-{{ checksum "setup.py" }}
2023-07-05 22:49:10 +08:00
- v0.7-repository_consistency-site-packages
- run : pip install --upgrade --upgrade-strategy eager pip
- run : pip install -U --upgrade-strategy eager .[all,quality]
2021-11-04 05:43:19 +08:00
- save_cache :
2023-07-18 19:45:00 +08:00
key : v0.7-repository_consistency-pip-{{ checksum "setup.py" }}
2021-11-04 05:43:19 +08:00
paths :
- '~/.cache/pip'
2023-06-23 05:16:35 +08:00
- save_cache :
2023-07-18 19:45:00 +08:00
key : v0.7-repository_consistency-site-packages-{{ checksum "setup.py" }}
2023-06-23 05:16:35 +08:00
paths :
- '~/.pyenv/versions/'
2022-11-03 03:52:39 +08:00
- run :
name : Show installed libraries and their versions
command : pip freeze | tee installed.txt
- store_artifacts :
path : ~/transformers/installed.txt
2021-11-04 05:43:19 +08:00
- run : python utils/check_copies.py
- run : python utils/check_table.py
- run : python utils/check_dummies.py
- run : python utils/check_repo.py
- run : python utils/check_inits.py
2022-04-30 16:40:46 +08:00
- run : python utils/check_config_docstrings.py
2023-02-08 00:49:30 +08:00
- run : python utils/check_config_attributes.py
2023-01-26 22:33:47 +08:00
- run : python utils/check_doctest_list.py
2021-11-04 05:43:19 +08:00
- run : make deps_table_check_updated
2022-09-15 02:06:49 +08:00
- run : python utils/update_metadata.py --check-only
2023-01-28 02:19:28 +08:00
- run : python utils/check_task_guides.py
2023-10-04 21:13:37 +08:00
- run : python utils/check_docstrings.py
2023-12-22 19:56:11 +08:00
- run : python utils/check_support_list.py
2020-08-07 23:17:07 +08:00
2019-02-06 07:25:12 +08:00
workflows :
2019-08-30 00:14:29 +08:00
version : 2
2022-10-12 04:31:24 +08:00
setup_and_quality :
when :
not : <<pipeline.parameters.nightly>>
2019-08-30 00:14:29 +08:00
jobs :
2023-01-03 23:19:38 +08:00
- check_circleci_user
2019-12-21 22:49:11 +08:00
- check_code_quality
2019-12-21 03:56:59 +08:00
- check_repository_consistency
2022-09-16 21:19:51 +08:00
- fetch_tests
2022-10-12 04:31:24 +08:00
2021-08-10 20:54:52 +08:00
nightly :
2022-10-12 04:31:24 +08:00
when : <<pipeline.parameters.nightly>>
2021-08-10 20:54:52 +08:00
jobs :
2023-01-03 23:19:38 +08:00
- check_circleci_user
2022-10-12 04:31:24 +08:00
- check_code_quality
- check_repository_consistency
- fetch_all_tests