Skip to content

Commit 739d390

Browse files
committed
ci: Move linter task to cirrus
1 parent 94a9cd2 commit 739d390

File tree

5 files changed

+45
-90
lines changed

5 files changed

+45
-90
lines changed

.cirrus.yml

Lines changed: 31 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,21 @@ env:
1515
CCACHE_SIZE: "200M"
1616
CCACHE_DIR: "/tmp/ccache_dir"
1717

18-
### Global task template
19-
18+
### Base template
2019
# https://cirrus-ci.org/guide/tips-and-tricks/#sharing-configuration-between-tasks
20+
base_template: &BASE_TEMPLATE
21+
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
22+
merge_base_script:
23+
- if [ "$CIRRUS_PR" = "" ]; then exit 0; fi
24+
- bash -c "$PACKAGE_MANAGER_INSTALL git"
25+
- git fetch $CIRRUS_REPO_CLONE_URL $CIRRUS_BASE_BRANCH
26+
- git config --global user.email "[email protected]"
27+
- git config --global user.name "ci"
28+
- git merge FETCH_HEAD # Merge base to detect silent merge conflicts
29+
30+
### Global task template
2131
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
32+
<< : *BASE_TEMPLATE
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,24 @@ 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+
# For faster CI feedback, immediately schedule the linters. https://cirrus-ci.org/pricing/#compute-credits
66+
use_compute_credits: $CIRRUS_REPO_FULL_NAME == 'bitcoin/bitcoin'
67+
setup_script:
68+
- set -o errexit; source ./ci/test/00_setup_env.sh
69+
before_install_script:
70+
- set -o errexit; source ./ci/test/03_before_install.sh
71+
install_script:
72+
- set -o errexit; source ./ci/lint/04_install.sh
73+
before_script:
74+
- set -o errexit; source ./ci/lint/05_before_script.sh
75+
lint_script:
76+
- set -o errexit; source ./ci/lint/06_script.sh
77+
5778
task:
5879
name: 'ARM [unit tests, no functional tests] [buster]'
5980
<< : *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)