Skip to content

Commit 9267973

Browse files
authored
Merge pull request #4 from upsidetravel/build-package
Build package using poetry
2 parents a8999f9 + 3198ba8 commit 9267973

File tree

7 files changed

+596
-52
lines changed

7 files changed

+596
-52
lines changed

.circleci/config.yml

Lines changed: 68 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,74 @@
1+
# with thanks to https://dev.to/jonatasbaldin/a-recipe-for-poetry-and-circleci-1bj6
12
version: 2.1
23
jobs:
4+
# Building and testing the project
5+
# Useful when a PR is open, for example
36
build:
47
docker:
5-
- image: themattrix/tox
8+
- image: circleci/python:3.7.3 # includes `poetry`!
69
steps:
710
- checkout
8-
- run: tox
11+
12+
# Cache can be tricky at first, but this means restore the cache if the text key
13+
# `deps-{{ checksum "poetry.lock" }}` changes (and it WILL change every time poetry.lock
14+
# is updated since we rely on its checksum) and poetry.lock is updated every time we add
15+
# a new dependency to our project
16+
- restore_cache:
17+
keys:
18+
- deps-{{ checksum "poetry.lock" }}
19+
20+
- run:
21+
name: install dependencies
22+
command: |
23+
poetry install
24+
25+
- run:
26+
name: Run all the testing steps
27+
command: |
28+
poetry run tox
29+
30+
# Save the specified path as a cache. This is the path Poetry uses to install the dependencies
31+
# So if you don't install anything new, this folder won't change and the cache will be effective
32+
- save_cache:
33+
key: deps-{{ checksum "poetry.lock" }}
34+
paths:
35+
- /home/circleci/.cache/pypoetry/virtualenvs
36+
- /home/circleci/project/.tox
37+
38+
deployment:
39+
docker:
40+
- image: circleci/python:3.7.3
41+
steps:
42+
- checkout
43+
- run:
44+
name: publish to PyPI
45+
command: |
46+
poetry publish --build --username "${PYPI_USERNAME}" --password "${PYPI_PASSWORD}" --no-interaction
47+
48+
# When to run which job
49+
workflows:
50+
version: 2.1
51+
52+
build-workflow:
53+
jobs:
54+
- build
55+
56+
# The deployment workflow publishes the package, and is only run on a Git tag matching a
57+
# version regex
58+
deployment-workflow:
59+
jobs:
60+
- build:
61+
filters:
62+
tags:
63+
only: /v[0-9]+(\.[0-9]+)*/
64+
branches:
65+
ignore: /.*/
66+
67+
- deployment:
68+
requires:
69+
- build
70+
filters:
71+
tags:
72+
only: /v[0-9]+(\.[0-9]+)*/
73+
branches:
74+
ignore: /.*/

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @upsidetravel/full-access

0 commit comments

Comments
 (0)