Skip to content

Commit

Permalink
ci: Drop matrix.json, align CI-s
Browse files Browse the repository at this point in the history
  • Loading branch information
UdjinM6 committed Nov 23, 2024
1 parent 458e3cf commit c40a595
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 95 deletions.
66 changes: 47 additions & 19 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ jobs:
outputs:
image-tag: ${{ steps.prepare.outputs.image-tag }}
repo-name: ${{ steps.prepare.outputs.repo-name }}
dep-matrix: ${{ steps.prepare.outputs.dep-matrix }}
src-matrix: ${{ steps.prepare.outputs.src-matrix }}
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand All @@ -34,8 +32,6 @@ jobs:
REPO_NAME=$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]')
echo "image-tag=${BRANCH_NAME}" >> $GITHUB_OUTPUT
echo "repo-name=${REPO_NAME}" >> $GITHUB_OUTPUT
echo "dep-matrix=$(jq -r '.dep' -c .github/workflows/matrix.json)" >> $GITHUB_OUTPUT
echo "src-matrix=$(jq -r '.src' -c .github/workflows/matrix.json)" >> $GITHUB_OUTPUT
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
Expand Down Expand Up @@ -65,7 +61,16 @@ jobs:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.build-image.outputs.dep-matrix) }}
matrix:
include:
- depends_name: arm-linux-gnueabihf
build_target: arm-linux
- depends_name: x86_64-pc-linux-gnu_debug
build_target: linux64
- depends_name: x86_64-pc-linux-gnu_multiprocess
build_target: linux64_multiprocess
- depends_name: x86_64-pc-linux-gnu_nowallet
build_target: linux64_nowallet
container:
image: ghcr.io/${{ needs.build-image.outputs.repo-name }}/dashcore-ci-runner:${{ needs.build-image.outputs.image-tag }}
options: --user root
Expand All @@ -87,33 +92,56 @@ jobs:
- name: Determine params
id: det-params
run: |
dep_name="${{ matrix.depends_name }}"
dep_opts="${{ matrix.dep_opts }}"
dep_hash="$(echo -n ${dep_opts} | sha256sum | head -c 64)"
echo "\"${dep_name}\" has DEP_OPTS \"${dep_opts}\" with hash \"${dep_hash}\""
BUILD_TARGET="${{ matrix.build_target }}"
source ./ci/dash/matrix.sh
echo "dep_opts=${DEP_OPTS}" >> $GITHUB_OUTPUT
dep_hash="$(echo -n ${DEP_OPTS} | sha256sum | head -c 64)"
echo "\"${{ matrix.depends_name }}\" has DEP_OPTS \"${DEP_OPTS}\" with hash \"${dep_hash}\""
echo "dep_hash=${dep_hash}" >> $GITHUB_OUTPUT
echo "\"${{ matrix.depends_name }}\" has HOST \"${HOST}\""
echo "dep_host=${HOST}" >> $GITHUB_OUTPUT
shell: bash

- name: Cache depends
uses: actions/cache@v4
with:
path: |
depends/built
depends/${{ matrix.host }}
depends/${{ steps.det-params.outputs.dep_host }}
key: ${{ runner.os }}-depends-${{ matrix.depends_name }}-${{ hashFiles('depends/packages/*') }}-${{ steps.det-params.outputs.dep_hash }}
restore-keys: |
${{ runner.os }}-depends-${{ matrix.depends_name }}-${{ hashFiles('depends/packages/*') }}-
${{ runner.os }}-depends-${{ matrix.depends_name }}-
- name: Build depends
run: env HOST=${{ matrix.host }} ${{ matrix.dep_opts }} make -j$(nproc) -C depends
run: env HOST=${{ steps.det-params.outputs.dep_host }} ${{ steps.det-params.outputs.dep_opts }} make -j$(nproc) -C depends

build:
name: ${{ matrix.build_target }}
needs: [build-image, build-depends]
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.build-image.outputs.src-matrix) }}
matrix:
include:
- build_target: arm-linux
depends_name: arm-linux-gnueabihf
- build_target: linux64
depends_name: x86_64-pc-linux-gnu_debug
- build_target: linux64_cxx20
depends_name: x86_64-pc-linux-gnu_debug
- build_target: linux64_fuzz
depends_name: x86_64-pc-linux-gnu_debug
- build_target: linux64_multiprocess
depends_name: x86_64-pc-linux-gnu_multiprocess
- build_target: linux64_nowallet
depends_name: x86_64-pc-linux-gnu_nowallet
- build_target: linux64_sqlite
depends_name: x86_64-pc-linux-gnu_debug
- build_target: linux64_tsan
depends_name: x86_64-pc-linux-gnu_debug
- build_target: linux64_ubsan
depends_name: x86_64-pc-linux-gnu_debug
container:
image: ghcr.io/${{ needs.build-image.outputs.repo-name }}/dashcore-ci-runner:${{ needs.build-image.outputs.image-tag }}
options: --user root
Expand All @@ -126,14 +154,14 @@ jobs:
- name: Determine params
id: det-params
run: |
dep_name="${{ matrix.depends_name }}"
dep_opts="$(jq -r ".dep.include[] | select(.depends_name == \"${{ matrix.depends_name }}\") | .dep_opts" -c .github/workflows/matrix.json)"
dep_hash="$(echo -n ${dep_opts} | sha256sum | head -c 64)"
echo "\"${dep_name}\" has DEP_OPTS \"${dep_opts}\" with hash \"${dep_hash}\""
BUILD_TARGET="${{ matrix.build_target }}"
source ./ci/dash/matrix.sh
dep_hash="$(echo -n ${DEP_OPTS} | sha256sum | head -c 64)"
echo "\"${{ matrix.build_target }}\" has DEP_OPTS \"${DEP_OPTS}\" with hash \"${dep_hash}\""
echo "dep_hash=${dep_hash}" >> $GITHUB_OUTPUT
dep_host="$(jq -r ".dep.include[] | select(.depends_name == \"${{ matrix.depends_name }}\") | .host" -c .github/workflows/matrix.json)"
echo "\"${dep_name}\" has HOST \"${dep_host}\""
echo "dep_host=${dep_host}" >> $GITHUB_OUTPUT
echo "\"${{ matrix.build_target }}\" has HOST \"${HOST}\""
echo "dep_host=${HOST}" >> $GITHUB_OUTPUT
shell: bash

- name: Restore depends cache
uses: actions/cache/restore@v4
Expand Down
66 changes: 0 additions & 66 deletions .github/workflows/matrix.json

This file was deleted.

20 changes: 11 additions & 9 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@ builder-image:
XCODE_VERSION: "15.0"
XCODE_BUILD_ID: 15A240d
before_script:
- echo BUILD_TARGET=$BUILD_TARGET
- source ./ci/dash/matrix.sh
- echo HOST=$HOST
- echo DEP_OPTS=$DEP_OPTS
- |
if [ "$HOST" = "x86_64-apple-darwin" ]; then
mkdir -p depends/SDKs
Expand Down Expand Up @@ -87,6 +90,8 @@ builder-image:
- export CACHE_DIR=$CI_PROJECT_DIR/cache
- echo BUILD_TARGET=$BUILD_TARGET
- source ./ci/dash/matrix.sh
- echo HOST=$HOST
- echo DEP_OPTS=$DEP_OPTS

# Setup some environment variables
- |
Expand Down Expand Up @@ -180,43 +185,40 @@ builder-image:
arm-linux-gnueabihf:
extends: .build-depends-template
variables:
HOST: arm-linux-gnueabihf
BUILD_TARGET: arm-linux

x86_64-w64-mingw32:
extends:
- .build-depends-template
- .skip-in-fast-mode-template
variables:
HOST: x86_64-w64-mingw32
BUILD_TARGET: win64

x86_64-pc-linux-gnu_debug:
extends: .build-depends-template
variables:
HOST: x86_64-pc-linux-gnu
DEP_OPTS: "DEBUG=1"
BUILD_TARGET: linux64

x86_64-pc-linux-gnu_nowallet:
extends:
- .build-depends-template
- .skip-in-fast-mode-template
variables:
HOST: x86_64-pc-linux-gnu
DEP_OPTS: "NO_WALLET=1"
BUILD_TARGET: linux64_nowallet

x86_64-pc-linux-gnu_multiprocess:
extends:
- .build-depends-template
- .skip-in-fast-mode-template
variables:
HOST: x86_64-pc-linux-gnu
DEP_OPTS: "DEBUG=1 MULTIPROCESS=1 CC=clang-18 CXX=clang++-18"
BUILD_TARGET: linux64_multiprocess

x86_64-apple-darwin:
extends:
- .build-depends-template
- .skip-in-fast-mode-template
variables:
HOST: x86_64-apple-darwin
BUILD_TARGET: mac

###

Expand Down
2 changes: 1 addition & 1 deletion ci/test/00_setup_env_native_multiprocess.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export LC_ALL=C.UTF-8

export CONTAINER_NAME=ci_native_multiprocess
export PACKAGES="cmake python3 llvm clang"
export DEP_OPTS="DEBUG=1 MULTIPROCESS=1"
export DEP_OPTS="DEBUG=1 MULTIPROCESS=1 CC=clang-18 CXX=clang++-18"
export GOAL="install"
export BITCOIN_CONFIG="--with-boost-process --enable-debug CC=clang-18 CXX=clang++-18" # Use clang to avoid OOM
export BITCOIND=dash-node # Used in functional tests

0 comments on commit c40a595

Please sign in to comment.