-
Notifications
You must be signed in to change notification settings - Fork 1
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
Ci/tests #9
Ci/tests #9
Changes from all commits
57c3a47
cdeec5a
5f0ac82
8e8952d
76e76dc
ce502e3
e892302
f16b0be
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
name: CI | ||
|
||
# Concurrency group that uses the workflow name and PR number if available | ||
# or commit SHA as a fallback. If a new build is triggered under that | ||
# concurrency group while a previous build is running it will be canceled. | ||
# Repeated pushes to a PR will cancel all previous builds, while multiple | ||
# merges to main will not cancel. | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} | ||
cancel-in-progress: true | ||
|
||
env: | ||
FORCE_COLOR: "1" # Make tools pretty | ||
|
||
permissions: {} | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
|
||
jobs: | ||
# Run our test suite on various combinations of OS & Python versions | ||
run-pytest: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
python-version: ["3.10", "3.11", "3.12"] | ||
# test fail on windows for now | ||
os: [ubuntu-22.04, ubuntu-latest, macos-latest] | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install poetry | ||
uses: abatilo/actions-poetry@v3 | ||
- name: Setup poetry | ||
run: | | ||
poetry config virtualenvs.create true --local | ||
poetry config virtualenvs.in-project true --local | ||
- uses: actions/cache@v4 | ||
name: Define a cache for the virtual environment based on the dependencies file | ||
with: | ||
path: | | ||
./.venv | ||
poetry.lock | ||
key: venv-${{ hashFiles('pyproject.toml') }}-${{ matrix.python-version }}-${{ matrix.os }} | ||
- name: Install the project dependencies | ||
run: poetry install --with test | ||
- name: Run the test | ||
run: | | ||
poetry run coverage run -m pytest | ||
poetry run coverage xml | ||
- name: Upload Coverage to Codecov | ||
if: matrix.python-version == '3.11' && matrix.os == 'ubuntu-latest' | ||
uses: codecov/codecov-action@v4 | ||
with: | ||
fail_ci_if_error: true | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
|
||
build-site: | ||
name: "build docs" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: "Checkout repository 🛎" | ||
uses: actions/checkout@v4 | ||
- name: Install poetry | ||
uses: abatilo/actions-poetry@v3 | ||
- name: "Install pandoc 📝" | ||
uses: r-lib/actions/setup-pandoc@v2 | ||
with: | ||
pandoc-version: "latest" | ||
- name: Setup poetry | ||
run: | | ||
poetry config virtualenvs.create true --local | ||
poetry config virtualenvs.in-project true --local | ||
- uses: actions/cache@v4 | ||
name: Define a cache for the virtual environment based on the dependencies lock file | ||
with: | ||
path: | | ||
./.venv | ||
poetry.lock | ||
key: venv-${{ hashFiles('pyproject.toml') }} | ||
- name: Install the project dependencies | ||
run: poetry install --with test | ||
- name: "Build docs and check for warnings 📖" | ||
shell: bash | ||
run: | | ||
poetry run sphinx-build docs docs/_build -W | ||
|
||
run-pyright: | ||
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. why not run pre-commit altogether which will include pyright but also black, ruff, etc ? 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. pre-commit is already run with pre-commit.ci. You can see actually that it's run at every commit in this PR, when you show all the checks. And pre-commit no longer runs pyright, because it's a job that needs an installed environment, contrary to other linters, hence the dedicated job here 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. 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. 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 that pre-commit, codecov and RTD are not github actions but webhook, that's why they only appear on the test breakdown insidd the PR but not in the Actions tab 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. I see, thanks ! :) |
||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Install poetry | ||
uses: abatilo/actions-poetry@v3 | ||
- name: Setup poetry | ||
run: | | ||
poetry config virtualenvs.create true --local | ||
poetry config virtualenvs.in-project true --local | ||
- uses: actions/cache@v4 | ||
name: Define a cache for the virtual environment based on the dependencies file | ||
with: | ||
path: | | ||
./.venv | ||
poetry.lock | ||
key: venv-${{ hashFiles('pyproject.toml') }} | ||
- name: Install the project dependencies | ||
run: poetry install --with test | ||
- run: echo "$PWD/.venv/bin" >> $GITHUB_PATH | ||
- uses: jakebailey/pyright-action@v2 | ||
name: Run pyright |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -532,6 +532,7 @@ def test_from_files(): | |
dataset.check() | ||
|
||
|
||
@pytest.mark.xdist_group(name="fiftyone-group") | ||
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. Out of curiosity, why did you group all fiftyone tests? 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. This is done to ensure they are run in the same process. Now, you can launch the tests locally with multiple proceses, thanks to pytest xdist : https://pytest-xdist.readthedocs.io/en/stable/ But the tests involving fiftyone must be run sequentially becasue there can be only one mongodb runnin at the same time. |
||
def test_to_fiftyone(): | ||
val_dataset = from_coco( | ||
coco_json=DATA / "coco_dataset/annotations_valid.json", | ||
|
@@ -563,6 +564,7 @@ def test_to_fiftyone(): | |
fo.delete_dataset("dataset") | ||
|
||
|
||
@pytest.mark.xdist_group(name="fiftyone-group") | ||
def test_to_fiftyone_empty(): | ||
val_dataset = from_coco( | ||
coco_json=DATA / "coco_dataset/annotations_valid.json", | ||
|
@@ -578,6 +580,7 @@ def test_to_fiftyone_empty(): | |
fo.delete_dataset("dataset") | ||
|
||
|
||
@pytest.mark.xdist_group(name="fiftyone-group") | ||
def test_to_fiftyone_debooleanize(): | ||
dataset = from_caipy_generic( | ||
annotations_folder=DATA / "caipy_dataset" / "tags" / "default_schema", | ||
|
@@ -596,6 +599,7 @@ def test_to_fiftyone_debooleanize(): | |
fo.delete_dataset("dataset") | ||
|
||
|
||
@pytest.mark.xdist_group(name="fiftyone-group") | ||
def test_to_fiftyone_keypoint(): | ||
dataset = from_coco_keypoints( | ||
coco_json=DATA / "coco_dataset/annotations_keypoints.json", | ||
|
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.
So we run this stage as a safetly measure to detect warnings in the doc (that are not detected by RTD's builds) and the publish of the doc is handeled by RTD right?
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.
Yes