Skip to content
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

Add workflow for private tests #2413

Merged
merged 2 commits into from
Jan 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 75 additions & 0 deletions .github/workflows/test_linux_private.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Test (Linux, private)

on:
push:
branches:
[main, 0.15.x, 0.16.x, 0.17.x, 0.18.x, 0.19.x, 0.20.x, 1.0.x, 1.1.x]
pull_request:
branches:
[main, 0.15.x, 0.16.x, 0.17.x, 0.18.x, 0.19.x, 0.20.x, 1.0.x, 1.1.x]
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
test:
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash -e {0} # -e to fail on error

strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python: ["3.11"]

environment:
name: private_test

permissions:
id-token: write

name: ${{ matrix.name }} Python ${{ matrix.python }} private

env:
OS: ${{ matrix.os }}
PYTHON: ${{ matrix.python }}

steps:
- uses: actions/checkout@v4
- uses: aws-actions/configure-aws-credentials@v4
with:
audience: sts.amazonaws.com
role-to-assume: arn:aws:iam::${{ secrets.AWS_IAM }}:role/scvi-tools_private_test
aws-region: us-west-2
role-duration-seconds: 3600
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
cache: "pip"
cache-dependency-path: "**/pyproject.toml"

- name: Install test dependencies
run: |
python -m pip install --upgrade pip wheel

- name: Install dependencies
run: |
pip install ".[tests]"

- name: Test
env:
MPLBACKEND: agg
PLATFORM: ${{ matrix.os }}
DISPLAY: :42
run: |
coverage run -m pytest -v --color=yes --private
- name: Report coverage
run: |
coverage report
- name: Upload coverage
uses: codecov/codecov-action@v3
14 changes: 14 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ def pytest_addoption(parser):
default=0,
help="Option to specify which scvi-tools seed to use for tests.",
)
parser.addoption(
"--private",
action="store_true",
default=False,
help="Run tests that are private.",
)


def pytest_configure(config):
Expand All @@ -64,6 +70,14 @@ def pytest_collection_modifyitems(config, items):
if not run_optional and ("optional" in item.keywords):
item.add_marker(skip_optional)

run_private = config.getoption("--private")
skip_private = pytest.mark.skip(reason="need --private option to run")
for item in items:
# All tests marked with `pytest.mark.private` get skipped unless
# `--private` passed
if not run_private and ("private" in item.keywords):
item.add_marker(skip_private)


@pytest.fixture(scope="session")
def save_path(tmp_path_factory):
Expand Down
Loading