Skip to content

Commit

Permalink
Merge pull request #3 from trewq34/add-circleci
Browse files Browse the repository at this point in the history
Add CircleCI
  • Loading branch information
trewq34 authored Jul 27, 2022
2 parents d21e548 + d58a4df commit 333b100
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 1 deletion.
58 changes: 58 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
version: 2.1

workflows:
build-upload:
jobs:
- build-upload-pypi:
filters:
branches:
ignore: /.*/
tags:
only: /^([0-9]+)\.([0-9]+)\.([0-9]+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+)?$/
- build-push-docker:
filters:
branches:
ignore: /.*/
tags:
only: /^([0-9]+)\.([0-9]+)\.([0-9]+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+)?$/

jobs:
build-upload-pypi:
docker:
- image: trussworks/ghr:latest
steps:
- checkout
- run:
name: Build and upload to PyPI
command: |
python -m pip install build twine
python -m build --wheel --sdist
python -m twine check dist/*
python -m twine upload --repository testpypi -u $PYPI_USERNAME -p $PYPI_PASSWORD dist/*
- run:
name: Create Github release
command: |
ghr -u $CIRCLE_PROJECT_USERNAME -r $CIRCLE_PROJECT_REPONAME -c $CIRCLE_SHA1 ${CIRCLE_TAG:-$(cat setup.py | egrep -o "([0-9]+)\.([0-9]+)\.([0-9]+)")} dist/
build-push-docker:
docker:
- image: cimg/base:stable
steps:
- setup_remote_docker:
version: 20.10.11
- run:
name: Setup environment for multi-platform builds
command: |
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
docker context create buildx-build
docker buildx create --use --platform linux/arm64,linux/amd64 buildx-build
docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
docker buildx inspect --bootstrap
docker buildx ls
- checkout
- run:
name: Set version env var
command: echo 'export VERSION='${CIRCLE_TAG:-$(cat setup.py | egrep -o "([0-9]+)\.([0-9]+)\.([0-9]+)")} >> $BASH_ENV
- run:
name: Build docker image
command: docker buildx build . --platform linux/arm64,linux/amd64 -t trewq34/auther-test:${VERSION} -t trewq34/auther-test:latest --push
3 changes: 2 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ venv
.git
*.egg-info
.DS_Store
dist
dist
.circleci

0 comments on commit 333b100

Please sign in to comment.