mirror of
https://github.com/huggingface/transformers.git
synced 2025-07-03 21:00:08 +06:00

* don't run custom when not needed? * update test fetcher filtering * fixup and updates * update * update * reduce burden * nit * nit * mising comma * this? * this? * more parallelism * more * nit for real parallelism on tf and torch examples * update * update * update * update * update * update * update * update * update * update * update * update * update to make it more custom * update to make it more custom * update to make it more custom * update to make it more custom * update * update * update * update * update * update * use correct path * fix path to test files and examples * filter-tests * filter? * filter? * filter? * nits * fix naming of the artifacts to be pushed * list vs files * list vs files * fixup * fix list of all tests * fix the install steps * fix the install steps * fix the config * fix the config * only split if needed * only split if needed * extend should fix it * extend should fix it * arg * arg * update * update * run tests * run tests * run tests * more nits * update * update * update * update * update * update * update * simpler way to show the test, reduces the complexity of the generated config * simpler way to show the test, reduces the complexity of the generated config * style * oups * oups * fix import errors * skip some tests for now * update doctestjob * more parallelism * fixup * test only the test in examples * test only the test in examples * nits * from Arthur * fix generated congi * update * update * show tests * oups * oups * fix torch job for now * use single upload setp * oups * fu**k * fix * nit * update * nit * fix * fixes * [test-all] * add generate marker and generate job * oups * torch job runs not generate tests * let repo utils test all utils * UPdate * styling * fix repo utils test * more parallel please * don't test * update * bit more verbose sir * more * hub were skipped * split by classname * revert * maybe? * Amazing catch Co-authored-by: Yih-Dar <2521628+ydshieh@users.noreply.github.com> * fix * update * update * maybe non capturing * manual convert? * pass artifacts as parameters as otherwise the config is too long * artifact.json * store output * might not be safe? * my token * mmm? * use CI job IS * can't get a proper id? * ups * build num * update * echo url * this? * this! * fix * wget * ish * dang * udpdate * there we go * update * update * pass all * not .txt * update * fetcg * fix naming * fix * up * update * update * ?? * update * more updates * update * more * skip * oups * pr documentation tests are currently created differently * update * hmmmm * oups * curl -L * update * ???? * nit * mmmm * ish * ouf * update * ish * update * update * updatea * nit * nit * up * oups * documentation_test fix * test hub tests everything, just marker * update * fix * test_hub is the only annoying one now * tf threads? * oups * not sure what is happening? * fix? * just use folder for stating hub * I am getting fucking annoyed * fix the test? * update * uupdate * ? * fixes * add comment! * nit --------- Co-authored-by: ydshieh <ydshieh@users.noreply.github.com> Co-authored-by: Yih-Dar <2521628+ydshieh@users.noreply.github.com>
173 lines
7.2 KiB
YAML
173 lines
7.2 KiB
YAML
version: 2.1
|
|
setup: true
|
|
orbs:
|
|
continuation: circleci/continuation@0.1.0
|
|
|
|
parameters:
|
|
nightly:
|
|
type: boolean
|
|
default: false
|
|
|
|
jobs:
|
|
# Ensure running with CircleCI/huggingface
|
|
check_circleci_user:
|
|
docker:
|
|
- image: python:3.10-slim
|
|
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
|
|
# Fetch the tests to run
|
|
fetch_tests:
|
|
working_directory: ~/transformers
|
|
docker:
|
|
- image: huggingface/transformers-quality
|
|
parallelism: 1
|
|
steps:
|
|
- checkout
|
|
- run: uv pip install -U -e .
|
|
- run: echo 'export "GIT_COMMIT_MESSAGE=$(git show -s --format=%s)"' >> "$BASH_ENV" && source "$BASH_ENV"
|
|
- run: mkdir -p test_preparation
|
|
- run: python utils/tests_fetcher.py | tee tests_fetched_summary.txt
|
|
- run: python utils/tests_fetcher.py --filter_tests
|
|
- run: export "GIT_COMMIT_MESSAGE=$(git show -s --format=%s)" && echo $GIT_COMMIT_MESSAGE && python .circleci/create_circleci_config.py --fetcher_folder test_preparation
|
|
- run: |
|
|
if [ ! -s test_preparation/generated_config.yml ]; then
|
|
echo "No tests to run, exiting early!"
|
|
circleci-agent step halt
|
|
fi
|
|
|
|
- store_artifacts:
|
|
path: test_preparation
|
|
|
|
- run:
|
|
name: "Retrieve Artifact Paths"
|
|
env:
|
|
CIRCLE_TOKEN: ${{ secrets.CI_ARTIFACT_TOKEN }}
|
|
command: |
|
|
project_slug="gh/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}"
|
|
job_number=${CIRCLE_BUILD_NUM}
|
|
url="https://circleci.com/api/v2/project/${project_slug}/${job_number}/artifacts"
|
|
curl -o test_preparation/artifacts.json ${url}
|
|
- run:
|
|
name: "Show Artifacts"
|
|
command: |
|
|
cat test_preparation/artifacts.json | jq '.items | map({(.path | split("/")[-1][:-4]): .url}) | add | del(.["generated_config"])' > test_preparation/transformed_artifacts.json
|
|
|
|
# To avoid too long generated_config.yaml on the continuation orb, we pass the links to the artifacts as parameters.
|
|
# Otherwise the list of tests was just too big. Explicit is good but for that it was a limitation.
|
|
# We used:
|
|
|
|
# https://circleci.com/docs/api/v2/index.html#operation/getJobArtifacts : to get the job artifacts
|
|
# We could not pass a nested dict, which is why we create the test_file_... parameters for every single job
|
|
|
|
- store_artifacts:
|
|
path: test_preparation/transformed_artifacts.json
|
|
- continuation/continue:
|
|
parameters: test_preparation/transformed_artifacts.json
|
|
configuration_path: test_preparation/generated_config.yml
|
|
|
|
# To run all tests for the nightly build
|
|
fetch_all_tests:
|
|
working_directory: ~/transformers
|
|
docker:
|
|
- image: huggingface/transformers-quality
|
|
parallelism: 1
|
|
steps:
|
|
- checkout
|
|
- run: uv pip install -e .
|
|
- run: |
|
|
mkdir test_preparation
|
|
echo -n "tests" > test_preparation/test_list.txt
|
|
echo -n "all" > test_preparation/examples_test_list.txt
|
|
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
|
|
- run: python .circleci/create_circleci_config.py --fetcher_folder test_preparation
|
|
- run: cp test_preparation/generated_config.yml test_preparation/generated_config.txt
|
|
- store_artifacts:
|
|
path: test_preparation/generated_config.txt
|
|
- continuation/continue:
|
|
configuration_path: test_preparation/generated_config.yml
|
|
|
|
check_code_quality:
|
|
working_directory: ~/transformers
|
|
docker:
|
|
- image: huggingface/transformers-quality
|
|
resource_class: large
|
|
environment:
|
|
TRANSFORMERS_IS_CI: yes
|
|
PYTEST_TIMEOUT: 120
|
|
parallelism: 1
|
|
steps:
|
|
- checkout
|
|
- run: uv pip install -e .
|
|
- run:
|
|
name: Show installed libraries and their versions
|
|
command: pip freeze | tee installed.txt
|
|
- store_artifacts:
|
|
path: ~/transformers/installed.txt
|
|
- run: python -c "from transformers import *" || (echo '🚨 import failed, this means you introduced unprotected imports! 🚨'; exit 1)
|
|
- run: ruff check examples tests src utils
|
|
- run: ruff format tests src utils --check
|
|
- run: python utils/custom_init_isort.py --check_only
|
|
- run: python utils/sort_auto_mappings.py --check_only
|
|
- run: python utils/check_doc_toc.py
|
|
- run: python utils/check_docstrings.py --check_all
|
|
|
|
check_repository_consistency:
|
|
working_directory: ~/transformers
|
|
docker:
|
|
- image: huggingface/transformers-consistency
|
|
resource_class: large
|
|
environment:
|
|
TRANSFORMERS_IS_CI: yes
|
|
PYTEST_TIMEOUT: 120
|
|
parallelism: 1
|
|
steps:
|
|
- checkout
|
|
- run: uv pip install -e .
|
|
- run:
|
|
name: Show installed libraries and their versions
|
|
command: pip freeze | tee installed.txt
|
|
- store_artifacts:
|
|
path: ~/transformers/installed.txt
|
|
- 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
|
|
- run: python utils/check_config_docstrings.py
|
|
- run: python utils/check_config_attributes.py
|
|
- run: python utils/check_doctest_list.py
|
|
- run: make deps_table_check_updated
|
|
- run: python utils/update_metadata.py --check-only
|
|
- run: python utils/check_docstrings.py
|
|
- run: python utils/check_support_list.py
|
|
|
|
workflows:
|
|
version: 2
|
|
setup_and_quality:
|
|
when:
|
|
not: <<pipeline.parameters.nightly>>
|
|
jobs:
|
|
- check_circleci_user
|
|
- check_code_quality
|
|
- check_repository_consistency
|
|
- fetch_tests
|
|
|
|
nightly:
|
|
when: <<pipeline.parameters.nightly>>
|
|
jobs:
|
|
- check_circleci_user
|
|
- check_code_quality
|
|
- check_repository_consistency
|
|
- fetch_all_tests
|