-
Notifications
You must be signed in to change notification settings - Fork 3k
Transfer CI to GitHub Actions #4659
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
42335bf
f252601
67dde3a
cfc2765
dedbd9e
244ca80
0ba62e7
a866d96
209c3e6
d5fcce7
6f60f9b
6af0e2c
a6856ea
2621e7f
4a603fc
23beaef
ccdf337
f337ffa
193a737
dd702ed
a2a4621
9615fd3
780236f
0546772
699a95e
ae3a426
791b062
3d18045
5b9451d
b41592c
d36662d
c7f3e0e
ed18815
6546153
3fecef7
2217769
499f92d
f78e6ba
04eefe0
d266caa
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| name: CI | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: | ||
| - main | ||
|
|
||
| env: | ||
| HF_SCRIPTS_VERSION: main | ||
| HF_ALLOW_CODE_EVAL: 1 | ||
|
|
||
| jobs: | ||
|
|
||
| check_code_quality: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v3 | ||
| - name: Set up Python | ||
| uses: actions/setup-python@v4 | ||
| with: | ||
| python-version: "3.6" | ||
| - name: Install dependencies | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| pip install .[quality] | ||
| - name: Check quality | ||
| run: | | ||
| black --check --line-length 119 --target-version py36 tests src benchmarks datasets metrics | ||
| isort --check-only tests src benchmarks datasets metrics | ||
| flake8 tests src benchmarks datasets metrics | ||
|
|
||
| test: | ||
| needs: check_code_quality | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| os: [ubuntu-latest, windows-latest] | ||
| pyarrow_version: [latest, 6.0.1] | ||
| runs-on: ${{ matrix.os }} | ||
| steps: | ||
| - name: Install OS dependencies | ||
| if: ${{ matrix.os == 'ubuntu-latest' }} | ||
| run: | | ||
| sudo apt-get -y update | ||
| sudo apt-get -y install libsndfile1 sox | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Previous OS dependency |
||
| - uses: actions/checkout@v3 | ||
| with: | ||
| fetch-depth: 0 | ||
|
Comment on lines
+46
to
+48
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note The reason for this is to be able to collect the test diff_output = check_output(["git", "diff", "--name-only", "origin/main...HEAD"], cwd=repo_path)Otherwise, an error is raised: because of: |
||
| - name: Set up Python 3.6 | ||
| if: ${{ matrix.os == 'ubuntu-latest' }} | ||
| uses: actions/setup-python@v4 | ||
| with: | ||
| python-version: 3.6 | ||
| - name: Set up Python 3.7 | ||
| if: ${{ matrix.os == 'windows-latest' }} | ||
| uses: actions/setup-python@v4 | ||
| with: | ||
| python-version: 3.7 | ||
| - name: Upgrade pip | ||
| run: python -m pip install --upgrade pip | ||
| - name: Pin setuptools-scm | ||
| if: ${{ matrix.os == 'ubuntu-latest' }} | ||
| run: echo "installing pinned version of setuptools-scm to fix seqeval installation on 3.6" && pip install "setuptools-scm==6.4.2" | ||
| - name: Install dependencies | ||
| run: | | ||
| pip install .[tests] | ||
| pip install -r additional-tests-requirements.txt --no-deps | ||
| - name: Install latest PyArrow | ||
| if: ${{ matrix.pyarrow_version == 'latest' }} | ||
| run: pip install pyarrow --upgrade | ||
| - name: Install PyArrow ${{ matrix.pyarrow_version }} | ||
| if: ${{ matrix.pyarrow_version != 'latest' }} | ||
| run: pip install pyarrow==${{ matrix.pyarrow_version }} | ||
| - name: Test with pytest | ||
| run: | | ||
| python -m pytest -n 2 --dist loadfile -sv ./tests/ | ||
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3119,9 +3119,9 @@ def test_pickle_dataset_after_transforming_the_table(in_memory, method_and_param | |
|
|
||
|
|
||
| @pytest.mark.skipif( | ||
| os.name == "nt" and os.getenv("CIRCLECI") == "true", | ||
| reason='On Windows CircleCI, it raises botocore.exceptions.EndpointConnectionError: Could not connect to the endpoint URL: "http://127.0.0.1:5555/test"', | ||
| ) # TODO(QL): find what's wrong with CircleCI | ||
| os.name == "nt" and (os.getenv("CIRCLECI") == "true" or os.getenv("GITHUB_ACTIONS") == "true"), | ||
| reason='On Windows CircleCI or GitHub Actions, it raises botocore.exceptions.EndpointConnectionError: Could not connect to the endpoint URL: "http://127.0.0.1:5555/test"', | ||
| ) # TODO: find what's wrong with CircleCI / GitHub Actions | ||
|
Comment on lines
+3122
to
+3124
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As in CircleCI, this test must be skipped in GitHub Actions as well to avoid an error. |
||
| @require_s3 | ||
| def test_dummy_dataset_serialize_s3(s3, dataset): | ||
| mock_bucket = s3_test_bucket_name | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -665,9 +665,9 @@ def test_datasetdict_from_text_split(split, text_path, tmp_path): | |
|
|
||
|
|
||
| @pytest.mark.skipif( | ||
| os.name == "nt" and os.getenv("CIRCLECI") == "true", | ||
| reason='On Windows CircleCI, it raises botocore.exceptions.EndpointConnectionError: Could not connect to the endpoint URL: "http://127.0.0.1:5555/test"', | ||
| ) # TODO(QL): find what's wrong with CircleCI | ||
| os.name == "nt" and (os.getenv("CIRCLECI") == "true" or os.getenv("GITHUB_ACTIONS") == "true"), | ||
| reason='On Windows CircleCI or GitHub Actions, it raises botocore.exceptions.EndpointConnectionError: Could not connect to the endpoint URL: "http://127.0.0.1:5555/test"', | ||
| ) # TODO: find what's wrong with CircleCI / GitHub Actions | ||
|
Comment on lines
+668
to
+670
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above. |
||
| @require_s3 | ||
| def test_dummy_dataset_serialize_s3(s3, dataset): | ||
| dsets = DatasetDict({"train": dataset, "test": dataset.select(range(2))}) | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
check_code_qualityjob must complete successfully before thetestjobs will run.This saves CI running time (billing and environmental impact).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I would still run the tests even if the code quality check doesn't succeed. This will avoid having to review a first time to tell the user to fix code quality, and then later review a second time to fix the tests
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lhoestq I'm not sure of understanding your point.
make style, BTW, but for the more expensivemake qualityonly); once the code quality issue is fixed, the new push will make all tests run anywayUh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the specific use case you mention, the reviewer should say to the contributor: you should run locally both the code quality checks and the tests, before pushing