-
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 cmu-sei/feature/ci
Feature/ci
- Loading branch information
Showing
12 changed files
with
326 additions
and
65 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,38 @@ | ||
name: Vessel Linting, Tests and Docker Image Creation | ||
|
||
on: | ||
- push | ||
- pull_request | ||
|
||
jobs: | ||
lint_and_test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v4 | ||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.11' | ||
- name: Install poetry | ||
run: curl -sSL https://install.python-poetry.org | python - | ||
- name: Install dependencies | ||
run: poetry install --with qa,extra_dependencies | ||
- name: Check import sorting | ||
run: make check-isort | ||
- name: Check format | ||
run: make check-format | ||
- name: Lint code | ||
run: make check-lint | ||
- name: Check types | ||
run: make check-typecheck | ||
# - name: Execute unit tests | ||
# run: make test | ||
|
||
docker: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v4 | ||
- name: Docker Build Action | ||
run: docker build -t vessel . |
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,66 @@ | ||
# Automation of various common tasks | ||
|
||
# ----------------------------------------------------------------------------- | ||
# QA | ||
# ----------------------------------------------------------------------------- | ||
|
||
# Sort imports. | ||
.PHONY: isort | ||
isort: | ||
poetry run ruff check --select I --fix | ||
|
||
.PHONY: check-isort | ||
check-isort: | ||
poetry run ruff check --select I | ||
|
||
# Format all source code | ||
.PHONY: format | ||
format: | ||
poetry run ruff format | ||
|
||
.PHONY: check-format | ||
check-format: | ||
poetry run ruff format --check | ||
|
||
# Lint all source code and workflows | ||
.PHONY: lint | ||
lint: | ||
poetry run ruff check --fix | ||
poetry run actionlint | ||
|
||
.PHONY: check-lint | ||
check-lint: | ||
poetry run ruff check | ||
poetry run actionlint | ||
|
||
# Typecheck all source code | ||
.PHONY: typecheck | ||
typecheck: | ||
poetry run mypy vessel/ | ||
|
||
.PHONY: check-typecheck | ||
check-typecheck: typecheck | ||
|
||
# Clean cache files | ||
.PHONY: clean | ||
clean: | ||
rm -r -f .mypy_cache .pytest_cache .ruff_cache | ||
|
||
# All quality assurance | ||
.PHONY: qa | ||
qa: isort format lint typecheck | ||
|
||
# Check all QA tasks | ||
.PHONY: check | ||
check: check-isort check-format check-lint check-typecheck | ||
|
||
# Run unit tests with pytest | ||
.PHONY: test | ||
test: | ||
poetry run pytest test | ||
|
||
# ----------------------------------------------------------------------------- | ||
# All actions and checks equivalent to what the CI does. | ||
# ----------------------------------------------------------------------------- | ||
.PHONY: ci | ||
ci: clean check test |
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
Oops, something went wrong.