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

Make PyCIEMSS testable #32

Merged
merged 12 commits into from
Aug 10, 2023
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
25 changes: 25 additions & 0 deletions .github/workflows/correctness.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
name: Correctness
on:
workflow_call:
push:
branches: ['main']
pull_request:
branches: ['main', 'dev/*']

jobs:
correctness:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v1
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Run image
uses: abatilo/actions-poetry@v2
with:
poetry-version: 1.5.1
- name: Create environment
run: poetry install
- name: Pytest
run: poetry run pytest
27 changes: 27 additions & 0 deletions .github/workflows/formatting.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
name: Formatting
on:
workflow_call:
push:
branches: ['main']
pull_request:
branches: ['main', 'dev/*']

jobs:
formatting:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v1
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Run image
uses: abatilo/actions-poetry@v2
with:
poetry-version: 1.5.1
- name: Create environment
run: poetry install
- name: Black
run: poetry run black . --check --verbose
- name: Ruff
run: poetry run ruff .
27 changes: 0 additions & 27 deletions .github/workflows/lint.yaml

This file was deleted.

9 changes: 9 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
repos:
- repo: https://github.com/psf/black
rev: 23.7.0
hooks:
- id: black
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.0.282
hooks:
- id: ruff
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,15 @@ export LANG
.PHONY:init
init:
make envfile; \
poetry run pre-commit install; \
git submodule update --init; \


.PHONY:tidy
tidy:
poetry run pre-commit run; \
poetry run pytest

# Environment file copy
envfile:
ifeq ($(wildcard envfile),)
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ in order to pull the PyCIEMSS repository in as a submodule and set up the enviro

to start the containers and the API. The API url will be `http://localhost:8010` by default

## Testing

`poetry run pytest` executes tests. Run `make tidy` to execute the code formatter, tests, etc.

## Notes

### Result Files
Expand Down
1 change: 1 addition & 0 deletions docker/Dockerfile.api
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ RUN poetry config virtualenvs.create false && \
poetry install --no-root --no-cache

COPY service service
COPY tests tests
COPY README.md README.md

RUN poetry install
Expand Down
1 change: 1 addition & 0 deletions docker/Dockerfile.worker
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ RUN poetry config virtualenvs.create false && \

RUN pip install --no-cache-dir git+https://github.com/ciemss/pyciemss.git
COPY service service
COPY tests tests
COPY README.md README.md

ENV REDIS_HOST redis
Expand Down
Loading