-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
ci: merge bitcoin#27314, #28954, introduce dependency options in GitHub Actions builds, fix multiprocess builds, bump to Clang 18 #6400
base: develop
Are you sure you want to change the base?
Changes from all commits
5319ee0
3fe6d24
5c36005
51762af
881a21c
4ff23e5
cb0ac94
239b7c0
8641287
732322b
ca2e95a
77795a5
3cc8c70
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,8 @@ 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 | ||
|
@@ -32,6 +34,8 @@ 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 | ||
|
@@ -56,18 +60,12 @@ jobs: | |
cache-to: type=inline | ||
|
||
build-depends: | ||
name: Build Dependencies | ||
name: ${{ matrix.depends_name }} | ||
needs: build-image | ||
runs-on: ubuntu-22.04 | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- build_target: arm-linux | ||
host: arm-linux-gnueabihf | ||
- build_target: linux64 | ||
host: x86_64-pc-linux-gnu | ||
|
||
matrix: ${{ fromJson(needs.build-image.outputs.dep-matrix) }} | ||
container: | ||
image: ghcr.io/${{ needs.build-image.outputs.repo-name }}/dashcore-ci-runner:${{ needs.build-image.outputs.image-tag }} | ||
options: --user root | ||
|
@@ -86,52 +84,36 @@ jobs: | |
restore-keys: | | ||
depends-sources- | ||
|
||
- 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}\"" | ||
echo "dep_hash=${dep_hash}" >> $GITHUB_OUTPUT | ||
|
||
- name: Cache depends | ||
uses: actions/cache@v4 | ||
with: | ||
path: | | ||
depends/built | ||
depends/${{ matrix.host }} | ||
key: ${{ runner.os }}-depends-${{ matrix.build_target }}-${{ hashFiles('depends/packages/*') }} | ||
key: ${{ runner.os }}-depends-${{ matrix.depends_name }}-${{ hashFiles('depends/packages/*') }}-${{ steps.det-params.outputs.dep_hash }} | ||
restore-keys: | | ||
${{ runner.os }}-depends-${{ matrix.build_target }}-${{ hashFiles('depends/packages/*') }} | ||
${{ runner.os }}-depends-${{ matrix.build_target }} | ||
${{ runner.os }}-depends-${{ matrix.depends_name }}-${{ hashFiles('depends/packages/*') }}- | ||
${{ runner.os }}-depends-${{ matrix.depends_name }}- | ||
|
||
- name: Build depends | ||
run: make -j$(nproc) -C depends HOST=${{ matrix.host }} | ||
run: env HOST=${{ matrix.host }} ${{ matrix.dep_opts }} make -j$(nproc) -C depends | ||
|
||
build: | ||
name: Build | ||
name: ${{ matrix.build_target }} | ||
needs: [build-image, build-depends] | ||
runs-on: ubuntu-22.04 | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- build_target: arm-linux | ||
host: arm-linux-gnueabihf | ||
depends_on: arm-linux | ||
- build_target: linux64 | ||
host: x86_64-pc-linux-gnu | ||
depends_on: linux64 | ||
- build_target: linux64_tsan | ||
host: x86_64-pc-linux-gnu | ||
depends_on: linux64 | ||
- build_target: linux64_ubsan | ||
host: x86_64-pc-linux-gnu | ||
depends_on: linux64 | ||
- build_target: linux64_fuzz | ||
host: x86_64-pc-linux-gnu | ||
depends_on: linux64 | ||
- build_target: linux64_cxx20 | ||
host: x86_64-pc-linux-gnu | ||
depends_on: linux64 | ||
- build_target: linux64_sqlite | ||
host: x86_64-pc-linux-gnu | ||
depends_on: linux64 | ||
- build_target: linux64_nowallet | ||
host: x86_64-pc-linux-gnu | ||
depends_on: linux64 | ||
matrix: ${{ fromJson(needs.build-image.outputs.src-matrix) }} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I fear this overcomplicates build.yml and will make it harder to improve / debug / logic on There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Outputs have to be generated in the previous job in order to be used in the current job and creating a new job just to read the matrix seems a bit wasteful, so the build image step is being used to also read, generate and export as output, the matrices needed for the next two jobs. We can probably try reusable workflows (source) in the future, it'll be more GitLab-like but would invite duplication and a different kind of convoluted syntax. Depends on how reliable this setup proves to be. |
||
container: | ||
image: ghcr.io/${{ needs.build-image.outputs.repo-name }}/dashcore-ci-runner:${{ needs.build-image.outputs.image-tag }} | ||
options: --user root | ||
|
@@ -141,13 +123,28 @@ jobs: | |
with: | ||
ref: ${{ github.event.pull_request.head.sha }} | ||
|
||
- 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)" | ||
kwvg marked this conversation as resolved.
Show resolved
Hide resolved
|
||
echo "\"${dep_name}\" 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 | ||
|
||
- name: Restore depends cache | ||
uses: actions/cache/restore@v4 | ||
with: | ||
path: | | ||
depends/built | ||
depends/${{ matrix.host }} | ||
key: ${{ runner.os }}-depends-${{ matrix.depends_on }}-${{ hashFiles('depends/packages/*') }} | ||
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: Determine PR Base SHA | ||
id: vars | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
{ | ||
"dep": { | ||
"include": [ | ||
{ | ||
"depends_name": "arm-linux-gnueabihf", | ||
"host": "arm-linux-gnueabihf", | ||
"dep_opts": "" | ||
}, | ||
{ | ||
"depends_name": "x86_64-pc-linux-gnu_debug", | ||
"host": "x86_64-pc-linux-gnu", | ||
"dep_opts": "DEBUG=1" | ||
}, | ||
{ | ||
"depends_name": "x86_64-pc-linux-gnu_multiprocess", | ||
"host": "x86_64-pc-linux-gnu", | ||
"dep_opts": "DEBUG=1 MULTIPROCESS=1 CC=clang-18 CXX=clang++-18" | ||
}, | ||
{ | ||
"depends_name": "x86_64-pc-linux-gnu_nowallet", | ||
"host": "x86_64-pc-linux-gnu", | ||
"dep_opts": "NO_WALLET=1" | ||
} | ||
] | ||
}, | ||
"src": { | ||
"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_multiprocess" | ||
}, | ||
{ | ||
"build_target": "linux64_ubsan", | ||
"depends_name": "x86_64-pc-linux-gnu_debug" | ||
} | ||
] | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -189,27 +189,27 @@ x86_64-w64-mingw32: | |
variables: | ||
HOST: x86_64-w64-mingw32 | ||
|
||
x86_64-pc-linux-gnu-debug: | ||
x86_64-pc-linux-gnu_debug: | ||
extends: .build-depends-template | ||
variables: | ||
HOST: x86_64-pc-linux-gnu | ||
DEP_OPTS: "DEBUG=1" | ||
|
||
x86_64-pc-linux-gnu-nowallet: | ||
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" | ||
|
||
x86_64-pc-linux-gnu-multiprocess: | ||
x86_64-pc-linux-gnu_multiprocess: | ||
extends: | ||
- .build-depends-template | ||
- .skip-in-fast-mode-template | ||
variables: | ||
HOST: x86_64-pc-linux-gnu | ||
DEP_OPTS: "MULTIPROCESS=1" | ||
DEP_OPTS: "DEBUG=1 MULTIPROCESS=1 CC=clang-18 CXX=clang++-18" | ||
|
||
x86_64-apple-darwin: | ||
extends: | ||
|
@@ -239,7 +239,7 @@ win64-build: | |
linux64-build: | ||
extends: .build-template | ||
needs: | ||
- x86_64-pc-linux-gnu-debug | ||
- x86_64-pc-linux-gnu_debug | ||
variables: | ||
BUILD_TARGET: linux64 | ||
|
||
|
@@ -248,7 +248,7 @@ linux64_cxx20-build: | |
- .build-template | ||
- .skip-in-fast-mode-template | ||
needs: | ||
- x86_64-pc-linux-gnu-debug | ||
- x86_64-pc-linux-gnu_debug | ||
variables: | ||
BUILD_TARGET: linux64_cxx20 | ||
|
||
|
@@ -257,7 +257,7 @@ linux64_sqlite-build: | |
- .build-template | ||
- .skip-in-fast-mode-template | ||
needs: | ||
- x86_64-pc-linux-gnu-debug | ||
- x86_64-pc-linux-gnu_debug | ||
variables: | ||
BUILD_TARGET: linux64_sqlite | ||
|
||
|
@@ -266,7 +266,7 @@ linux64_fuzz-build: | |
- .build-template | ||
- .skip-in-fast-mode-template | ||
needs: | ||
- x86_64-pc-linux-gnu-debug | ||
- x86_64-pc-linux-gnu_debug | ||
variables: | ||
BUILD_TARGET: linux64_fuzz | ||
|
||
|
@@ -275,7 +275,7 @@ linux64_fuzz-build: | |
# - .build-template | ||
# - .skip-in-fast-mode-template | ||
# needs: | ||
# - x86_64-pc-linux-gnu-debug | ||
# - x86_64-pc-linux-gnu_debug | ||
# variables: | ||
# BUILD_TARGET: linux64_asan | ||
|
||
|
@@ -284,7 +284,7 @@ linux64_tsan-build: | |
- .build-template | ||
- .skip-in-fast-mode-template | ||
needs: | ||
- x86_64-pc-linux-gnu-debug | ||
- x86_64-pc-linux-gnu_multiprocess | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In trying to strike a balance between testing different compilers and limiting the number of builds (both depends and source) to save resources, having multiprocess build with Clang 18 and then using it to also build TSan so we have access to a more recent thread sanitizer is the goal. Upstream eventually wants to enable multiprocess in its depends anyways and their primary obstacle is multiprocess not playing nice with fuzz (as expressed in PR description). |
||
variables: | ||
BUILD_TARGET: linux64_tsan | ||
|
||
|
@@ -293,7 +293,7 @@ linux64_ubsan-build: | |
- .build-template | ||
- .skip-in-fast-mode-template | ||
needs: | ||
- x86_64-pc-linux-gnu-debug | ||
- x86_64-pc-linux-gnu_debug | ||
variables: | ||
BUILD_TARGET: linux64_ubsan | ||
|
||
|
@@ -302,7 +302,7 @@ linux64_nowallet-build: | |
- .build-template | ||
- .skip-in-fast-mode-template | ||
needs: | ||
- x86_64-pc-linux-gnu-nowallet | ||
- x86_64-pc-linux-gnu_nowallet | ||
variables: | ||
BUILD_TARGET: linux64_nowallet | ||
|
||
|
@@ -311,7 +311,7 @@ linux64_multiprocess-build: | |
- .build-template | ||
- .skip-in-fast-mode-template | ||
needs: | ||
- x86_64-pc-linux-gnu-multiprocess | ||
- x86_64-pc-linux-gnu_multiprocess | ||
variables: | ||
BUILD_TARGET: linux64_multiprocess | ||
|
||
|
@@ -320,7 +320,7 @@ linux64_multiprocess-build: | |
# - .build-template | ||
# - .skip-in-fast-mode-template | ||
# needs: | ||
# - x86_64-pc-linux-gnu-debug | ||
# - x86_64-pc-linux-gnu_debug | ||
# variables: | ||
# BUILD_TARGET: linux64_valgrind | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I kinda hate using jq in the build.yml like this; but I guess it's ok
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The alternative would be having to maintain two JSON files (they would have to be JSON if we want to share params between them without resorting to duplication), which wouldn't be the worst thing in the world but imo since
src
will be reading fromdep
for values and they are configuring the same actions run, just different jobs, consolidation would be better.Plus we'd be using
jq
later on regardless to read through the matrix definition later on to finddep_opts
andhost
fromdepends_name
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these 2 JSON seems doens't have any dependency on each other, maybe better to have 2 files?
Is there any case, when you need both of them at once?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because they the second section (
src
) refers to the first section (dep
) later on and they ultimately represent two halves of one workflow.dash/.github/workflows/build.yml
Lines 126 to 136 in 3cc8c70
Examples of these are explained in the PR description.