Skip to content

Commit 9b86114

Browse files
committed
ci: Use pyenv's python-build to install Python in lint task
1 parent cb32328 commit 9b86114

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

.cirrus.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,14 @@ task:
6767
name: 'lint [bionic]'
6868
<< : *BASE_TEMPLATE
6969
container:
70-
image: ubuntu:bionic # For python 3.6, oldest supported version according to doc/dependencies.md
70+
image: ubuntu:bionic
7171
cpu: 1
7272
memory: 1G
7373
# For faster CI feedback, immediately schedule the linters
7474
<< : *CREDITS_TEMPLATE
75+
python_cache:
76+
folder: "/tmp/python"
77+
fingerprint_script: cat .python-version /etc/os-release
7578
lint_script:
7679
- ./ci/lint_run_all.sh
7780
env:

ci/lint/04_install.sh

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,26 @@
77
export LC_ALL=C
88

99
${CI_RETRY_EXE} apt-get update
10-
${CI_RETRY_EXE} apt-get install -y python3-pip curl git gawk jq
10+
${CI_RETRY_EXE} apt-get install -y curl git gawk jq xz-utils
11+
12+
PYTHON_PATH=/tmp/python
13+
if [ ! -d "${PYTHON_PATH}/bin" ]; then
14+
(
15+
git clone https://github.com/pyenv/pyenv.git
16+
cd pyenv/plugins/python-build || exit 1
17+
./install.sh
18+
)
19+
# For dependencies see https://github.com/pyenv/pyenv/wiki#suggested-build-environment
20+
${CI_RETRY_EXE} apt-get install -y build-essential libssl-dev zlib1g-dev \
21+
libbz2-dev libreadline-dev libsqlite3-dev curl llvm \
22+
libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev \
23+
clang
24+
env CC=clang python-build "$(cat "${BASE_ROOT_DIR}/.python-version")" "${PYTHON_PATH}"
25+
fi
26+
export PATH="${PYTHON_PATH}/bin:${PATH}"
27+
command -v python3
28+
python3 --version
29+
1130
(
1231
# Temporary workaround for https://github.com/bitcoin/bitcoin/pull/26130#issuecomment-1260499544
1332
# Can be removed once the underlying image is bumped to something that includes git2.34 or later

0 commit comments

Comments
 (0)