Skip to content
Open
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
35 changes: 35 additions & 0 deletions .github/workflows/deploy-documentation.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Deploy

on:
release:
types: [released]

jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
steps:

- name: Checkout the repository
uses: actions/checkout@v3

- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: "3.9"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements-dev.txt

- name: Build documentation
run: python scripts/gen-cli-docs.py

- name: Deploy docs
run: mkdocs gh-deploy --clean

- name: Deploy to PyPI
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.PYPI_API_TOKEN }}
38 changes: 38 additions & 0 deletions .github/workflows/linting-testing.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Linting and Testing

on:
push:
branches:
- master
pull_request:

jobs:
linting-testing:
name: Linting and Testing
strategy:
matrix:
version: ["3.5", "3.6", "3.7", "3.8", "3.9"]
runs-on: ubuntu-latest
steps:

- name: Checkout the repository
uses: actions/checkout@v3

- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements-dev.txt

- name: Run black
run: black --check .

- name: Run flake8
run: flake8 --show-source watson/ tests/ scripts/

- name: Run pytest
run: pytest tests
30 changes: 0 additions & 30 deletions .travis.yml

This file was deleted.

1 change: 0 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ include mkdocs.yml
include README.md
include requirements-dev.txt
include requirements.txt
include tox.ini
include watson.completion
include watson.zsh-completion

Expand Down
21 changes: 2 additions & 19 deletions docs/contributing/hack.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,9 @@ Ready to contribute? Here's how to set up *Watson* for local development.
inside the virtual environment. You can run `watson projects` to check
that your real projects are not shown.

6. When you're done making changes, check that your changes pass the tests
(see [Run the tests](#run-the-tests)):
6. When you're done making changes, check that your changes pass the tests:

(.venv) $ tox
(.venv) $ pytest tests

7. If you have added a new command or updated/fixed docstrings, please update
the documentation:
Expand All @@ -70,19 +69,3 @@ Ready to contribute? Here's how to set up *Watson* for local development.

9. After [reading this](./pr-guidelines.md), submit a pull request through the
GitHub website.

<a href="#run-the-tests"></a>
## Run the tests

The tests use [pytest](http://pytest.org/). To run them with the default Python
interpreter:

$ py.test -v tests/

To run the tests via [tox](http://tox.testrun.org/) with all Python versions
which are available on your system and are defined in the `tox.ini` file,
simply run:

$ tox

This will also check the source code with [flake8](http://flake8.pycqa.org).
7 changes: 3 additions & 4 deletions docs/contributing/pr-guidelines.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
> *nota bene*
>
> Open a pull-request even if your contribution is not ready yet! It can
> be discussed and improved collaboratively! You may prefix the title of
> your pull-request with "WIP: " to make it clear that it is not yet ready
> for merging.
> be discussed and improved collaboratively! You can create a draft PR to
> indicate that it is not finished yet.

Before we merge a pull request, we check that it meets these guidelines:

Expand All @@ -24,7 +23,7 @@ Before we merge a pull request, we check that it meets these guidelines:
4. The pull request **should** include tests.
5. If the pull request adds functionality, the docs **should** be
updated.
6. *TravisCI* integration tests should be **green** :) It will make
6. GitHub linting and testing workflows should be **green** :) They will make
sure the tests pass with every supported version of Python.

Thank you!
30 changes: 3 additions & 27 deletions docs/contributing/release-new-version.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,36 +32,12 @@ $ git push origin --tags
Create a new pull request (PR) with the `prepare-x.y.z` branch. You can safely
merge this PR if all tests are green.

Draft a new [Watson Release on
Create and publish a new [Watson Release on
GitHub](https://github.com/TailorDev/Watson/releases) with the same release
notes.

## Push the `x.y.z` release to PyPI

Checkout the up-to-date `master` branch:

```bash
$ git checkout master
$ git pull --rebase origin master
```

Now, build the release and submit it to PyPI using
[twine](https://github.com/pypa/twine) (you'll need to be registered as a
maintainer of the package):

```bash
$ python setup.py sdist bdist_wheel
$ twine upload dist/*
```

## Update online documentation

We use [`mkdocs`](http://www.mkdocs.org) to generate the online documentation.
It must be updated via:

```bash
$ mkdocs gh-deploy --clean
```
A GitHub workflow will now automatically update the online documentation, and publish
the release to PyPI.

## Publish the `x.y.z` release to Homebrew

Expand Down
3 changes: 0 additions & 3 deletions pytest.ini

This file was deleted.

2 changes: 1 addition & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ twine

# Tests
flake8
black
py
pytest
pytest-datafiles
pytest-mock
pytest-runner
tox
15 changes: 7 additions & 8 deletions scripts/fuzzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,13 @@

from watson import Watson

if not os.environ.get('WATSON_DIR'):
if not os.environ.get("WATSON_DIR"):
sys.exit(
"This script will corrupt Watson's data, please set the WATSON_DIR "
"environment variable to safely use it for development purpose."
)

watson = Watson(config_dir=os.environ.get('WATSON_DIR'),
frames=None,
current=None)
watson = Watson(config_dir=os.environ.get("WATSON_DIR"), frames=None, current=None)

projects = [
("apollo11", ["reactor", "module", "wheels", "steering", "brakes"]),
Expand All @@ -26,21 +24,22 @@

now = arrow.now()

for date in arrow.Arrow.range('day', now.shift(months=-1), now):
for date in arrow.Arrow.range("day", now.shift(months=-1), now):
if date.weekday() in (5, 6):
# Weekend \o/
continue

start = date.replace(hour=9, minute=random.randint(0, 59)) \
.shift(seconds=random.randint(0, 59))
start = date.replace(hour=9, minute=random.randint(0, 59)).shift(
seconds=random.randint(0, 59)
)

while start.hour < random.randint(16, 19):
project, tags = random.choice(projects)
frame = watson.frames.add(
project,
start,
start.shift(seconds=random.randint(60, 4 * 60 * 60)),
tags=random.sample(tags, random.randint(0, len(tags)))
tags=random.sample(tags, random.randint(0, len(tags))),
)
start = frame.stop.shift(seconds=random.randint(0, 1 * 60 * 60))

Expand Down
Loading