Skip to content

Commit

Permalink
Environment variables (#24)
Browse files Browse the repository at this point in the history
* Update tests to use environment variables for comicvine

Include publish Github action

* Change Publish Tag regex

* Quote Publish regex

* Increment version
  • Loading branch information
Buried-In-Code authored Sep 5, 2021
1 parent c6aea4c commit f16f0b2
Show file tree
Hide file tree
Showing 7 changed files with 66 additions and 6 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: "Publish"

on:
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+'

jobs:
publish:
runs-on: ubuntu-latest
steps:
#----------------------------------------------
# check-out repo and set-up python
#----------------------------------------------
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.9
#----------------------------------------------
# ----- install & configure poetry -----
#----------------------------------------------
- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: 1.1.8
virtualenvs-create: true
virtualenvs-in-project: true
#----------------------------------------------
# load cached venv if cache exists
#----------------------------------------------
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v2
with:
path: .venv
key: venv-ubuntu-latest-3.9-${{ hashFiles('**/poetry.lock') }}
#----------------------------------------------
# install dependencies if cache does not exist
#----------------------------------------------
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root
#----------------------------------------------
# install your root project, if required
#----------------------------------------------
- name: Install library
run: poetry install --no-interaction
#----------------------------------------------
# Publish Project
#----------------------------------------------
- name: Publish Project
run: poetry publish --build
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
2 changes: 2 additions & 0 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ jobs:
matrix:
python-version: [3.8, 3.9]
os: [ubuntu-latest, macos-latest, windows-latest]
env:
COMICVINE: ${{ secrets.COMICVINE_KEY }}
runs-on: ${{ matrix.os }}
steps:
#----------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ from config import comicvine_api_key
session = api(api_key=comicvine_api_key)

# Search for Publisher
results = session.publisher_list(params={'name': 'DC Comics'})
results = session.publisher_list(params={'filter': 'name:DC Comics'})
for publisher in results:
print(f"{publisher.id} | {publisher.name} - {publisher.site_url}")

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "Simyan"
version = "0.4.1"
version = "0.4.2"
description = "A Python wrapper for the Comicvine API."
license = "MIT"
authors = ["Buried-In-Code <6057651+Buried-In-Code@users.noreply.github.com>"]
Expand Down
Binary file modified tests/Simyan-Cache.sqlite
Binary file not shown.
9 changes: 5 additions & 4 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@


@pytest.fixture(scope="session")
def dummy_key():
return os.getenv("COMICVINE_KEY", "f6bbc5b3cd54fd483fab20fe686b8ea718438917")
def api_key():
return os.getenv("COMICVINE", "INVALID")


@pytest.fixture(scope="session")
def talker(dummy_key):
def talker(api_key):
print(api_key)
return api(
api_key=dummy_key,
api_key=api_key,
cache=sqlite_cache.SqliteCache("tests/Simyan-Cache.sqlite"),
)
2 changes: 2 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ isolated_build = true
envlist = py37, py38, py39

[testenv]
setenv =
COMICVINE={env:COMICVINE}
deps = pytest
commands =
python --version
Expand Down

0 comments on commit f16f0b2

Please sign in to comment.