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 #33 from StableWorld/feature/make
Update circle ci for new deployment
- Loading branch information
Showing
10 changed files
with
177 additions
and
94 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,10 @@ | ||
set +xe | ||
apk add --no-cache \ | ||
openssl \ | ||
make \ | ||
curl curl-dev \ | ||
py-pip \ | ||
sudo \ | ||
bash | ||
|
||
pip install -q docker-compose==1.16.1 |
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 @@ | ||
set +xe | ||
curl -o docker.tgz https://download.docker.com/linux/static/stable/x86_64/docker-17.06.2-ce.tgz | ||
tar --extract \ | ||
--file docker.tgz \ | ||
--strip-components 1 \ | ||
--directory /usr/local/bin/ | ||
apt-get install -y make |
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,82 @@ | ||
environment: &env | ||
CONTAINER: stable.world.auth | ||
DEPLOYMENT: auth | ||
GCLOUD_ZONE: us-central1-a | ||
GCLOUD_PROJECT: my-project-1-152801 | ||
|
||
version: 2 | ||
jobs: | ||
build: | ||
working_directory: /workspace | ||
docker: | ||
- image: docker:17.05.0-ce-git | ||
steps: | ||
- checkout | ||
- setup_remote_docker: | ||
version: 17.05.0-ce | ||
- run: | ||
name: Install Dependencies | ||
command: .circleci/InstallBuildDependencies.sh | ||
- run: | ||
name: Install | ||
command: | | ||
pip install --upgrade pip setuptools wheel | ||
pip install -r ./requirements.txt | ||
python setup.py develop | ||
- run: | ||
name: Build apps | ||
command: | | ||
make buildApp | ||
make buildDockerPY2 | ||
make buildDockerPY3 | ||
- run: | ||
name: Lint | ||
command: make lint | ||
- run: | ||
name: Test | ||
command: | | ||
make testPY2 | ||
make testPY3 | ||
./bin/stable.world --help | ||
- persist_to_workspace: | ||
# Must be an absolute path, or relative path from working_directory | ||
root: /workspace | ||
# Must be relative path from root | ||
paths: | ||
- bin/stable.world | ||
|
||
deploy: | ||
working_directory: /workspace | ||
docker: | ||
- image: google/cloud-sdk | ||
# Environment variable for all commands executed in the primary container | ||
environment: *env | ||
steps: | ||
- checkout | ||
- attach_workspace: | ||
# Must be absolute path or relative path from working_directory | ||
at: /workspace | ||
- run: | ||
name: "Install Dependencies" | ||
command: .circleci/InstallDeployDependencies.sh | ||
- run: | ||
name: "Authorize Google Cloud" | ||
command: | | ||
make deploy-fetch | ||
make deploy-authorize | ||
- run: | ||
name: "Rollout to Stage" | ||
command: | | ||
make deploy-development | ||
workflows: | ||
version: 2 | ||
build-test-and-deploy: | ||
jobs: | ||
- build | ||
- deploy: | ||
# filters: | ||
# branches: | ||
# only: master | ||
requires: | ||
- build |
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,55 @@ | ||
|
||
buildApp: ## build and bundle app | ||
sh scripts/makeapp.sh | ||
|
||
buildDocs: ## build docs | ||
(cd docs/ && make html) | ||
|
||
buildDockerPY2: ## build python2 docker image | ||
echo "FROM python:2" | cat - Dockerfile.test.template > Dockerfile.py2 | ||
docker build -f Dockerfile.py2 -t testpy2 . | ||
|
||
buildDockerPY3: ## build python3 docker image | ||
echo "FROM python:3" | cat - Dockerfile.test.template > Dockerfile.py3 | ||
docker build -f Dockerfile.py3 -t testpy3 . | ||
|
||
test: ## test code | ||
py.test | ||
|
||
lint: ## lint code | ||
flake8 | ||
|
||
testPY2: ## test with python2 | ||
docker run testpy2 py.test /app/ | ||
|
||
testPY3: ## test with python3 | ||
docker run testpy3 py.test /app/ | ||
|
||
|
||
testFunctional: ## run functional_tests | ||
py.test functional_tests/ | ||
|
||
deploy-fetch: ## fetch deploy repo | ||
rm -rf deployment | ||
git clone https://gist.github.com/befb8025b4fdf52d7db8391a1cbe0c22.git deployment | ||
|
||
deploy-authorize: ## authorize gcloud | ||
echo $$GCLOUD_SERVICE_KEY | base64 --decode > $${HOME}/gcloud-service-key.json | ||
gcloud auth activate-service-account --key-file $${HOME}/gcloud-service-key.json | ||
gcloud config set project $$GCLOUD_PROJECT | ||
|
||
deploy-master: ## deploy master version | ||
sh deployment/master-cli.sh | ||
|
||
deploy-development: ## deploy development version | ||
sh deployment/development-cli.sh | ||
|
||
release: ## upload release | ||
gsutil -h "Content-Type:text/plain" cp gs://stable-world-downloads/rc gs://stable-world-downloads/latest | ||
|
||
.PHONY: help | ||
|
||
help: ## show this help and exit | ||
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' | ||
|
||
.DEFAULT_GOAL := help |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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.6 | ||
# set -eux | ||
COPY . /project | ||
WORKDIR /project | ||
# git clean -xdf dist app | ||
|
||
RUN python setup.py sdist --quiet | ||
RUN pip install --quiet --target app dist/stable.world-*.tar.gz | ||
RUN python -m compileall app/ | ||
RUN python -m zipapp app -o ./bin/stable.world.pyz | ||
|
||
RUN cat ./app/header.sh ./bin/stable.world.pyz > ./bin/stable.world | ||
# TODO: windows deploy | ||
# cat ./app/header.bat ./bin/stable.world.pyz > ./bin/stable.world.bat | ||
RUN chmod +x ./bin/stable.world |
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,13 +1,8 @@ | ||
set -euo pipefail | ||
set -eux | ||
|
||
git clean -xdf dist app | ||
python3.6 setup.py sdist | ||
pip install --target app dist/stable.world-*.tar.gz | ||
|
||
python2.7 -m compileall app/ | ||
python3.6 -m compileall app/ | ||
|
||
python3.6 -m zipapp app -o ./bin/stable.world.pyz | ||
cat ./app/header.sh ./bin/stable.world.pyz > ./bin/stable.world | ||
cat ./app/header.bat ./bin/stable.world.pyz > ./bin/stable.world.bat | ||
chmod +x ./bin/stable.world | ||
docker build -f scripts/Dockerfile -t makeapp:build . | ||
docker create --name extract makeapp:build | ||
docker cp extract:/project/bin/stable.world ./bin/stable.world | ||
ls -la bin/stable.world | ||
echo "OK!" |
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 |
---|---|---|
|
@@ -121,7 +121,7 @@ def remove_file(filename): | |
try: | ||
pass | ||
# os.unlink(filename) | ||
except: | ||
except Exception: | ||
pass | ||
|
||
|
||
|
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