forked from bitcoin/bitcoin
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Add support for Gitlab CI #3149
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
fd31a10
Add .gitlab-ci.yml
codablock 5df4333
Use | instead of > for multiline commands
codablock c2a3971
Use ubuntu:bionic as base image
codablock 30dbbcb
Move cache initialization before apt-get installs
codablock 81e4631
Cache apt packages
codablock 99faeb3
Move installation of wget and unzip up as we need it for the cache
codablock 124047e
Prevent apt from deleting caches
codablock ad19766
Collect test logs into artifact
codablock 8cefdaf
Make combine_logs.py always look for the template in the correct dir
codablock c2cd278
Move final cache stuff into after_script
codablock b3a3d6b
Reintroduce PYTHON_DEBUG=1, but only for .travis.yml
codablock ee1d097
Install jinja2 in Travis builder image
codablock e5ebabe
Enable ChainLocks after quorums have been created
codablock 98554ea
Increase timeout in wallet-dump.py test
codablock File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,140 @@ | ||
| image: "ubuntu:bionic" | ||
|
|
||
| variables: | ||
| DOCKER_DRIVER: overlay2 | ||
|
|
||
| cache: | ||
| # Cache by branch/tag and job name | ||
| # Gitlab can't use caches from parent pipelines when doing the first build in a PR, so we use artifacts to copy | ||
| # caches into PRs | ||
| key: ${CI_COMMIT_REF_SLUG}-${CI_JOB_NAME}${CI_EXTERNAL_PULL_REQUEST_IID} | ||
| paths: | ||
| - $CI_PROJECT_DIR/cache | ||
|
|
||
| stages: | ||
| - build | ||
|
|
||
| .build_template: &build_template | ||
| stage: build | ||
| before_script: | ||
| - export BUILD_TARGET="$CI_JOB_NAME" | ||
| - echo BUILD_TARGET=$BUILD_TARGET | ||
| - source ./ci/matrix.sh | ||
|
|
||
| # The ubuntu base image has apt configured to delete caches after each invocation, which is something that is not desirable for us | ||
| - rm /etc/apt/apt.conf.d/docker-clean | ||
| - apt-get update | ||
| - apt-get install -y wget unzip | ||
|
|
||
| # Init cache | ||
| - export CACHE_DIR=$CI_PROJECT_DIR/cache | ||
| - mkdir -p $CACHE_DIR | ||
| - | | ||
| if [ "$CI_COMMIT_REF_SLUG" != "develop" -a "$CI_COMMIT_TAG" == "" ]; then | ||
| if [ ! -d $CACHE_DIR/ccache ]; then | ||
| echo "Downloading cache from develop branch" | ||
| if wget -O cache-artifact.zip https://gitlab.com/$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME/-/jobs/artifacts/develop/download?job=$CI_JOB_NAME; then | ||
| unzip cache-artifact.zip | ||
| rm cache-artifact.zip | ||
| mv cache-artifact/* $CACHE_DIR/ | ||
| else | ||
| echo "Failed to download cache" | ||
| fi | ||
| else | ||
| echo "Not touching cache (was initialized from previous build)" | ||
| fi | ||
| else | ||
| echo "Not touching cache (building develop branch or tag)" | ||
| fi | ||
| # Create missing cache dirs | ||
| - mkdir -p $CACHE_DIR/ccache && mkdir -p $CACHE_DIR/depends && mkdir -p $CACHE_DIR/sdk-sources && mkdir -p $CACHE_DIR/apt | ||
| # Keep this as it makes caching related debugging easier | ||
| - ls -lah $CACHE_DIR && ls -lah $CACHE_DIR/depends && ls -lah $CACHE_DIR/ccache && ls -lah $CACHE_DIR/apt | ||
| - mv $CACHE_DIR/apt/* /var/cache/apt/archives/ || true | ||
|
|
||
| # Install base packages | ||
| - apt-get dist-upgrade -y | ||
| - apt-get install -y git g++ autotools-dev libtool m4 automake autoconf pkg-config zlib1g-dev libssl1.0-dev curl ccache bsdmainutils cmake | ||
| - apt-get install -y python3 python3-dev python3-pip | ||
|
|
||
| # jinja2 is needed for combine_logs.py | ||
| - pip3 install jinja2 | ||
|
|
||
| # Setup some environment variables | ||
| - if [ "$CI_EXTERNAL_PULL_REQUEST_IID" != "" ]; then export PULL_REQUEST="true"; else export PULL_REQUEST="false"; fi | ||
| - export COMMIT_RANGE="$CI_COMMIT_BEFORE_SHA..$CI_COMMIT_SHA" | ||
| - export JOB_NUMBER="$CI_JOB_ID" | ||
| - export HOST_SRC_DIR=$CI_PROJECT_DIR | ||
| - echo PULL_REQUEST=$PULL_REQUEST COMMIT_RANGE=$COMMIT_RANGE HOST_SRC_DIR=$HOST_SRC_DIR CACHE_DIR=$CACHE_DIR | ||
| - echo "Commit log:" && git log --format=fuller -1 | ||
|
|
||
| # Build dash_hash | ||
| - git clone https://github.com/dashpay/dash_hash | ||
| - cd dash_hash && python3 setup.py install | ||
|
|
||
| # Install build target specific packages | ||
| - echo PACKAGES=$PACKAGES | ||
| - if [ -n "$DPKG_ADD_ARCH" ]; then dpkg --add-architecture "$DPKG_ADD_ARCH" ; fi | ||
| - if [ -n "$PACKAGES" ]; then apt-get update && apt-get install -y --no-install-recommends --no-upgrade $PACKAGES; fi | ||
|
|
||
| # Move apt packages into cache | ||
| - mv /var/cache/apt/archives/* $CACHE_DIR/apt/ || true | ||
|
|
||
| # Make mingw use correct threading libraries | ||
| - update-alternatives --set i686-w64-mingw32-gcc /usr/bin/i686-w64-mingw32-gcc-posix || true | ||
| - update-alternatives --set i686-w64-mingw32-g++ /usr/bin/i686-w64-mingw32-g++-posix || true | ||
| - update-alternatives --set x86_64-w64-mingw32-gcc /usr/bin/x86_64-w64-mingw32-gcc-posix || true | ||
| - update-alternatives --set x86_64-w64-mingw32-g++ /usr/bin/x86_64-w64-mingw32-g++-posix || true | ||
|
|
||
| script: | ||
| - export BUILD_TARGET="$CI_JOB_NAME" | ||
| - cd $CI_PROJECT_DIR | ||
| - ./ci/build_depends.sh | ||
| - ./ci/build_src.sh | ||
| - ./ci/test_unittests.sh | ||
| - ./ci/test_integrationtests.sh | ||
|
|
||
| after_script: | ||
| # Copy all cache files into cache-artifact so that they get uploaded. We only do this for develop so that artifacts | ||
| # stay minimal for PRs and branches (we never need them) | ||
| - mkdir $CI_PROJECT_DIR/cache-artifact | ||
| - mkdir -p $CI_PROJECT_DIR/testlogs | ||
| - | | ||
| if [ "$CI_COMMIT_REF_SLUG" = "develop" ]; then | ||
| cp -ra $CACHE_DIR/* $CI_PROJECT_DIR/cache-artifact/ | ||
| fi | ||
|
|
||
| # We're actually only interested in the develop branch creating the cache artifact, but there is no way to control this | ||
| # until https://gitlab.com/gitlab-org/gitlab-foss/issues/25478 gets implemented. Until then, we use an expiration time of | ||
| # 3 days and rely on daily builds to refresh the cache artifacts. We also keep non-develop artifacts at minimum size | ||
| artifacts: | ||
| name: cache-artifact | ||
| when: always | ||
| paths: | ||
| - $CI_PROJECT_DIR/cache-artifact | ||
| - $CI_PROJECT_DIR/testlogs | ||
| expire_in: 3 days | ||
|
|
||
| arm-linux: | ||
| <<: *build_template | ||
|
|
||
| win32: | ||
| <<: *build_template | ||
|
|
||
| win64: | ||
| <<: *build_template | ||
|
|
||
| linux32: | ||
| <<: *build_template | ||
|
|
||
| linux64: | ||
| <<: *build_template | ||
|
|
||
| linux64_nowallet: | ||
| <<: *build_template | ||
|
|
||
| linux64_release: | ||
| <<: *build_template | ||
|
|
||
| mac: | ||
| <<: *build_template | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.