Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/dashpay/dash into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
PastaPastaPasta committed Aug 11, 2024
2 parents ac0e15c + de4e7e1 commit 19f227f
Show file tree
Hide file tree
Showing 6 changed files with 184 additions and 116 deletions.
176 changes: 176 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
name: CI

on:
push:
pull_request_target:

permissions:
contents: read
packages: write

env:
DOCKER_DRIVER: overlay2
FAST_MODE: false

jobs:
build-image:
name: Build Image
runs-on: ubuntu-20.04
outputs:
image-tag: ${{ steps.prepare.outputs.image-tag }}
repo-name: ${{ steps.prepare.outputs.repo-name }}
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Prepare
id: prepare
run: |
BRANCH_NAME=$(echo "${GITHUB_REF##*/}" | tr '[:upper:]' '[:lower:]')
REPO_NAME=$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]')
echo "::set-output name=image-tag::${BRANCH_NAME}"
echo "::set-output name=repo-name::${REPO_NAME}"
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: ./contrib/containers/ci
file: ./contrib/containers/ci/Dockerfile
push: true
tags: |
ghcr.io/${{ steps.prepare.outputs.repo-name }}/dashcore-ci-runner:${{ steps.prepare.outputs.image-tag }}
ghcr.io/${{ steps.prepare.outputs.repo-name }}/dashcore-ci-runner:latest
cache-from: type=registry,ref=ghcr.io/${{ steps.prepare.outputs.repo-name }}/dashcore-ci-runner:latest
cache-to: type=inline

build-depends:
name: Build Dependencies
needs: build-image
runs-on: ubuntu-20.04
strategy:
matrix:
include:
- build_target: arm-linux
host: arm-linux-gnueabihf
container:
image: ghcr.io/${{ needs.build-image.outputs.repo-name }}/dashcore-ci-runner:${{ needs.build-image.outputs.image-tag }}
options: --user root
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Cache dependencies
uses: actions/cache@v4
with:
path: |
depends/built
depends/${{ matrix.host }}
depends/sdk-sources
# We don't care about no specific key as depends system will handle that for us
key: ${{ runner.os }}-depends-${{ matrix.host }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-depends-${{ matrix.host }}-${{ github.sha }}
${{ runner.os }}-depends-${{ matrix.host }}
${{ runner.os }}-depends
- name: Build dependencies
run: make -j$(nproc) -C depends HOST=${{ matrix.host }}

build:
name: Build
needs: [build-image, build-depends]
runs-on: ubuntu-20.04
strategy:
matrix:
include:
- build_target: arm-linux
host: arm-linux-gnueabihf
dep_opts: DEBUG=1
container:
image: ghcr.io/${{ needs.build-image.outputs.repo-name }}/dashcore-ci-runner:${{ needs.build-image.outputs.image-tag }}
options: --user root
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Restore Cache dependencies
uses: actions/cache/restore@v4
with:
path: |
depends/built
depends/${{ matrix.host }}
depends/sdk-sources
# We don't care about no specific key as depends system will handle that for us
key: ${{ runner.os }}-depends-${{ matrix.host }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-depends-${{ matrix.host }}-${{ github.sha }}
${{ runner.os }}-depends-${{ matrix.host }}
${{ runner.os }}-depends
- name: CCache
uses: actions/cache@v4
with:
path: |
/cache
key: ${{ runner.os }}-${{ matrix.host }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-${{ matrix.host }}-${{ github.sha }}
${{ runner.os }}-${{ matrix.host }}
${{ runner.os }}
- name: Build source and run tests
run: |
git config --global --add safe.directory "$PWD"
CCACHE_SIZE="400M"
CACHE_DIR="/cache"
mkdir /output
BASE_OUTDIR="/output"
BUILD_TARGET="${{ matrix.build_target }}"
source ./ci/dash/matrix.sh
./ci/dash/build_src.sh
./ci/dash/test_unittests.sh
shell: bash

- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: build-artifacts
path: |
/output
# Come back to this later and implement tests :)
# test:
# name: Test
# needs: [build-image, build]
# runs-on: ubuntu-20.04
# container:
# image: ghcr.io/${{ needs.build-image.outputs.repo-name }}/dashcore-ci-runner:${{ needs.build-image.outputs.image-tag }}
# options: --user root
# steps:
# - name: Checkout code
# uses: actions/checkout@v4
#
# - name: Download build artifacts
# uses: actions/download-artifact@v4
# with:
# name: build-artifacts
# path: src/
#
## - name: Setup environment
## run: |
## echo "BUILD_TARGET=${{ needs.build.matrix.build_target }}"
## source ./ci/dash/matrix.sh
#
# - name: Run integration tests
# run: ./ci/dash/test_integrationtests.sh --extended --exclude feature_pruning,feature_dbcrash
1 change: 0 additions & 1 deletion ci/dash/build_src.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ if [ "$CHECK_DOC" = 1 ]; then
#test/lint/check-doc.py
# Run all linters
test/lint/lint-all.sh
test/lint/extended-lint-all.sh
fi

ccache --zero-stats --max-size=$CCACHE_SIZE
Expand Down
2 changes: 1 addition & 1 deletion depends/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ NO_ZMQ ?=
NO_UPNP ?=
NO_NATPMP ?=
MULTIPROCESS ?=
FALLBACK_DOWNLOAD_PATH ?= https://bitcoincore.org/depends-sources
FALLBACK_DOWNLOAD_PATH ?= http://dash-depends-sources.s3-website-us-west-2.amazonaws.com

BUILD = $(shell ./config.guess)
HOST ?= $(BUILD)
Expand Down
26 changes: 0 additions & 26 deletions test/lint/extended-lint-all.sh

This file was deleted.

86 changes: 0 additions & 86 deletions test/lint/extended-lint-cppcheck.sh

This file was deleted.

9 changes: 7 additions & 2 deletions test/lint/lint-cppcheck-dash.sh
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,15 @@ ENABLED_CHECKS_REGEXP=$(join_array "|" "${ENABLED_CHECKS[@]}")
IGNORED_WARNINGS_REGEXP=$(join_array "|" "${IGNORED_WARNINGS[@]}")
FILES_REGEXP=$(join_array "|" "${FILES[@]}")
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
CPPCHECK_DIR=$SCRIPT_DIR/.cppcheck/
# Check if CACHE_DIR is set and non-empty, otherwise use default .cppcheck/ directory
if [[ -n "$CACHE_DIR" ]]; then
CPPCHECK_DIR=$CACHE_DIR/cppcheck/
else
CPPCHECK_DIR=$SCRIPT_DIR/.cppcheck/
fi
if [ ! -d $CPPCHECK_DIR ]
then
mkdir $CPPCHECK_DIR
mkdir -p $CPPCHECK_DIR
fi
WARNINGS=$(echo "${FILES}" | \
xargs cppcheck --enable=all --inline-suppr --suppress=missingIncludeSystem --cppcheck-build-dir=$CPPCHECK_DIR -j "$(getconf _NPROCESSORS_ONLN)" --language=c++ --std=c++17 --template=gcc -D__cplusplus -DENABLE_WALLET -DCLIENT_VERSION_BUILD -DCLIENT_VERSION_IS_RELEASE -DCLIENT_VERSION_MAJOR -DCLIENT_VERSION_MINOR -DCOPYRIGHT_YEAR -DDEBUG -DUSE_EPOLL -DCHAR_BIT=8 -I src/ -q 2>&1 | sort -u | \
Expand Down

0 comments on commit 19f227f

Please sign in to comment.