Skip to content

Commit

Permalink
complete quality checks
Browse files Browse the repository at this point in the history
  • Loading branch information
exs-whaddadin committed Nov 20, 2023
1 parent e73b19c commit b33f791
Show file tree
Hide file tree
Showing 11 changed files with 156 additions and 36 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/alpha-release-ci-actions.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: Alpha release CI Actions

on:
push:
tags:
- '*.*.*'

jobs:
publish-package:
uses: ./.github/workflows/publish-package.yaml
11 changes: 11 additions & 0 deletions .github/workflows/dev-ci-actions.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: Dev CI Actions

on:
pull_request:

jobs:
quality-checks:
uses: ./.github/workflows/quality-typing-checks.yaml
test-run-pinned:
uses: ./.github/workflows/pinned-tests.yaml
needs: [quality-checks]
12 changes: 12 additions & 0 deletions .github/workflows/main-ci-actions.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Dev CI Actions

on:
branch:
- main

jobs:
quality-checks:
uses: ./.github/workflows/quality-typing-checks.yaml
test-run-pinned:
uses: ./.github/workflows/pinned-tests.yaml
needs: [quality-checks]
30 changes: 30 additions & 0 deletions .github/workflows/pinned-tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Pinned Tests

on:
workflow_call:

jobs:
tests-pinned:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.11"]

steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- name: Run pinned tests
run: |
pip install nox
nox -s tests_run_pinned-${{ matrix.python-version }}
- name: Test Summary
uses: test-summary/action@v2
with:
paths: "test-reports/${{ matrix.python-version }}/.junitxml.*.xml"
show: "fail"
if: always()
24 changes: 24 additions & 0 deletions .github/workflows/publish-package.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Publish package

on:
workflow_call:

jobs:
publish-package:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: '3.11'
cache: 'pip'
- name: Build package
run: |
pip install nox
nox -s dist_build-3.11
- name: Deploy package
run: |
pip install twine
python -m twine upload --verbose -u __token__ -p ${{ secrets.EXS_PYPI_TOKEN }} dist/*
29 changes: 0 additions & 29 deletions .github/workflows/quality-checks.yaml

This file was deleted.

43 changes: 43 additions & 0 deletions .github/workflows/quality-typing-checks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Quality and Typing Checks

on:
workflow_call:

jobs:
quality-checks:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: '3.11'
cache: 'pip'
- name: Linting check
run: |
pip install nox
nox -s linting_check-3.11
- name: Formatting check
run: |
pip install nox
nox -s formatting_check-3.11
typing-check:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.11"]

steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- name: Typing check
run: |
pip install nox
nox -s typing_check-${{ matrix.python-version }}
3 changes: 3 additions & 0 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@

EXTRAS = list(set(EXTRAS))

# skip openeye in github actions (cannot pip install)
EXTRAS.remove("openeye")

INVERTED_SUBMODULE_EXTRAS = {}
for extra in EXTRAS:
doctests_target_dir_core = []
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ dependencies = [
[project.optional-dependencies]
openeye = [
'openeye-toolkits<2023.0.0; python_version == "3.8"', # openeye 2023 not supported on python 3.8
'openeye-toolkits',
'openeye-toolkits>=2023.0.0',
]
rdkit = [
'mhfp',
Expand Down
13 changes: 10 additions & 3 deletions tests/datasets/core/unit/io/test_save_dataset_to_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,13 @@ def test_save_dataset_to_s3(
@pytest.mark.parametrize(
("path", "format", "filesystem"),
[
("s3://my/bucket/data.parquet", "parquet", fsspec.filesystem("file")),
("my/data.parquet", "parquet", fsspec.filesystem("s3")),
("s3://my/bucket/data.parquet", "parquet", "file"),
("my/data.parquet", "parquet", "s3"),
],
)
def test_save_dataset_with_mismatched_filesystem_raises(
fixture_mock_s3_client,
fixture_mock_s3_filesystem,
fixture_mock_dataset,
path,
format,
Expand All @@ -143,7 +145,12 @@ def test_save_dataset_with_mismatched_filesystem_raises(
local filesystem (local) raises (and vice-versa)."""
dataset = fixture_mock_dataset
with pytest.raises(ValueError, match="Incompatible filesystem"):
save_dataset_to_store(dataset, path=str(path), format=format, fs=filesystem)
save_dataset_to_store(
dataset,
path=str(path),
format=format,
fs=fsspec.filesystem(filesystem),
)


@pytest.mark.parametrize(
Expand Down
15 changes: 12 additions & 3 deletions tests/datasets/core/unit/test_filesystems.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,19 @@
from molflux.datasets.filesystems import S3FileSystem


def test_s3_filesystem_is_fsspec_compliant():
def test_s3_filesystem_is_fsspec_compliant(
fixture_mock_s3_client,
fixture_mock_s3_filesystem,
):
"""That our custom S3FileSystem implements the fsspec protocol."""
filesystem = S3FileSystem()
assert isinstance(filesystem, fsspec.AbstractFileSystem)


def test_s3_filesystem_is_registered_with_fsspec():
def test_s3_filesystem_is_registered_with_fsspec(
fixture_mock_s3_client,
fixture_mock_s3_filesystem,
):
"""That our custom S3FileSystem is registered as an official fsspec entrypoint.
References:
Expand All @@ -19,7 +25,10 @@ def test_s3_filesystem_is_registered_with_fsspec():
assert isinstance(filesystem, S3FileSystem)


def test_s3_path_gets_mapped_to_our_s3_filesystem():
def test_s3_path_gets_mapped_to_our_s3_filesystem(
fixture_mock_s3_client,
fixture_mock_s3_filesystem,
):
"""That fsspec dispatches s3 paths to our custom S3FileSystem."""
path = "s3://my-bucket/test"
fs_token_paths = fsspec.get_fs_token_paths(path)
Expand Down

0 comments on commit b33f791

Please sign in to comment.