diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..f390822 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,98 @@ +name: CI + +on: + push: + branches: + - main + pull_request: + workflow_dispatch: + +env: + FORCE_COLOR: "1" + PIP_DISABLE_PIP_VERSION_CHECK: "1" + PIP_NO_PYTHON_VERSION_WARNING: "1" + +jobs: + run-checks: + name: Run linter and tests + runs-on: ubuntu-latest + + steps: + - name: Checkout ๐Ÿ›Ž๏ธ + uses: actions/checkout@v4 + + - name: Set up Python ๐Ÿ + uses: actions/setup-python@v5 + with: + cache: pip + + - name: Install dependencies ๐Ÿ“ฆ๏ธ + run: | + pip install --upgrade pip + pip install -r requirements/requirements-dev.txt + pip install -e . + + - name: Lint ๐Ÿงน + run: ruff check + + - name: Run tests ๐Ÿงช + run: | + pip install --upgrade pip + pip install -r requirements/requirements-dev.txt + pip install -e . + coverage run -m pytest + + - name: Upload coverage data ๐Ÿ“ค + uses: actions/upload-artifact@v4 + with: + name: coverage + path: .coverage + include-hidden-files: true + if-no-files-found: ignore + + coverage: + # https://hynek.me/articles/ditch-codecov-python/ + name: Generate coverage report + runs-on: ubuntu-latest + needs: run-checks + if: always() + + steps: + - name: Checkout ๐Ÿ›Ž๏ธ + uses: actions/checkout@v4 + with: + persist-credentials: false + + - name: Set up Python ๐Ÿ + uses: actions/setup-python@v5 + with: + cache: pip + + - name: Install uv ๐ŸŒŸ + uses: astral-sh/setup-uv@v5 + with: + version: ">=0.0.1" + + - name: Download coverage data ๐Ÿ“ฅ + uses: actions/download-artifact@v4 + with: + name: coverage + merge-multiple: true + + - name: Generate coverage report ๐Ÿ“Š + run: | + uv tool install coverage + coverage html --skip-covered --skip-empty + coverage report --format=markdown >> $GITHUB_STEP_SUMMARY + + # Generate report again, this time with a fail-under threshold + coverage report --fail-under=80 + + - name: Upload HTML report if coverage check fails + uses: actions/upload-artifact@v4 + with: + name: html-cov-report + path: htmlcov + if: ${{ failure() }} + + diff --git a/.github/workflows/run-code-checks.yaml b/.github/workflows/run-code-checks.yaml deleted file mode 100644 index 5b38f17..0000000 --- a/.github/workflows/run-code-checks.yaml +++ /dev/null @@ -1,31 +0,0 @@ -name: run-code-checks - -on: - push: - workflow_dispatch: - -jobs: - run-checks: - runs-on: ubuntu-latest - steps: - - name: Checkout ๐Ÿ›Ž๏ธ - uses: actions/checkout@v4 - - - name: Set up Python ๐Ÿ - uses: actions/setup-python@v5 - with: - cache: pip - - - name: Install dependencies ๐Ÿ“ฆ๏ธ - run: | - pip install --upgrade pip - pip install -r requirements/requirements-dev.txt - pip install -e . - - - name: Lint ๐Ÿงน - run: ruff check - - - name: Run unit tests ๐Ÿงช - run: | - pytest -k unit - diff --git a/.github/workflows/run-integration-tests.yaml b/.github/workflows/run-integration-tests.yaml deleted file mode 100644 index e4c7ce5..0000000 --- a/.github/workflows/run-integration-tests.yaml +++ /dev/null @@ -1,30 +0,0 @@ -name: run-integration-tests - -on: - push: - branches: - - main - pull_request: - types: [opened, ready_for_review, reopened] - workflow_dispatch: - -jobs: - run-checks: - runs-on: ubuntu-latest - steps: - - name: Checkout ๐Ÿ›Ž๏ธ - uses: actions/checkout@v4 - - - name: Set up Python ๐Ÿ - uses: actions/setup-python@v5 - with: - cache: pip - - - name: Install dependencies ๐Ÿ“ฆ๏ธ - run: | - pip install --upgrade pip - pip install -r requirements/requirements-dev.txt - pip install -e . - - - name: Run integration tests ๐Ÿงช - run: pytest -k integration diff --git a/README.md b/README.md index bb61c51..059bbd7 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +![cladetime CI status](https://github.com/reichlab/cladetime/actions/workflows/ci.yaml/badge.svg) + # User Guide Cladetime is a wrapper around Nextstrain's GenBank-based SARS-CoV-2 genome