diff --git a/.circleci/config.yml b/.circleci/config.yml index 331019e..1c402dc 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -6,14 +6,7 @@ version: 2 jobs: build: docker: - # specify the version you desire here - # use `-browsers` prefix for selenium tests, e.g. `3.6.1-browsers` - - image: kennethreitz/bake - - # Specify service dependencies here if necessary - # CircleCI maintains a library of pre-built images - # documented at https://circleci.com/docs/2.0/circleci-images/ - # - image: circleci/postgres:9.4 + - image: kennethreitz/bake:ci working_directory: /app @@ -23,7 +16,6 @@ jobs: # docker_layer_caching: true - run: name: $ bake ci - command: bake ci - - - store_test_results: - path: reports + command: | + pipenv install --dev --system --deploy + cd tests && bats *.bats diff --git a/Bakefile b/Bakefile index 06b29c4..e6426e9 100644 --- a/Bakefile +++ b/Bakefile @@ -3,45 +3,40 @@ USERNAME=${USERNAME:-kennethreitz} //: //system //python + red "System is setup for local development." //system: - lazy_brew pipenv + lazy_brew pipenv bats //python: @skip:key=Pipfile.lock //system pipenv install --dev +test: //build + docker-compose run --entrypoint bash bake -c 'set -ex && pipenv install --dev --system --deploy && cd tests && bats *.bats' +release: test //warn @confirm:secure release//pypi docker/release -test: docker/build - docker-compose run --entrypoint bash bake -c 'set -ex && pip3 install pytest && pytest' -release: test release//warn @confirm:secure release//pypi docker/release -bash: docker//bash - -release//warn: +//warn: echo echo "$(red 'Warning'): you are about to release a new version of $(red 'bake' --fg green)." echo echo 'Please do this simple math problem to prove this is not accidental.' echo -docker/build: +build: # Build the images. set -ex && docker-compose build -docker//bash: @interactive docker/build +docker/bash: @interactive build docker-compose run --entrypoint bash bake -docker//build/full: - # Build the images. - set -ex && docker-compose build --no-cache - release//pypi: @interactive //python pipenv run python setup.py upload -docker/release: docker/build release//docker/github release//docker/dockerhub +docker/release: build //docker/github //docker/dockerhub -release//docker/github: docker/build +//docker/github: build set -ux - declare -a IMAGES=('bake:core' 'bake:latest' 'red') + declare -a IMAGES=('red', 'bake:core' 'bake:latest' 'bake:ci') for IMAGE in "${IMAGES[@]}"; do - bake_step "Building $IMAGE..." + bake_step "Pushing $IMAGE..." REMOTE_IMAGE="$REGISTRY/$USERNAME/bake/$IMAGE" @@ -52,15 +47,9 @@ release//docker/github: docker/build docker push "$REMOTE_IMAGE" done -release//docker/dockerhub: docker/build +//docker/dockerhub: build docker-compose push -//ci: //ci/setup - set -ex && mkdir -p reports/pytest && pytest --junitxml=reports/pytest/report.xml - -//ci/setup: @skip:key=Pipfile.lock - pipenv install --dev --deploy --system - random/python/ip: #!/usr/bin/env python import requests @@ -75,7 +64,7 @@ cli: echo "$(echo $(red test --fg yellow) $(red test --bold) $(red test --fg cyan) | bake_indent)" echo -//kr: +fun/kr: sparkescakesparkles="✨ 🍰 ✨" | pbcopy echo "$sparkescakesparkles" | pbcopy echo 'KR Copied!' | red --fg cyan diff --git a/docker-compose.yml b/docker-compose.yml index 0b65a87..fd3778b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -34,3 +34,11 @@ services: dockerfile: ./docker/red.Dockerfile depends_on: - core + + ci: + image: kennethreitz/bake:ci + build: + context: . + dockerfile: ./docker/ci.Dockerfile + depends_on: + - core diff --git a/docker/ci.Dockerfile b/docker/ci.Dockerfile new file mode 100644 index 0000000..6e557b8 --- /dev/null +++ b/docker/ci.Dockerfile @@ -0,0 +1,22 @@ +FROM kennethreitz/bake:core + +# -- Install CI deps. +RUN set -ex && \ + apt-get update -qq && \ + apt-get upgrade -y -qq && \ + apt-get install expect npm -y -qq >/dev/null && \ + apt-get clean -y -qq && \ + apt-get autoclean -y -qq + +# -- Install bats. +RUN set -ex && npm install -g bats > /dev/null + +# -- Install latest Bake. +RUN set -ex && \ + pip3 install bake-cli --upgrade --quiet > /dev/null + +# -- Really slim down that image. +RUN set -ex && \ + rm -fr /var/lib/apt/lists + +ENTRYPOINT [ "bash" ] diff --git a/docker/core.Dockerfile b/docker/core.Dockerfile index b5959a7..d25118f 100644 --- a/docker/core.Dockerfile +++ b/docker/core.Dockerfile @@ -13,7 +13,7 @@ RUN set -ex && \ RUN set -ex && \ apt-get update -qq && \ apt-get upgrade -y -qq && \ - apt-get install curl python3 python3-distutils -y -qq >/dev/null && \ + apt-get install curl python3 git python3-distutils -y -qq >/dev/null && \ apt-get clean -y -qq && \ apt-get autoclean -y -qq