Skip to content

Commit 6f2ca72

Browse files
author
MarcoFalke
committed
Merge #20658: ci: Move linter task to cirrus
4045a67 ci: Use cpu=1 for linter (Dhruv Mehta) 739d390 ci: Move linter task to cirrus (Dhruv Mehta) Pull request description: Solves #20467: Move linter to Cirrus-CI as Travis-CI.org is shutting down ACKs for top commit: MarcoFalke: ACK 4045a67 Tree-SHA512: 9aa7487ac86c91fc68bb584d29134e304dbd46702514a5d47d1ef0de6b877d96d42b7589870fc67ad9a31f5d3a789728446da4418688f336111a9ba0f8de5feb
2 parents 1811e48 + 4045a67 commit 6f2ca72

File tree

5 files changed

+53
-97
lines changed

5 files changed

+53
-97
lines changed

.cirrus.yml

Lines changed: 39 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,5 @@
11
### Global defaults
22

3-
timeout_in: 120m # https://cirrus-ci.org/faq/#instance-timed-out
4-
container:
5-
# https://cirrus-ci.org/faq/#are-there-any-limits
6-
# Each project has 16 CPU in total, assign 2 to each container, so that 8 tasks run in parallel
7-
cpu: 2
8-
memory: 8G # Set to 8GB to avoid OOM. https://cirrus-ci.org/guide/linux/#linux-containers
9-
kvm: true # Use kvm to avoid spurious CI failures in the default virtualization cluster, see https://github.com/bitcoin/bitcoin/issues/20093
103
env:
114
PACKAGE_MANAGER_INSTALL: "apt-get update && apt-get install -y"
125
MAKEJOBS: "-j4"
@@ -15,11 +8,28 @@ env:
158
CCACHE_SIZE: "200M"
169
CCACHE_DIR: "/tmp/ccache_dir"
1710

18-
### Global task template
19-
11+
### Base template
2012
# https://cirrus-ci.org/guide/tips-and-tricks/#sharing-configuration-between-tasks
13+
base_template: &BASE_TEMPLATE
14+
skip: $CIRRUS_REPO_FULL_NAME == "bitcoin-core/gui" && $CIRRUS_PR == "" # No need to run on the read-only mirror, unless it is a PR. https://cirrus-ci.org/guide/writing-tasks/#conditional-task-execution
15+
merge_base_script:
16+
- if [ "$CIRRUS_PR" = "" ]; then exit 0; fi
17+
- bash -c "$PACKAGE_MANAGER_INSTALL git"
18+
- git fetch $CIRRUS_REPO_CLONE_URL $CIRRUS_BASE_BRANCH
19+
- git config --global user.email "[email protected]"
20+
- git config --global user.name "ci"
21+
- git merge FETCH_HEAD # Merge base to detect silent merge conflicts
22+
23+
### Global task template
2124
global_task_template: &GLOBAL_TASK_TEMPLATE
22-
skip: $CIRRUS_REPO_FULL_NAME == "bitcoin-core/gui" && $CIRRUS_PR == "" # No need to run on the read-only mirror, unless it is a PR. https://cirrus-ci.org/guide/writing-tasks/#conditional-task-execution
25+
<< : *BASE_TEMPLATE
26+
timeout_in: 120m # https://cirrus-ci.org/faq/#instance-timed-out
27+
container:
28+
# https://cirrus-ci.org/faq/#are-there-any-limits
29+
# Each project has 16 CPU in total, assign 2 to each container, so that 8 tasks run in parallel
30+
cpu: 2
31+
memory: 8G # Set to 8GB to avoid OOM. https://cirrus-ci.org/guide/linux/#linux-containers
32+
kvm: true # Use kvm to avoid spurious CI failures in the default virtualization cluster, see https://github.com/bitcoin/bitcoin/issues/20093
2333
ccache_cache:
2434
folder: "/tmp/ccache_dir"
2535
depends_built_cache:
@@ -28,13 +38,6 @@ global_task_template: &GLOBAL_TASK_TEMPLATE
2838
folder: "/tmp/cirrus-ci-build/depends/sdk-sources"
2939
depends_releases_cache:
3040
folder: "/tmp/cirrus-ci-build/releases"
31-
merge_base_script:
32-
- if [ "$CIRRUS_PR" = "" ]; then exit 0; fi
33-
- bash -c "$PACKAGE_MANAGER_INSTALL git"
34-
- git fetch $CIRRUS_REPO_CLONE_URL $CIRRUS_BASE_BRANCH
35-
- git config --global user.email "[email protected]"
36-
- git config --global user.name "ci"
37-
- git merge FETCH_HEAD # Merge base to detect silent merge conflicts
3841
ci_script:
3942
- ./ci/test_run_all.sh
4043

@@ -54,6 +57,25 @@ global_task_template: &GLOBAL_TASK_TEMPLATE
5457
# install_script:
5558
# - choco install python --version=3.7.7 -y
5659

60+
task:
61+
name: 'lint'
62+
<< : *BASE_TEMPLATE
63+
container:
64+
image: ubuntu:bionic # For python 3.6, oldest supported version according to doc/dependencies.md
65+
cpu: 1 # Cut bill in half for linting
66+
# For faster CI feedback, immediately schedule the linters. https://cirrus-ci.org/pricing/#compute-credits
67+
use_compute_credits: $CIRRUS_REPO_FULL_NAME == 'bitcoin/bitcoin'
68+
setup_script:
69+
- set -o errexit; source ./ci/test/00_setup_env.sh
70+
before_install_script:
71+
- set -o errexit; source ./ci/test/03_before_install.sh
72+
install_script:
73+
- set -o errexit; source ./ci/lint/04_install.sh
74+
before_script:
75+
- set -o errexit; source ./ci/lint/05_before_script.sh
76+
lint_script:
77+
- set -o errexit; source ./ci/lint/06_script.sh
78+
5779
task:
5880
name: 'ARM [unit tests, no functional tests] [buster]'
5981
<< : *GLOBAL_TASK_TEMPLATE

.travis.yml

Lines changed: 0 additions & 66 deletions
This file was deleted.

ci/lint/04_install.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@
66

77
export LC_ALL=C
88

9-
travis_retry sudo apt update && sudo apt install -y clang-format-9
10-
sudo update-alternatives --install /usr/bin/clang-format clang-format $(which clang-format-9 ) 100
11-
sudo update-alternatives --install /usr/bin/clang-format-diff clang-format-diff $(which clang-format-diff-9) 100
9+
${CI_RETRY_EXE} apt update && apt install -y clang-format-9 python3-pip curl git
10+
update-alternatives --install /usr/bin/clang-format clang-format $(which clang-format-9 ) 100
11+
update-alternatives --install /usr/bin/clang-format-diff clang-format-diff $(which clang-format-diff-9) 100
1212

13-
travis_retry pip3 install codespell==1.17.1
14-
travis_retry pip3 install flake8==3.8.3
15-
travis_retry pip3 install yq
16-
travis_retry pip3 install mypy==0.781
13+
${CI_RETRY_EXE} pip3 install codespell==1.17.1
14+
${CI_RETRY_EXE} pip3 install flake8==3.8.3
15+
${CI_RETRY_EXE} pip3 install yq
16+
${CI_RETRY_EXE} pip3 install mypy==0.781
1717

1818
SHELLCHECK_VERSION=v0.7.1
1919
curl -sL "https://github.com/koalaman/shellcheck/releases/download/${SHELLCHECK_VERSION}/shellcheck-${SHELLCHECK_VERSION}.linux.x86_64.tar.xz" | tar --xz -xf - --directory /tmp/

ci/lint/05_before_script.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66

77
export LC_ALL=C
88

9-
git fetch --unshallow
9+
git fetch

ci/lint/06_script.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66

77
export LC_ALL=C
88

9-
if [ "$TRAVIS_EVENT_TYPE" = "pull_request" ]; then
10-
# TRAVIS_BRANCH will be present in a Travis environment. For builds triggered
9+
if [ -n "$CIRRUS_PR" ]; then
10+
# CIRRUS_PR will be present in a Cirrus environment. For builds triggered
1111
# by a pull request this is the name of the branch targeted by the pull request.
12-
# https://docs.travis-ci.com/user/environment-variables/
13-
COMMIT_RANGE="$TRAVIS_BRANCH..HEAD"
12+
# https://cirrus-ci.org/guide/writing-tasks/#environment-variables
13+
COMMIT_RANGE="$CIRRUS_BRANCH..HEAD"
1414
test/lint/commit-script-check.sh $COMMIT_RANGE
1515
fi
1616

@@ -25,8 +25,8 @@ test/lint/check-doc.py
2525
test/lint/check-rpc-mappings.py .
2626
test/lint/lint-all.sh
2727

28-
if [ "$TRAVIS_REPO_SLUG" = "bitcoin/bitcoin" ] && [ "$TRAVIS_EVENT_TYPE" = "cron" ]; then
28+
if [ "$CIRRUS_REPO_FULL_NAME" = "bitcoin/bitcoin" ] && [ -n "$CIRRUS_CRON" ]; then
2929
git log --merges --before="2 days ago" -1 --format='%H' > ./contrib/verify-commits/trusted-sha512-root-commit
30-
travis_retry gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys $(<contrib/verify-commits/trusted-keys) &&
30+
${CI_RETRY_EXE} gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys $(<contrib/verify-commits/trusted-keys) &&
3131
./contrib/verify-commits/verify-commits.py --clean-merge=2;
3232
fi

0 commit comments

Comments
 (0)