Skip to content

Commit d982066

Browse files
author
chadcarlson
committed
GH Actions + rename var_prefix.
1 parent 137d3aa commit d982066

6 files changed

Lines changed: 67 additions & 96 deletions

File tree

.circleci/config.yml

Lines changed: 0 additions & 86 deletions
This file was deleted.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
name: Publish (pypi)
3+
on:
4+
push: ~
5+
6+
jobs:
7+
deploy:
8+
name: Publish to pypi
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v2
12+
- name: Get tag
13+
id: vars
14+
run: echo ::set-output name=tag::${GITHUB_REF#refs/*/}
15+
- if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
16+
env:
17+
GHACTION_TAG: ${{ steps.vars.outputs.tag }}
18+
uses: pypa/gh-action-pypi-publish@v1.4.1
19+
with:
20+
user: __token__
21+
password: ${{ secrets.PYPI_API_TOKEN }}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
name: Quality Assurance
3+
on:
4+
push: ~
5+
pull_request: ~
6+
7+
jobs:
8+
build:
9+
name: Build and test on ${{ matrix.python }}
10+
runs-on: ubuntu-latest
11+
strategy:
12+
matrix:
13+
python: [ '3.5', '3.6', '3.7', '3.8' ]
14+
steps:
15+
- uses: actions/checkout@v2
16+
- uses: actions/setup-python@v1
17+
with:
18+
python-version: ${{ matrix.python }}
19+
- run: python -m pip install --upgrade pipenv wheel
20+
- run: pipenv install
21+
- run: pipenv run "pytest"

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
# Changelog
22

3+
## [2.3.2] - 2020-02-03
4+
5+
### Added
6+
7+
* GitHub actions for tests (`quality-assurance.yaml`) and publishing to pypi (`pypi-publish.yaml`).
8+
9+
### Changed
10+
11+
* named variable`prefix` on constructor renamed to `var_prefix`.
12+
13+
### Removed
14+
15+
* CircleCI action config.
16+
317
## [2.3.1] - 2019-11-04
418

519
### Added

platformshconfig/config.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class Config:
5858

5959
"""
6060
Local index of the variables that can be accessed as direct properties (build and
61-
runtime). The key is the property that will be read. The value is the environment variables, minus prefix,
61+
runtime). The key is the property that will be read. The value is the environment variables, minus the variable prefix,
6262
that contains the value to look up.
6363
"""
6464
_directVariables = {
@@ -97,7 +97,7 @@ class Config:
9797
"""
9898
The vendor prefix for all environment variables we care about.
9999
"""
100-
_envPrefix = ''
100+
_varPrefix = ''
101101

102102
"""
103103
The routes definition dict. Only available at runtime.
@@ -125,19 +125,19 @@ class Config:
125125
"""
126126
_credentialFormatters = {}
127127

128-
def __init__(self, environment_variables=None, env_prefix='PLATFORM_'):
128+
def __init__(self, environment_variables=None, var_prefix='PLATFORM_'):
129129
"""Constructs a ConfigReader object.
130130
131131
Args:
132132
environment_variables (dict):
133133
The environment variables to read. Defaults to the current environment. Defaults to None.
134-
env_prefix (string):
134+
var_prefix (string):
135135
The prefix for environment variables. Defaults to 'PLATFORM_'.
136136
137137
"""
138138

139139
self._environmentVariables = os.environ if environment_variables is None else environment_variables
140-
self._envPrefix = env_prefix
140+
self._varPrefix = var_prefix
141141

142142
if self['ROUTES']:
143143
routes = self['ROUTES']
@@ -232,7 +232,7 @@ def variable(self, name, default=None):
232232
233233
Note:
234234
Variables prefixed with `env`: can be accessed as normal environment variables. This method will return
235-
such a variable by the name with the prefix still included. Generally it's better to access those variables
235+
such a variable by the name with the variable prefix still included. Generally it's better to access those variables
236236
directly.
237237
238238
Args:
@@ -480,15 +480,15 @@ def has_relationship(self, relationship):
480480
return relationship in self._relationshipsDef
481481

482482
def __getitem__(self, item):
483-
"""Reads an environment variable, taking the prefix into account.
483+
"""Reads an environment variable, taking the variable prefix into account.
484484
485485
Args:
486486
item (string):
487487
The variable to read.
488488
489489
"""
490490

491-
check_name = self._envPrefix + item.upper()
491+
check_name = self._varPrefix + item.upper()
492492

493493
return self._environmentVariables.get(check_name)
494494

@@ -644,3 +644,4 @@ class NoCredentialFormatterFoundException(ValueError):
644644

645645
class NotValidPlatformException(RuntimeError):
646646
pass
647+

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
cwd = os.path.abspath(os.path.dirname(__file__))
1414

15-
VERSION = "2.3.1"
15+
VERSION = "2.3.2"
1616

1717
with open('README.md', 'r', encoding='utf-8') as f:
1818
__readme__ = f.read()
@@ -25,7 +25,7 @@ class VerifyVersionCommand(install):
2525
description = 'verify that the git tag matches our version'
2626

2727
def run(self):
28-
tag = os.getenv('CIRCLE_TAG')
28+
tag = os.getenv('GHACTION_TAG')
2929

3030
if tag != VERSION:
3131
info = "Git tag: {0} does not match the version of this app: {1}".format(

0 commit comments

Comments
 (0)