-
Notifications
You must be signed in to change notification settings - Fork 2
Add CI #38
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
Merged
Merged
Add CI #38
Changes from all commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
135e918
:tada: Initial testing framework
jemrobinson dccce04
:wrench: Add pre-commmit linting and formatting
jemrobinson d544568
:wrench: Add a code testing CI job
jemrobinson 2d291ce
:wrench: Run mypy in strict mode
jemrobinson 24f745a
:truck: Move mypy verification from pre-commit to uv
jemrobinson 852eed5
:wrench: Ignore external libraries when type-checking
jemrobinson 93f2103
:arrow_up: Add mypy and pandas-stubs to test group
jemrobinson 9d0dd3a
:rotating_light: Fix formatting issues
jemrobinson 0323d3f
:bug: Fix loop variable shadowing global variable
jemrobinson 0da5f5a
:alien: Ignore type issues for explicitly overridden hydra decorator
jemrobinson a3e0b89
:alien: Ignore assigment type errors for DictConfigs with known contents
jemrobinson d6f86a3
:alien: Add explicit method for constructing a DataSpace from a DictC…
jemrobinson dbc7c0c
:truck: Move LightningBatch to types
jemrobinson 4e521f6
:bug: Fix type-checking paths when loading data from trainer test_dat…
jemrobinson dbab2b6
:label: Fix missing types where the default was ambiguous
jemrobinson 0d0ec38
:art: Convert multi-valued metrics into single value before logging
jemrobinson be8f8d6
:art: Consistently overwrite config values with calculated values whe…
jemrobinson 2d4d157
:bug: CLI checks need to account for coloured output text
jemrobinson 26708a8
:art: Copy function docstring into wrapper docstring when applying hy…
jemrobinson 36f357b
:white_check_mark: Add CLI --help tests
jemrobinson 4d10da1
:truck: Refactored tests into classes and ensured that executable nam…
jemrobinson 2811558
:wrench: Use uv standard naming for environments and build system
jemrobinson 8b46966
:wrench: Add test coverage comment bot
jemrobinson 2209806
:arrow_down: Note that Python 3.13 is currently incompatible with the…
jemrobinson 3e23f67
:memo: Add notes about running tests and style checks
jemrobinson 39db2bd
:art: Renamed function as per CoPilot suggestion
jemrobinson db78acc
:wrench: Update permissions for code-coverage commenting
jemrobinson 8e89cfd
:wrench: Update coverage settings
jemrobinson File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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,26 @@ | ||
| --- | ||
| name: Fix code style | ||
|
|
||
| # Run workflow on pushes to matching branches | ||
| on: # yamllint disable-line rule:truthy | ||
| push: | ||
| branches: [main] | ||
| pull_request: | ||
|
|
||
| jobs: | ||
| fix_code_style: | ||
| runs-on: ubuntu-latest | ||
| name: Format and lint code | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| - name: Setup Python | ||
| uses: actions/setup-python@v4 | ||
| with: | ||
| python-version: "3.11" | ||
| - name: Run pre-commit | ||
| uses: pre-commit/action@v3.0.1 | ||
| with: | ||
| extra_args: --hook-stage manual --all-files |
This file contains hidden or 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,58 @@ | ||
| --- | ||
| name: Run tests | ||
|
|
||
| # Run workflow on pushes to matching branches | ||
| on: # yamllint disable-line rule:truthy | ||
| push: | ||
| branches: [main] | ||
| pull_request: | ||
|
|
||
| jobs: | ||
| run_tests: | ||
| runs-on: ubuntu-latest | ||
| name: Run Python tests | ||
| permissions: | ||
| # Gives the action the necessary permissions for publishing new | ||
| # comments in pull requests. | ||
| pull-requests: write | ||
| # Gives the action the necessary permissions for pushing data to the | ||
| # python-coverage-comment-action branch, and for editing existing | ||
| # comments (to avoid publishing multiple comments in the same PR) | ||
| contents: write | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| python-version: ["3.11", "3.12"] | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| - name: Set up Python ${{ matrix.python-version }} | ||
| uses: actions/setup-python@v4 | ||
| with: | ||
| python-version: ${{ matrix.python-version }} | ||
| - name: Install uv | ||
| uses: astral-sh/setup-uv@v6 | ||
| with: | ||
| version: "0.8.3" | ||
| - name: Run pytest | ||
| run: uv run --group dev pytest | ||
| - name: Run mypy | ||
| run: uv run --group dev mypy . | ||
| # For security reasons, PRs created from forks cannot generate PR comments directly | ||
| # (see https://securitylab.github.com/research/github-actions-preventing-pwn-requests/). | ||
| # Instead we need to trigger another workflow after this one completes. | ||
| - name: Generate test coverage comment | ||
| id: coverage_comment | ||
| uses: py-cov-action/python-coverage-comment-action@v3 | ||
| with: | ||
| GITHUB_TOKEN: ${{ github.token }} | ||
| # Save the coverage comment for later use | ||
| # See https://github.com/py-cov-action/python-coverage-comment-action/blob/main/README.md | ||
| - name: Save coverage comment as an artifact | ||
| uses: actions/upload-artifact@v4 | ||
| if: steps.coverage_comment.outputs.COMMENT_FILE_WRITTEN == 'true' | ||
| with: | ||
| name: python-coverage-comment-action | ||
| path: python-coverage-comment-action.txt |
This file contains hidden or 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,32 @@ | ||
| --- | ||
| name: Post test coverage GitHub comment | ||
|
|
||
| # Run workflow after test_code has completed | ||
| on: # yamllint disable-line rule:truthy | ||
| workflow_run: | ||
| workflows: ["Run tests"] | ||
| types: | ||
| - completed | ||
|
|
||
| jobs: | ||
| coverage: | ||
| runs-on: ubuntu-latest | ||
| if: github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success' | ||
| permissions: | ||
| # Gives the action the necessary permissions for publishing new | ||
| # comments in pull requests. | ||
| pull-requests: write | ||
| # Gives the action the necessary permissions for editing existing | ||
| # comments (to avoid publishing multiple comments in the same PR) | ||
| contents: write | ||
| # Gives the action the necessary permissions for looking up the | ||
| # workflow that launched this workflow, and download the related | ||
| # artifact that contains the comment to be published | ||
| actions: read | ||
| steps: | ||
| # Post the pre-generated coverage comment | ||
| - name: Post coverage comment | ||
| uses: py-cov-action/python-coverage-comment-action@v3 | ||
| with: | ||
| GITHUB_TOKEN: ${{ github.token }} | ||
| GITHUB_PR_RUN_ID: ${{ github.event.workflow_run.id }} |
This file contains hidden or 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 |
|---|---|---|
| @@ -1,8 +1,10 @@ | ||
| __pycache__ | ||
| .coverage | ||
| .DS_Store | ||
| .ipynb_checkpoints/ | ||
| .python-version | ||
| .venv | ||
| *local.yaml | ||
| dist | ||
| outputs | ||
| wandb/ | ||
| wandb |
This file contains hidden or 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,30 @@ | ||
| ci: | ||
| autoupdate_commit_msg: ":rotating_light: Fix pre-commit linting errors" | ||
| autofix_commit_msg: ":rotating_light: Fix pre-commit linting errors" | ||
|
|
||
| repos: | ||
| - repo: https://github.com/pre-commit/pre-commit-hooks | ||
| rev: "v5.0.0" | ||
| hooks: | ||
| - id: check-added-large-files | ||
| - id: check-case-conflict | ||
| - id: check-merge-conflict | ||
| - id: check-symlinks | ||
| - id: check-yaml | ||
| - id: debug-statements | ||
| - id: end-of-file-fixer | ||
| - id: mixed-line-ending | ||
| - id: name-tests-test | ||
| args: ["--pytest-test-first"] | ||
| exclude: ^tests/legacy_metrics.py | ||
| - id: trailing-whitespace | ||
|
|
||
| - repo: https://github.com/astral-sh/ruff-pre-commit | ||
| rev: "v0.12.5" | ||
| hooks: | ||
| # Run the linter | ||
| - id: ruff | ||
| types_or: [python, pyi] | ||
| args: ["--fix", "--show-fixes"] | ||
| # Run the formatter | ||
| - id: ruff-format |
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -2,4 +2,4 @@ defaults: | |
| - callbacks: | ||
| - metric_summary | ||
| - plotting | ||
| - _self_ | ||
| - _self_ | ||
This file contains hidden or 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
This file contains hidden or 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 |
|---|---|---|
| @@ -1,5 +1,7 @@ | ||
| from .combined_dataset import CombinedDataset | ||
| from .zebra_data_module import ZebraDataModule | ||
|
|
||
| __all__ = [ | ||
| "CombinedDataset", | ||
| "ZebraDataModule", | ||
| ] |
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.