Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
157 additions
and
15 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 |
---|---|---|
|
@@ -49,3 +49,5 @@ changelog.sh | |
\#*\# | ||
|
||
.python-version | ||
|
||
files/local.env |
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,25 +1,20 @@ | ||
build: | ||
@ python setup.py sdist | ||
@ python setup.py bdist_wheel --python-tag py2 | ||
@ BUILD_VERSION=2 python setup.py sdist | ||
@ BUILD_VERSION=2 python setup.py bdist_wheel --python-tag py2 | ||
@ BUILD_VERSION=3 python setup.py bdist_wheel --python-tag py3 | ||
|
||
publish: | ||
@ python setup.py sdist upload | ||
@ python setup.py bdist_wheel --python-tag py2 upload | ||
@ BUILD_VERSION=3 python setup.py bdist_wheel --python-tag py3 upload | ||
@ twine upload dist/* | ||
|
||
release: | ||
@ docker-compose run social-release | ||
|
||
tests: | ||
@ docker-compose run social-tests | ||
|
||
clean: | ||
@ find . -name '*.py[co]' -delete | ||
@ find . -name '__pycache__' -delete | ||
@ rm -rf *.egg-info dist build | ||
|
||
docker-tox-build: | ||
@ docker inspect omab/psa-social-app-django >/dev/null 2>&1 || ( \ | ||
docker build -t omab/psa-social-app-django . \ | ||
) | ||
|
||
docker-tox: docker-tox-build | ||
@ docker run -it --rm \ | ||
--name psa-social-app-django-test \ | ||
-v "`pwd`:/src" \ | ||
omab/psa-social-app-django tox | ||
.PHONY: tests |
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,27 @@ | ||
version: "3.7" | ||
|
||
services: | ||
social-release: | ||
image: omab/social-auth-release | ||
build: | ||
context: . | ||
dockerfile: ./files/release/Dockerfile | ||
environment: | ||
- PROJECT_NAME=social-app-django | ||
- PROJECT_DIR=social_django | ||
env_file: | ||
- ./files/local.env | ||
volumes: | ||
- .:/code | ||
|
||
social-tests: | ||
image: omab/social-auth-tests | ||
build: | ||
context: . | ||
dockerfile: ./files/tests/Dockerfile | ||
args: | ||
- PYTHON_VERSIONS=2.7.17 3.5.9 3.6.10 3.7.7 3.8.2 3.9-dev | ||
environment: | ||
- PYTHON_VERSIONS=2.7.17 3.5.9 3.6.10 3.7.7 3.8.2 3.9-dev | ||
volumes: | ||
- .:/code |
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,2 @@ | ||
PYPI_USERNAME= | ||
PYPI_PASSWORD= |
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,15 @@ | ||
FROM python:3.8.2-slim-buster | ||
|
||
RUN apt-get update && \ | ||
apt-get install -y --no-install-recommends make gettext git curl && \ | ||
pip install -U pip && \ | ||
pip install -U setuptools && \ | ||
pip install -U twine | ||
|
||
COPY ./files/release/pypirc.template / | ||
COPY ./files/release/entrypoint.sh / | ||
ADD . /code | ||
|
||
WORKDIR /code | ||
|
||
ENTRYPOINT ["/entrypoint.sh"] |
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,42 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
if [ -z "${PYPI_USERNAME}" ] || [ -z "${PYPI_PASSWORD}" ]; then | ||
echo "=====================================================================" | ||
echo "Error: missing PYPI_USERNAME or PYPI_PASSWORD environment values" | ||
echo "=====================================================================" | ||
exit 1; | ||
fi | ||
|
||
if [ -z "${PROJECT_DIR}" ] || [ -z "${PROJECT_NAME}" ]; then | ||
echo "=====================================================================" | ||
echo "Error: missing PROJECT_DIR or PROJECT_NAME environment values" | ||
echo "=====================================================================" | ||
exit 1; | ||
fi | ||
|
||
envsubst < /pypirc.template > ~/.pypirc | ||
|
||
# This will fail if tag doesn't exist | ||
CURRENT_VERSION=$(head -n1 ${PROJECT_DIR}/__init__.py | awk '{print $3}' | sed 's/[^0-9\.]//g') | ||
CURRENT_TAG=$(git describe --tags --abbrev=0) | ||
|
||
if [ "${CURRENT_VERSION}" != "${CURRENT_TAG}" ]; then | ||
echo "=====================================================================" | ||
echo "Error: version '${CURRENT_VERSION}' not tagged" | ||
echo "=====================================================================" | ||
exit 1; | ||
fi | ||
|
||
PYPI_URL="https://pypi.org/project/${PROJECT_NAME}/${CURRENT_VERSION}/" | ||
VERSION_PAGE_STATUS=$(curl -s -I ${PYPI_URL} | head -n1 | awk '{print $2}') | ||
|
||
if [ "${VERSION_PAGE_STATUS}" == "200" ]; then | ||
echo "=====================================================================" | ||
echo "Error: version '${CURRENT_VERSION}' already exists" | ||
echo "=====================================================================" | ||
exit 1; | ||
fi | ||
|
||
make clean build publish |
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,7 @@ | ||
[distutils] | ||
index-servers = | ||
pypi | ||
|
||
[pypi] | ||
username: ${PYPI_USERNAME} | ||
password: ${PYPI_PASSWORD} |
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 @@ | ||
FROM python:3.8.2-slim-buster | ||
|
||
ARG PYTHON_VERSIONS=${PYTHON_VERSIONS} | ||
ENV PYTHON_VERSIONS=${PYTHON_VERSIONS} | ||
|
||
RUN apt-get update && \ | ||
apt-get install -y --no-install-recommends \ | ||
make git pkg-config ca-certificates wget curl llvm build-essential \ | ||
python-openssl libssl-dev zlib1g-dev libbz2-dev libreadline-dev \ | ||
libsqlite3-dev libncurses5-dev libncursesw5-dev xz-utils libxml2-dev \ | ||
libxmlsec1-dev libffi-dev tk-dev liblzma-dev | ||
|
||
COPY ./files/tests/pyenv.sh / | ||
RUN /pyenv.sh | ||
|
||
COPY ./files/tests/entrypoint.sh / | ||
|
||
ADD . /code | ||
|
||
WORKDIR /code | ||
|
||
ENTRYPOINT ["/entrypoint.sh"] |
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,10 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
export PATH=~/.pyenv/shims:~/.pyenv/bin:${PATH} | ||
export PYENV_ROOT=~/.pyenv | ||
|
||
eval "$(pyenv init -)" | ||
|
||
tox |
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,20 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
export PATH=~/.pyenv/shims:~/.pyenv/bin:${PATH} | ||
export PYENV_ROOT=~/.pyenv | ||
export PYTHON_VERSIONS=${PYTHON_VERSIONS} | ||
|
||
curl -L https://raw.githubusercontent.com/yyuu/pyenv-installer/master/bin/pyenv-installer | bash | ||
|
||
eval "$(pyenv init -)" | ||
|
||
for version in ${PYTHON_VERSIONS}; do | ||
pyenv install "${version}" | ||
pyenv local "${version}" | ||
pip install --upgrade setuptools pip tox | ||
pyenv local --unset | ||
done | ||
|
||
pyenv local ${PYTHON_VERSIONS} |