Debian Codegraph @

.circleci/config.yml

raw
1 version: 2.1
2
3 executors:
4 docker-publisher:
5 environment:
6 IMAGE_NAME: bukuserver/bukuserver
7 docker:
8 - image: cimg/base:current
9
10 test-template: &test-template
11 working_directory: ~/Buku
12 environment:
13 CI_FORCE_TEST: 1
14 steps:
15 - run: &init
16 command: |
17 apt update && apt install -y --no-install-recommends git
18 pip install --upgrade pip
19 - checkout
20 - run: &deps
21 command: |
22 pip install -e . --group dev
23 - run:
24 command:
25 python3 -m pytest ./tests/test_*.py --cov buku -vv --durations=0 -c ./tests/pytest.ini
26
27 lint-template: &lint-template
28 working_directory: ~/Buku
29 environment:
30 CI_FORCE_TEST: 1
31 steps:
32 - run: *init
33 - checkout
34 - run: *deps
35 - run:
36 command: |
37 python3 -m flake8
38 echo buku | xargs pylint --rcfile tests/.pylintrc
39 find . -iname "*.py" ! -path "./api/*" | xargs pylint --rcfile tests/.pylintrc
40
41 jobs:
42 lint:
43 docker:
44 - image: python:3.13-slim
45 <<: *lint-template
46
47 py310:
48 docker:
49 - image: python:3.10-slim
50 <<: *test-template
51
52 py311:
53 docker:
54 - image: python:3.11-slim
55 <<: *test-template
56
57 py312:
58 docker:
59 - image: python:3.12-slim
60 <<: *test-template
61
62 py313:
63 docker:
64 - image: python:3.13-slim
65 <<: *test-template
66
67 py314:
68 docker:
69 - image: python:3.14-slim
70 <<: *test-template
71
72 # package-and-publish:
73 # machine: true
74 # working_directory: ~/Buku
75 # steps:
76 # - checkout
77 # - run:
78 # name: "package with packagecore"
79 # command: |
80 # # Use latest installed python3 from pyenv
81 # export PYENV_VERSION="$(pyenv versions | grep -Po '\b3\.\d+\.\d+' | tail -1)"
82 # pip install packagecore
83 # packagecore -o ./dist/ ${CIRCLE_TAG#v}
84 # - run:
85 # name: "publish to GitHub"
86 # command: |
87 # go get github.com/tcnksm/ghr
88 # ghr -t ${GITHUB_API_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} -replace ${CIRCLE_TAG} ./dist/
89
90 build-and-publish-docker-image:
91 executor: docker-publisher
92 steps:
93 - checkout
94 - setup_remote_docker
95 - run:
96 name: Login to Docker Hub
97 command: 'echo "$DOCKERHUB_PASS" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin'
98 - run:
99 name: Create a builder instance
100 command: docker buildx create --use
101 - run:
102 name: Build Docker image and publish it to Docker Hub
103 command: |
104 TAGS="--tag $IMAGE_NAME:latest"
105 [ "$CIRCLE_TAG" ] && TAGS="--tag $IMAGE_NAME:$CIRCLE_TAG $TAGS"
106 docker buildx build --platform=linux/amd64,linux/arm64 $TAGS --push .
107
108 workflows:
109 version: 2.1
110
111 CircleCI:
112 jobs: &all-tests
113 - lint
114 - py310
115 - py311
116 - py312
117 - py313
118 - py314
119
120 nightly:
121 triggers:
122 - schedule:
123 cron: "0 0 * * 6"
124 filters:
125 branches:
126 only:
127 - master
128 jobs: *all-tests
129
130 # publish-github-release:
131 # jobs:
132 # - package-and-publish:
133 # filters:
134 # tags:
135 # only: /^v.*/
136 # branches:
137 # ignore: /.*/
138
139 publish-docker-image:
140 jobs:
141 - build-and-publish-docker-image:
142 filters:
143 tags:
144 only: /^v.*/
145 branches:
146 ignore: /.*/