-
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.
Merge pull request #1 from cospectrum/dev
add `ci`
- Loading branch information
Showing
4 changed files
with
67 additions
and
2 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,15 @@ | ||
name: Lint GitHub Actions workflows | ||
on: [push, pull_request] | ||
|
||
jobs: | ||
actionlint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Download actionlint | ||
id: get_actionlint | ||
run: bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash) | ||
shell: bash | ||
- name: Check workflow files | ||
run: ${{ steps.get_actionlint.outputs.executable }} -color | ||
shell: bash |
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: ci | ||
|
||
on: | ||
push: | ||
branches: [main, master] | ||
pull_request: | ||
|
||
# If new code is pushed to a PR branch, then cancel in progress workflows for that PR. Ensures that | ||
# we don't waste CI time | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
python: | ||
runs-on: ubuntu-latest | ||
name: python | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
lfs: true | ||
- name: Install uv | ||
uses: astral-sh/setup-uv@v4 | ||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version-file: ".python-version" | ||
- name: Install the project | ||
run: uv sync --all-extras --dev | ||
- name: pytest | ||
run: uv run pytest | ||
- name: mypy | ||
run: uv run mypy . | ||
- name: ruff check | ||
run: uv run ruff check | ||
- name: ruff format | ||
run: uv run ruff format --check |
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
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 |
---|---|---|
@@ -1,7 +1,17 @@ | ||
import pytest | ||
import os | ||
|
||
from pathlib import Path | ||
from microwink import SegModel | ||
|
||
KiB = 2**10 | ||
MiB = (2**10) * KiB | ||
|
||
|
||
@pytest.fixture | ||
def seg_model() -> SegModel: | ||
return SegModel.from_path("./models/seg_model.onnx") | ||
path = Path("./models/seg_model.onnx") | ||
assert path.exists() | ||
size = os.path.getsize(path) | ||
assert 10 * MiB < size < 15 * MiB | ||
return SegModel.from_path(path) |