mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-02 14:37:42 -03:00
ci: Move linter task to cirrus
This commit is contained in:
parent
94a9cd25fd
commit
739d39022d
5 changed files with 45 additions and 90 deletions
41
.cirrus.yml
41
.cirrus.yml
|
@ -15,11 +15,21 @@ env:
|
||||||
CCACHE_SIZE: "200M"
|
CCACHE_SIZE: "200M"
|
||||||
CCACHE_DIR: "/tmp/ccache_dir"
|
CCACHE_DIR: "/tmp/ccache_dir"
|
||||||
|
|
||||||
### Global task template
|
### Base template
|
||||||
|
|
||||||
# https://cirrus-ci.org/guide/tips-and-tricks/#sharing-configuration-between-tasks
|
# https://cirrus-ci.org/guide/tips-and-tricks/#sharing-configuration-between-tasks
|
||||||
global_task_template: &GLOBAL_TASK_TEMPLATE
|
base_template: &BASE_TEMPLATE
|
||||||
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
|
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
|
||||||
|
merge_base_script:
|
||||||
|
- if [ "$CIRRUS_PR" = "" ]; then exit 0; fi
|
||||||
|
- bash -c "$PACKAGE_MANAGER_INSTALL git"
|
||||||
|
- git fetch $CIRRUS_REPO_CLONE_URL $CIRRUS_BASE_BRANCH
|
||||||
|
- git config --global user.email "ci@ci.ci"
|
||||||
|
- git config --global user.name "ci"
|
||||||
|
- git merge FETCH_HEAD # Merge base to detect silent merge conflicts
|
||||||
|
|
||||||
|
### Global task template
|
||||||
|
global_task_template: &GLOBAL_TASK_TEMPLATE
|
||||||
|
<< : *BASE_TEMPLATE
|
||||||
ccache_cache:
|
ccache_cache:
|
||||||
folder: "/tmp/ccache_dir"
|
folder: "/tmp/ccache_dir"
|
||||||
depends_built_cache:
|
depends_built_cache:
|
||||||
|
@ -28,13 +38,6 @@ global_task_template: &GLOBAL_TASK_TEMPLATE
|
||||||
folder: "/tmp/cirrus-ci-build/depends/sdk-sources"
|
folder: "/tmp/cirrus-ci-build/depends/sdk-sources"
|
||||||
depends_releases_cache:
|
depends_releases_cache:
|
||||||
folder: "/tmp/cirrus-ci-build/releases"
|
folder: "/tmp/cirrus-ci-build/releases"
|
||||||
merge_base_script:
|
|
||||||
- if [ "$CIRRUS_PR" = "" ]; then exit 0; fi
|
|
||||||
- bash -c "$PACKAGE_MANAGER_INSTALL git"
|
|
||||||
- git fetch $CIRRUS_REPO_CLONE_URL $CIRRUS_BASE_BRANCH
|
|
||||||
- git config --global user.email "ci@ci.ci"
|
|
||||||
- git config --global user.name "ci"
|
|
||||||
- git merge FETCH_HEAD # Merge base to detect silent merge conflicts
|
|
||||||
ci_script:
|
ci_script:
|
||||||
- ./ci/test_run_all.sh
|
- ./ci/test_run_all.sh
|
||||||
|
|
||||||
|
@ -54,6 +57,24 @@ global_task_template: &GLOBAL_TASK_TEMPLATE
|
||||||
# install_script:
|
# install_script:
|
||||||
# - choco install python --version=3.7.7 -y
|
# - choco install python --version=3.7.7 -y
|
||||||
|
|
||||||
|
task:
|
||||||
|
name: 'lint'
|
||||||
|
<< : *BASE_TEMPLATE
|
||||||
|
container:
|
||||||
|
image: ubuntu:bionic # For python 3.6, oldest supported version according to doc/dependencies.md
|
||||||
|
# For faster CI feedback, immediately schedule the linters. https://cirrus-ci.org/pricing/#compute-credits
|
||||||
|
use_compute_credits: $CIRRUS_REPO_FULL_NAME == 'bitcoin/bitcoin'
|
||||||
|
setup_script:
|
||||||
|
- set -o errexit; source ./ci/test/00_setup_env.sh
|
||||||
|
before_install_script:
|
||||||
|
- set -o errexit; source ./ci/test/03_before_install.sh
|
||||||
|
install_script:
|
||||||
|
- set -o errexit; source ./ci/lint/04_install.sh
|
||||||
|
before_script:
|
||||||
|
- set -o errexit; source ./ci/lint/05_before_script.sh
|
||||||
|
lint_script:
|
||||||
|
- set -o errexit; source ./ci/lint/06_script.sh
|
||||||
|
|
||||||
task:
|
task:
|
||||||
name: 'ARM [unit tests, no functional tests] [buster]'
|
name: 'ARM [unit tests, no functional tests] [buster]'
|
||||||
<< : *GLOBAL_TASK_TEMPLATE
|
<< : *GLOBAL_TASK_TEMPLATE
|
||||||
|
|
66
.travis.yml
66
.travis.yml
|
@ -1,66 +0,0 @@
|
||||||
# Travis caches can be manually removed if necessary. This is one of the very
|
|
||||||
# few manual operations that is possible with Travis, and it can be done by a
|
|
||||||
# Bitcoin Core GitHub member via the Travis web interface [0].
|
|
||||||
#
|
|
||||||
# Travis CI uploads the cache after the script phase of the build [1].
|
|
||||||
# However, the build is terminated without saving the cache if it takes over
|
|
||||||
# 50 minutes [2]. Thus, if we spent too much time in early build stages, fail
|
|
||||||
# with an error and save the cache.
|
|
||||||
#
|
|
||||||
# [0] https://travis-ci.org/bitcoin/bitcoin/caches
|
|
||||||
# [1] https://docs.travis-ci.com/user/caching/#build-phases
|
|
||||||
# [2] https://docs.travis-ci.com/user/customizing-the-build#build-timeouts
|
|
||||||
|
|
||||||
version: ~> 1.0
|
|
||||||
|
|
||||||
dist: bionic
|
|
||||||
os: linux
|
|
||||||
language: minimal
|
|
||||||
arch: amd64
|
|
||||||
cache:
|
|
||||||
directories:
|
|
||||||
- $TRAVIS_BUILD_DIR/depends/built
|
|
||||||
- $TRAVIS_BUILD_DIR/depends/sdk-sources
|
|
||||||
- $TRAVIS_BUILD_DIR/ci/scratch/.ccache
|
|
||||||
- $TRAVIS_BUILD_DIR/releases/$HOST
|
|
||||||
stages:
|
|
||||||
- lint
|
|
||||||
- test
|
|
||||||
env:
|
|
||||||
global:
|
|
||||||
- CI_RETRY_EXE="travis_retry"
|
|
||||||
- CACHE_ERR_MSG="Error! Initial build successful, but not enough time remains to run later build stages and tests. See https://docs.travis-ci.com/user/customizing-the-build#build-timeouts . Please manually re-run this job by using the travis restart button. The next run should not time out because the build cache has been saved."
|
|
||||||
before_install:
|
|
||||||
- set -o errexit; source ./ci/test/00_setup_env.sh
|
|
||||||
- set -o errexit; source ./ci/test/03_before_install.sh
|
|
||||||
install:
|
|
||||||
- set -o errexit; source ./ci/test/04_install.sh
|
|
||||||
before_script:
|
|
||||||
# Temporary workaround for https://github.com/bitcoin/bitcoin/issues/16368
|
|
||||||
- for i in {1..4}; do echo "$(sleep 500)" ; done &
|
|
||||||
- set -o errexit; source ./ci/test/05_before_script.sh &> "/dev/null"
|
|
||||||
script:
|
|
||||||
- export CONTINUE=1
|
|
||||||
- if [ $SECONDS -gt 1200 ]; then export CONTINUE=0; fi # Likely the depends build took very long
|
|
||||||
- if [ $TRAVIS_REPO_SLUG = "bitcoin/bitcoin" ]; then export CONTINUE=1; fi # continue on repos with extended build time (90 minutes)
|
|
||||||
- if [ $CONTINUE = "1" ]; then set -o errexit; source ./ci/test/06_script_a.sh; else set +o errexit; echo "$CACHE_ERR_MSG"; false; fi
|
|
||||||
- if [[ $SECONDS -gt 50*60-$EXPECTED_TESTS_DURATION_IN_SECONDS ]]; then export CONTINUE=0; fi
|
|
||||||
- if [ $TRAVIS_REPO_SLUG = "bitcoin/bitcoin" ]; then export CONTINUE=1; fi # continue on repos with extended build time (90 minutes)
|
|
||||||
- if [ $CONTINUE = "1" ]; then set -o errexit; source ./ci/test/06_script_b.sh; else set +o errexit; echo "$CACHE_ERR_MSG"; false; fi
|
|
||||||
after_script:
|
|
||||||
- echo $TRAVIS_COMMIT_RANGE
|
|
||||||
jobs:
|
|
||||||
include:
|
|
||||||
|
|
||||||
- stage: lint
|
|
||||||
name: 'lint'
|
|
||||||
env:
|
|
||||||
cache: pip
|
|
||||||
language: python
|
|
||||||
python: '3.6' # Oldest supported version according to doc/dependencies.md
|
|
||||||
install:
|
|
||||||
- set -o errexit; source ./ci/lint/04_install.sh
|
|
||||||
before_script:
|
|
||||||
- set -o errexit; source ./ci/lint/05_before_script.sh
|
|
||||||
script:
|
|
||||||
- set -o errexit; source ./ci/lint/06_script.sh
|
|
|
@ -6,14 +6,14 @@
|
||||||
|
|
||||||
export LC_ALL=C
|
export LC_ALL=C
|
||||||
|
|
||||||
travis_retry sudo apt update && sudo apt install -y clang-format-9
|
${CI_RETRY_EXE} apt update && apt install -y clang-format-9 python3-pip curl git
|
||||||
sudo update-alternatives --install /usr/bin/clang-format clang-format $(which clang-format-9 ) 100
|
update-alternatives --install /usr/bin/clang-format clang-format $(which clang-format-9 ) 100
|
||||||
sudo update-alternatives --install /usr/bin/clang-format-diff clang-format-diff $(which clang-format-diff-9) 100
|
update-alternatives --install /usr/bin/clang-format-diff clang-format-diff $(which clang-format-diff-9) 100
|
||||||
|
|
||||||
travis_retry pip3 install codespell==1.17.1
|
${CI_RETRY_EXE} pip3 install codespell==1.17.1
|
||||||
travis_retry pip3 install flake8==3.8.3
|
${CI_RETRY_EXE} pip3 install flake8==3.8.3
|
||||||
travis_retry pip3 install yq
|
${CI_RETRY_EXE} pip3 install yq
|
||||||
travis_retry pip3 install mypy==0.781
|
${CI_RETRY_EXE} pip3 install mypy==0.781
|
||||||
|
|
||||||
SHELLCHECK_VERSION=v0.7.1
|
SHELLCHECK_VERSION=v0.7.1
|
||||||
curl -sL "https://github.com/koalaman/shellcheck/releases/download/${SHELLCHECK_VERSION}/shellcheck-${SHELLCHECK_VERSION}.linux.x86_64.tar.xz" | tar --xz -xf - --directory /tmp/
|
curl -sL "https://github.com/koalaman/shellcheck/releases/download/${SHELLCHECK_VERSION}/shellcheck-${SHELLCHECK_VERSION}.linux.x86_64.tar.xz" | tar --xz -xf - --directory /tmp/
|
||||||
|
|
|
@ -6,4 +6,4 @@
|
||||||
|
|
||||||
export LC_ALL=C
|
export LC_ALL=C
|
||||||
|
|
||||||
git fetch --unshallow
|
git fetch
|
||||||
|
|
|
@ -6,11 +6,11 @@
|
||||||
|
|
||||||
export LC_ALL=C
|
export LC_ALL=C
|
||||||
|
|
||||||
if [ "$TRAVIS_EVENT_TYPE" = "pull_request" ]; then
|
if [ -n "$CIRRUS_PR" ]; then
|
||||||
# TRAVIS_BRANCH will be present in a Travis environment. For builds triggered
|
# CIRRUS_PR will be present in a Cirrus environment. For builds triggered
|
||||||
# by a pull request this is the name of the branch targeted by the pull request.
|
# by a pull request this is the name of the branch targeted by the pull request.
|
||||||
# https://docs.travis-ci.com/user/environment-variables/
|
# https://cirrus-ci.org/guide/writing-tasks/#environment-variables
|
||||||
COMMIT_RANGE="$TRAVIS_BRANCH..HEAD"
|
COMMIT_RANGE="$CIRRUS_BRANCH..HEAD"
|
||||||
test/lint/commit-script-check.sh $COMMIT_RANGE
|
test/lint/commit-script-check.sh $COMMIT_RANGE
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -25,8 +25,8 @@ test/lint/check-doc.py
|
||||||
test/lint/check-rpc-mappings.py .
|
test/lint/check-rpc-mappings.py .
|
||||||
test/lint/lint-all.sh
|
test/lint/lint-all.sh
|
||||||
|
|
||||||
if [ "$TRAVIS_REPO_SLUG" = "bitcoin/bitcoin" ] && [ "$TRAVIS_EVENT_TYPE" = "cron" ]; then
|
if [ "$CIRRUS_REPO_FULL_NAME" = "bitcoin/bitcoin" ] && [ -n "$CIRRUS_CRON" ]; then
|
||||||
git log --merges --before="2 days ago" -1 --format='%H' > ./contrib/verify-commits/trusted-sha512-root-commit
|
git log --merges --before="2 days ago" -1 --format='%H' > ./contrib/verify-commits/trusted-sha512-root-commit
|
||||||
travis_retry gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys $(<contrib/verify-commits/trusted-keys) &&
|
${CI_RETRY_EXE} gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys $(<contrib/verify-commits/trusted-keys) &&
|
||||||
./contrib/verify-commits/verify-commits.py --clean-merge=2;
|
./contrib/verify-commits/verify-commits.py --clean-merge=2;
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Add table
Reference in a new issue