Skip to content

Commit

Permalink
GitHub Actions integration for tests
Browse files Browse the repository at this point in the history
This patch removes the old, non-functional Travis CI integration and
replaces it with GitHub Actions workflows.
  • Loading branch information
lkiesow authored and teutat3s committed Aug 19, 2024
1 parent b273d17 commit 8605657
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 30 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: lint

on:
- push
- pull_request

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: set up python
uses: actions/setup-python@v2
with:
python-version: '3.12'

- name: install Python dependencies
run: pip install bandit flake8 pyright

- name: run flake8
run: flake8 --show-source watson/ tests/ scripts/
37 changes: 37 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: test

on:
push:
branches-ignore:
- 'dependabot/**'
pull_request:

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
# https://endoflife.date/python
# https://github.com/actions/runner-images/blob/main/images/linux/Ubuntu2204-Readme.md#python
python-version:
- '3.8'
- '3.9'
- '3.10'
- '3.11'
- '3.12'
steps:
- uses: actions/checkout@v4

- name: set up python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: install python dependencies
run: pip install -r requirements.txt

- name: install python test dependencies
run: pip install -r requirements-dev.txt

- name: run tests
run: py.test -vs tests/
12 changes: 0 additions & 12 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,18 +1,6 @@
-r requirements.txt

# Docs
mkdocs
mkdocs-bootswatch

# Release
wheel
twine

# Tests
flake8
py
pytest
pytest-datafiles
pytest-mock
pytest-runner
tox
17 changes: 0 additions & 17 deletions tox.ini

This file was deleted.

2 changes: 1 addition & 1 deletion watson/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -894,7 +894,7 @@ def aggregate(ctx, watson, current, from_, to, projects, tags, output_format,
end = start + datetime.timedelta(days=6)
aggregation_ranges.append((start, end))
start += datetime.timedelta(days=7)
else: # daily
else: # daily
delta = (to - from_).days
for i in range(delta + 1):
offset = datetime.timedelta(days=i)
Expand Down

0 comments on commit 8605657

Please sign in to comment.