-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci(workflows): add GitHub Actions for coverage, docs, and test/lint a…
…utomation - Added `coverage.yml` for automated code coverage reports with Codecov on pushes and pull requests to `main` - Created `docs.yml` to build Sphinx documentation on-demand, ensuring the latest documentation for workflow dispatch - Implemented `test-lint.yml` to automate testing, linting with flake8, and code formatting checks with black for consistency These workflows streamline CI/CD for testing, documentation, and coverage, improving project reliability and maintainability.
- Loading branch information
1 parent
e0b5f22
commit c8771b2
Showing
3 changed files
with
106 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: Code Coverage | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
branches: [main] | ||
|
||
jobs: | ||
codecov: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0 | ||
with: | ||
python-version: "3.12" | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install ".[dev]" | ||
- name: Run tests with coverage | ||
run: pytest --cov=spacy_ewc --cov-report xml tests/ | ||
|
||
- name: Upload coverage to Codecov | ||
uses: codecov/codecov-action@b9fd7d16f6d7d1b5d2bec1a2887e65ceed900238 # v4.6.0 | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
files: coverage.xml | ||
flags: unittests | ||
name: codecov-umbrella | ||
verbose: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: Documentation | ||
|
||
on: workflow_dispatch | ||
|
||
jobs: | ||
build-docs: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0 | ||
with: | ||
python-version: "3.12" | ||
|
||
- name: Install dependencies for docs | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install ".[doc]" | ||
- name: Build Sphinx documentation | ||
run: sphinx-build -b html docs/ docs/_build/ | ||
|
||
# Optional: Deploy to GitHub Pages | ||
# - name: Deploy to GitHub Pages | ||
# uses: peaceiris/actions-gh-pages@<latest_commit_sha_for_gh_pages> | ||
# with: | ||
# github_token: ${{ secrets.GITHUB_TOKEN }} | ||
# publish_dir: docs/_build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: Test and Lint | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
branches: [main] | ||
|
||
jobs: | ||
test-lint: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0 | ||
with: | ||
python-version: "3.12" | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install ".[dev]" | ||
- name: Run tests | ||
run: pytest -x --disable-warnings | ||
|
||
- name: Run linting with flake8 | ||
run: | | ||
flake8 spacy_ewc/ examples/ | ||
- name: Check code formatting with black | ||
run: black --check spacy_ewc/ examples/ | ||
|
||
- name: Run EWC example script | ||
run: python examples/ewc_ner_training_example.py |