Skip to content
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
46 changes: 46 additions & 0 deletions .github/workflows/codetools.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: ci

on: [push, pull_request]

env:
PACKAGE: virtual_ship
TESTS: tests

jobs:
codetools:
runs-on: ubuntu-20.04
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5.1.0
with:
python-version: ${{ matrix.python-version }}
- name: install
run: pip install ".[dev]"
- name: flake8
run: flake8 ./$PACKAGE ./$TESTS
- name: pydocstyle
run: pydocstyle ./$PACKAGE
- name: sort-all
run: |
find ./$PACKAGE -type f -name '__init__.py' -print0 | xargs -0 sort-all
[[ -z $(git status -s) ]]
git checkout -- .
- name: black
run: black --diff --check ./$PACKAGE ./$TESTS
- name: isort
run: isort --check-only --diff ./$PACKAGE ./$TESTS

tests:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5.1.0
with:
python-version: 3.12
- name: install
run: pip install ".[dev]"
- name: run_tests
run: pytest --cov=virtual_ship tests
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -169,3 +169,8 @@ cython_debug/
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

# Auto generated by setuptools scm
virtual_ship/_version_setup.py

.vscode/
143 changes: 0 additions & 143 deletions Sail_the_ship.ipynb

This file was deleted.

39 changes: 39 additions & 0 deletions codetools.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/sh

# Runs all codetools and attempts to apply fixes wherever possible.
# Not suitable for the CI as that should not make any changes.

set -e

# Set working directory to the directory of this script.
cd "$(dirname "$0")"

PACKAGE=virtual_ship
TESTS=tests

echo "--------------"
echo "flake8"
echo "--------------"
flake8 ./$PACKAGE ./$TESTS
# darglint is ran as a plugin for flake8.

echo "--------------"
echo "pydocstyle"
echo "--------------"
pydocstyle ./$PACKAGE ./$TESTS

echo "--------------"
echo "sort-all"
echo "--------------"
find ./$PACKAGE -type f -name '__init__.py' -print0 | xargs -0 sort-all

echo "--------------"
echo "black"
echo "--------------"
black ./$PACKAGE ./$TESTS

echo "--------------"
echo "isort"
echo "--------------"
isort ./$PACKAGE ./$TESTS

Loading