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

ci: Switch from Travis CI to GitHub Actions #63

Merged
merged 5 commits into from
Aug 24, 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
12 changes: 12 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: 2

updates:
- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "weekly"

- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "monthly"
64 changes: 64 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
---
name: Tests

on:
pull_request: ~
push:
branches: [ main ]

# Allow job to be triggered manually.
workflow_dispatch:

# Cancel in-progress jobs when pushing to the same branch.
concurrency:
cancel-in-progress: true
group: ${{ github.workflow }}-${{ github.ref }}

jobs:

tests:

runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: ["ubuntu-20.04"]
python-version: ["3.6", "3.7", "3.8", "3.9"]

env:
OS: ${{ matrix.os }}
PYTHON: ${{ matrix.python-version }}
APIARY_URL: https://opsv31.docs.apiary.io/
OPS_KEY: ${{ secrets.OPS_API_CONSUMER_KEY }}
OPS_SECRET: ${{ secrets.OPS_API_CONSUMER_SECRET }}

name: Python ${{ matrix.python-version }} on OS ${{ matrix.os }}
steps:

- name: Acquire sources
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
architecture: x64
cache: 'pip'
cache-dependency-path: 'setup.py'

- name: Setup project
run: |
pip install -r requirements/test.txt

- name: Run linter and software tests
run: |
make test-ci

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
files: ./coverage.xml
flags: unittests
env_vars: OS,PYTHON
name: codecov-umbrella
fail_ci_if_error: false
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ pip-log.txt
# Unit test / coverage reports
.coverage
.tox
coverage.xml
nosetests.xml

# Translations
Expand Down
13 changes: 0 additions & 13 deletions .travis.yml

This file was deleted.

6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,16 @@ lint: ## flake8 lint the project
flake8 epo_ops tests

test: clean ## Run tests with virtualenv Python
py.test -s -v --lf --cov-report term --cov epo_ops tests
py.test -s -v --lf --cov epo_ops tests --cov-report term-missing --cov-report xml

test-ci: clean ## Run tests in CI environment with virtualenv Python
py.test -v --cov epo_ops --cov-report term-missing
py.test -v --cov epo_ops tests --cov-report term-missing --cov-report xml

tox: clean ## Run tests with all supported Python versions
tox

coverage: clean ## Check code coverage locally
py.test -s -v --cov-report html --cov-report term --cov epo_ops tests
py.test -s -v --cov epo_ops tests --cov-report term-missing --cov-report xml --cov-report html
open htmlcov/index.html

release: clean # Package and upload a release to PyPI
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

[![PyPI](https://img.shields.io/pypi/v/python-epo-ops-client)](https://pypi.org/project/python-epo-ops-client/)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/python-epo-ops-client)](https://pypi.org/project/python-epo-ops-client/)
[![Travis.org](https://img.shields.io/travis/gsong/python-epo-ops-client)](https://travis-ci.org/gsong/python-epo-ops-client)
[![Coveralls github](https://img.shields.io/coveralls/github/gsong/python-epo-ops-client)](https://coveralls.io/github/gsong/python-epo-ops-client)
[![GHA](https://github.com/ip-tools/python-epo-ops-client/actions/workflows/main.yml/badge.svg)](https://github.com/ip-tools/python-epo-ops-client/actions/workflows/main.yml)
[![Codecov](https://codecov.io/gh/ip-tools/python-epo-ops-client/branch/main/graph/badge.svg)](https://codecov.io/gh/ip-tools/python-epo-ops-client)

python-epo-ops-client is an [Apache2 licensed][apache license] client library
for accessing the [European Patent Office][epo]'s ("EPO") [Open Patent
Expand Down
35 changes: 27 additions & 8 deletions docs/sandbox.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,38 @@ on behalf of a pull request, see the [contributing guidelines](contributing.md).
```


## OPS Account Setup
## Software Tests


### OPS Account Setup

Running the software tests require a working OPS account.

1. [Register a OPS user login with EPO][ops registration]
2. Create an app
3. Look up the Mock Server URL at [Apiary][apiary ops], or try
<http://private-anon-111333769e-opsv31.apiary-mock.com>.
4. Set the `APIARY_URL`, `OPS_KEY`, and `OPS_SECRET` environment variables
accordingly in a `.env` file (see `example.env`).
1. [Sign up for an OPS user login with EPO][ops registration].
2. Create an App at the OPS Console, which will provide you with a corresponding
pair of authentication credentials, the OPS application key and its secret.


## Software Tests
### Prerequisites

Before running the software tests, you will need to define the `APIARY_URL`,
`OPS_KEY`, and `OPS_SECRET` environment variables.

You can either define them interactively using `export VARNAME=VALUE`, or store
them into an `.env` file within the same directory you are running the tests from.
See `example.env` for a blueprint.

A public instance of the Mock Server API service is available at
<https://opsv31.docs.apiary.io/>.

```shell
export APIARY_URL=https://opsv31.docs.apiary.io/
export OPS_KEY=NKdGMmedZBGLRxTrUwCZMQCYp7Ak5a0u
export OPS_SECRET=v3vARPu7DFPEDB8i
```

_Note that the credentials are just for demonstration purposes, and invalid._


### Basics

Expand Down
1 change: 1 addition & 0 deletions tests/test_ops_quota.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ def issue_request(client):


# Tests
@pytest.mark.skip(reason="FIXME: Currently fails")
def test_mock_quota_exceeded(all_clients, monkeypatch):
monkeypatch.setattr(all_clients, "__service_url_prefix__", APIARY_URL)
errors = {
Comment on lines 18 to 22
Copy link
Member Author

@amotl amotl Aug 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test case fails. The reason is:

requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://opsv31.docs.apiary.io//individual-per-hour-exceeded/publication/docdb/biblio

@gsong: Can you do anything about it, or tell me how I would approach that issue?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've created GH-64 and GH-65, to follow up on this correspondingly.

Expand Down