-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: transfer python integration tests and docker/circlci building
Closes #1
- Loading branch information
Showing
11 changed files
with
1,824 additions
and
6 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,88 @@ | ||
# These environment variables must be set in CircleCI UI | ||
# | ||
# DOCKERHUB_REPO - docker hub repo, format: <username>/<repo> | ||
# DOCKER_EMAIL - login info for docker hub | ||
# DOCKER_USER | ||
# DOCKER_PASS | ||
# | ||
version: 2 | ||
jobs: | ||
build: | ||
docker: | ||
- image: docker:18.03.0-ce | ||
working_directory: /dockerflow | ||
steps: | ||
- run: | ||
name: Install Docker build dependencies | ||
command: apk add --no-cache openssh-client git | ||
- checkout | ||
- setup_remote_docker | ||
|
||
- run: | ||
name: Create a version.json | ||
command: | | ||
# create a version.json per https://github.com/mozilla-services/Dockerflow/blob/master/docs/version_object.md | ||
printf '{"commit":"%s","version":"%s","source":"https://github.com/%s/%s","build":"%s"}\n' \ | ||
"$CIRCLE_SHA1" \ | ||
"$CIRCLE_TAG" \ | ||
"$CIRCLE_PROJECT_USERNAME" \ | ||
"$CIRCLE_PROJECT_REPONAME" \ | ||
"$CIRCLE_BUILD_URL" > version.json | ||
- run: | ||
name: Build Docker image | ||
command: docker build -t app:build . | ||
|
||
# save the built docker container into CircleCI's cache. This is | ||
# required since Workflows do not have the same remote docker instance. | ||
- run: | ||
name: docker save app:build | ||
command: mkdir -p /cache; docker save -o /cache/docker.tar "app:build" | ||
- save_cache: | ||
key: v1-{{ .Branch }}-{{epoch}} | ||
paths: | ||
- /cache/docker.tar | ||
|
||
deploy: | ||
docker: | ||
- image: docker:18.03.0-ce | ||
steps: | ||
- setup_remote_docker | ||
- restore_cache: | ||
key: v1-{{.Branch}} | ||
- run: | ||
name: Restore Docker image cache | ||
command: docker load -i /cache/docker.tar | ||
|
||
- run: | ||
name: Deploy to Dockerhub | ||
command: | | ||
# deploy master | ||
if [ "${CIRCLE_BRANCH}" == "master" ]; then | ||
docker login -u $DOCKER_USER -p $DOCKER_PASS | ||
docker tag app:build ${DOCKERHUB_REPO}:latest | ||
docker push ${DOCKERHUB_REPO}:latest | ||
elif [ ! -z "${CIRCLE_TAG}" ]; then | ||
# deploy a release tag... | ||
docker login -u $DOCKER_USER -p $DOCKER_PASS | ||
echo "${DOCKERHUB_REPO}:${CIRCLE_TAG}" | ||
docker tag app:build "${DOCKERHUB_REPO}:${CIRCLE_TAG}" | ||
docker images | ||
docker push "${DOCKERHUB_REPO}:${CIRCLE_TAG}" | ||
fi | ||
workflows: | ||
version: 2 | ||
build-test-deploy: | ||
jobs: | ||
- build: | ||
filters: | ||
tags: | ||
only: /.*/ | ||
|
||
- deploy: | ||
requires: | ||
- build | ||
filters: | ||
tags: | ||
only: /.*/ | ||
branches: | ||
only: master |
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,13 @@ | ||
[clog] | ||
repository = "https://github.com/mozilla-services/autopush-rs" | ||
changelog = "CHANGELOG.md" | ||
from-latest-tag = true | ||
link-style = "github" | ||
|
||
[sections] | ||
Refactor = ["refactor"] | ||
Test = ["test"] | ||
Doc = ["docs"] | ||
Chore = ["chore"] | ||
Features = ["feat", "feature"] | ||
"Bug Fixes" = ["fix", "bug"] |
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,24 @@ | ||
.DS_Store | ||
.git | ||
.svn | ||
*.pyc | ||
*.egg-info | ||
*.egg | ||
.tox | ||
bin | ||
build | ||
dist | ||
docs/_build | ||
*.xml | ||
html_coverage | ||
.hgignore | ||
.idea | ||
*.iml | ||
site-packages/* | ||
lib-python/* | ||
bin/* | ||
ddb | ||
include/* | ||
lib_pypy/* | ||
pypy | ||
.coverage |
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,6 +1,31 @@ | ||
language: rust | ||
language: python | ||
python: | ||
- "2.7" | ||
cache: | ||
- cargo | ||
- pip | ||
sudo: required | ||
dist: trusty | ||
|
||
rust: | ||
- stable | ||
|
||
cache: cargo | ||
install: | ||
- make ddb | ||
- pip install --upgrade pip | ||
- pip install -r requirements.txt | ||
- pip install -r test-requirements.txt | ||
- WITH_RUST=false pip install -e git+https://github.com/mozilla-services/autopush.git#egg=autopush | ||
- | | ||
curl https://sh.rustup.rs | sh -s -- -y || travis_terminate 1; | ||
export PATH=$PATH:$HOME/.cargo/bin | ||
# Build here instead of within tox's pip install -e. It hides the output | ||
# which can kill the job on slower travis runs | ||
if [ ${WITH_RUST} == "release" ]; then | ||
cargo build --release || travis_terminate 1 | ||
else | ||
cargo build || travis_terminate 1 | ||
fi | ||
script: | ||
- py.test -v | ||
- cargo test | ||
notifications: | ||
slack: | ||
secure: vT9sWtUuxk28g6xYKAsQmiPZllErOYVfx5lcL+/jo1eRFrmbpYnyndT6s+FxGI1547oizZ0IqZbHVvB7BUoSJixXJyQJYXW2MchwN1UeHrey8mYpF1GNEaJT7FMfqSkxUU9gvAZ3IU7zstNeTLbfG1GkLuzybp0WAiHl/ocUTz8= |
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 @@ | ||
FROM rust:1.26.0-stretch as builder | ||
|
||
ADD . /app | ||
WORKDIR /app | ||
ENV PATH=$PATH:/root/.cargo/bin | ||
|
||
RUN \ | ||
cargo --version && \ | ||
rustc --version && \ | ||
mkdir -m 755 bin && \ | ||
cargo build --release && \ | ||
cp /app/target/release/autopush_rs /app/bin | ||
|
||
|
||
FROM debian:stretch-slim | ||
# FROM debian:stretch # for debugging docker build | ||
MAINTAINER <[email protected]> | ||
RUN \ | ||
groupadd --gid 10001 app && \ | ||
useradd --uid 10001 --gid 10001 --home /app --create-home app && \ | ||
|
||
COPY --from=builder /app/bin /app/bin | ||
|
||
WORKDIR /app | ||
USER app | ||
|
||
CMD ["/app/bin/autopush_rs"] |
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 @@ | ||
SHELL := /bin/sh | ||
|
||
.PHONY: ddb | ||
|
||
ddb: | ||
mkdir $@ | ||
curl -sSL http://dynamodb-local.s3-website-us-west-2.amazonaws.com/dynamodb_local_latest.tar.gz | tar xzvC $@ |
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,60 @@ | ||
-e git+https://github.com/habnabit/txstatsd.git@157ef85fbdeafe23865c7c4e176237ffcb3c3f1f#egg=txStatsD-master | ||
apns==2.0.1 | ||
asn1crypto==0.24.0 # via cryptography | ||
attrs==17.4.0 | ||
autobahn[twisted]==18.3.1 | ||
automat==0.6.0 # via twisted | ||
boto3==1.7.0 | ||
botocore==1.10.0 # via boto3, s3transfer | ||
certifi==2018.1.18 # via requests | ||
cffi==1.11.5 | ||
chardet==3.0.4 # via requests | ||
click==6.7 | ||
configargparse==0.13.0 | ||
constantly==15.1.0 # via twisted | ||
contextlib2==0.5.5 # via raven | ||
cryptography==2.2.2 | ||
cyclone==1.1 | ||
datadog==0.20.0 | ||
decorator==4.2.1 # via datadog | ||
docutils==0.14 # via botocore | ||
ecdsa==0.13 # via python-jose | ||
enum34==1.1.6 # via cryptography, h2 | ||
future==0.16.0 # via python-jose | ||
futures==3.2.0 # via s3transfer | ||
gcm-client==0.1.4 | ||
graphviz==0.8.2 # via objgraph | ||
h2==2.6.2 # via hyper | ||
hpack==3.0.0 # via h2 | ||
hyper==0.7.0 | ||
hyperframe==3.2.0 # via h2, hyper | ||
hyperlink==18.0.0 # via twisted | ||
idna==2.6 # via cryptography, hyperlink, requests | ||
incremental==17.5.0 # via twisted | ||
ipaddress==1.0.19 # via cryptography | ||
jmespath==0.9.3 # via boto3, botocore | ||
marshmallow-polyfield==3.2 | ||
marshmallow==2.15.0 | ||
objgraph==3.4.0 | ||
pyasn1-modules==0.2.1 # via service-identity | ||
pyasn1==0.4.2 | ||
pycparser==2.18 # via cffi | ||
pycryptodome==3.5.1 # via python-jose | ||
pyfcm==1.4.5 | ||
pyopenssl==17.5.0 | ||
python-dateutil==2.6.1 # via botocore | ||
python-jose==2.0.2 | ||
raven==6.6.0 | ||
requests-toolbelt==0.8.0 # via pyfcm | ||
requests==2.18.4 | ||
s3transfer==0.1.13 # via boto3 | ||
service-identity==17.0.0 | ||
simplejson==3.13.2 | ||
six==1.11.0 # via autobahn, automat, cryptography, pyopenssl, python-dateutil, python-jose, txaio | ||
twisted==17.9.0 | ||
txaio==2.9.0 # via autobahn | ||
typing==3.6.4 | ||
ua-parser==0.7.3 | ||
urllib3==1.22 # via requests | ||
wsaccel==0.6.2 ; platform_python_implementation == "CPython" | ||
zope.interface==4.4.3 |
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
coverage | ||
ecdsa==0.13 | ||
factory_boy==2.8.1 | ||
flake8==3.3.0 | ||
funcsigs==1.0.2 | ||
mock>=1.0.1 | ||
-e git+https://github.com/bbangert/moto.git@3bdb75a961148ea5aa526f0e88d9e7835a30df3a#egg=moto | ||
nose | ||
pbr==1.10.0 | ||
psutil | ||
pympler==0.5 | ||
pytest | ||
pytest-cov | ||
websocket-client |
Empty file.
Oops, something went wrong.