-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #58 from stigok/pypi-preps
Forberedelser for publisering til PyPi
- Loading branch information
Showing
10 changed files
with
121 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
ARG PYVER | ||
FROM python:${PYVER}-alpine3.10 | ||
|
||
RUN apk update && \ | ||
apk add --no-cache ca-certificates | ||
RUN pip install --upgrade pip | ||
|
||
WORKDIR /usr/src/app | ||
ENV PYTHONUNBUFFERED=1 | ||
|
||
COPY . . |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,22 @@ | ||
#!/bin/bash | ||
|
||
# Build and run a Docker image based on a specific Python version | ||
set -eu | ||
|
||
# Change working directory to repository root, | ||
# expecting this script to reside at :/.docker/<script> | ||
# Change working directory to repo root (if this script's in .docker) | ||
src="$(dirname "$(readlink -f "$0")")" | ||
cd "$src/.." | ||
|
||
dockerfile="$src/Dockerfile" | ||
|
||
function run() { | ||
pyver=$1 | ||
echo $pyver | ||
tag=ruterstop:python${pyver} | ||
|
||
echo "*** Building ${tag} ***" | ||
docker build -f ${dockerfile} \ | ||
--build-arg PYVER=$pyver \ | ||
--tag ${tag} \ | ||
. | ||
|
||
echo "*** Running ${tag} ***" | ||
runcmd="docker run --network=host $tag" | ||
|
||
$runcmd sh -c "python setup.py test" | ||
$runcmd sh -c "ruterstop --stop-id 6013 --direction outbound --min-eta 2" | ||
} | ||
pyver=$1 | ||
shift | ||
test_name=${1} | ||
shift | ||
tag=ruterstop:${test_name}-${pyver} | ||
|
||
set -x | ||
docker build --network host \ | ||
--file ${src}/Dockerfile.${test_name} \ | ||
--build-arg PYVER="$pyver" \ | ||
--tag ${tag} \ | ||
. > /dev/null | ||
|
||
if [ -n ${1:-''} ] | ||
then | ||
run $1 | ||
else | ||
for pyver in 3.5 3.6 3.7 3.8 | ||
do | ||
run $pyver | ||
done | ||
fi | ||
docker run --network host $tag $@ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
.* | ||
**/__pycache__ | ||
*.egg-info | ||
venv | ||
Makefile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
name: Publish to PyPI | ||
|
||
on: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@master | ||
- name: Publish Python Package | ||
uses: mariamrf/[email protected] | ||
with: | ||
python_version: '3.8.0' | ||
env: | ||
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }} | ||
TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: Publish to PyPI | ||
|
||
on: | ||
release: | ||
types: [published] | ||
push: | ||
branches: | ||
- pypi-preps | ||
|
||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@master | ||
- name: Publish Python Package | ||
uses: mariamrf/[email protected] | ||
with: | ||
python_version: '3.8.0' | ||
env: | ||
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }} | ||
TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }} | ||
TWINE_REPOSITORY_URL: https://test.pypi.org/legacy/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,20 @@ | ||
init: | ||
pip install -r requirements.txt | ||
|
||
.PHONY: test | ||
test: | ||
python setup.py test | ||
python3 setup.py test | ||
|
||
.PHONY: matrix-unit-tests | ||
matrix-unit-tests: | ||
.docker/run-tests.sh 3.5 matrix-unit-tests python setup.py test | ||
.docker/run-tests.sh 3.6 matrix-unit-tests python setup.py test | ||
.docker/run-tests.sh 3.7 matrix-unit-tests python setup.py test | ||
.docker/run-tests.sh 3.8 matrix-unit-tests python setup.py test | ||
|
||
test-e2e: test | ||
python ruterstop/ --stop-id=6013 --min-eta=2 --direction=outbound | ||
.PHONY: matrix-install | ||
matrix-install: | ||
.docker/run-tests.sh 3.5 matrix-install pip install . | ||
.docker/run-tests.sh 3.6 matrix-install pip install . | ||
.docker/run-tests.sh 3.7 matrix-install pip install . | ||
.docker/run-tests.sh 3.8 matrix-install pip install . | ||
|
||
.PHONY: init test test-e2e | ||
.PHONY: matrix | ||
matrix: matrix-unit-tests matrix-install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,14 +10,31 @@ | |
version = str(ast.literal_eval(_version_re.search( | ||
f.read().decode('utf-8')).group(1))) | ||
|
||
def readme(): | ||
with open('README.md') as f: | ||
return f.read() | ||
|
||
setup( | ||
name="ruterstop", | ||
description="Et program som viser sanntidsinformasjon for stoppesteder i " + | ||
"Oslo og Akershus.", | ||
version=version, | ||
long_description=readme(), | ||
long_description_content_type="text/markdown", | ||
keywords="entur ruter ruter-api kollektivtransport oslo viken sanntid", | ||
url="https://github.com/stigok/ruterstop", | ||
project_urls={ | ||
"Bug Tracker": "http://github.com/stigok/ruterstop/issues", | ||
"Documentation": "http://github.com/stigok/ruterstop/", | ||
"Source Code": "http://github.com/stigok/ruterstop/", | ||
}, | ||
classifiers=[ | ||
"License :: OSI Approved :: MIT License", | ||
"Programming Language :: Python :: 3 :: Only", | ||
], | ||
author="stigok", | ||
author_email="[email protected]", | ||
|
||
packages=["ruterstop"], | ||
entry_points={ | ||
"console_scripts": [ | ||
|