fixes? #584
This file contains 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
name: CI | ||
on: | ||
push: | ||
pull_request_target: | ||
permissions: | ||
contents: read | ||
packages: write | ||
env: | ||
DOCKER_DRIVER: overlay2 | ||
FAST_MODE: false | ||
TARGET_ARCH: amd64 # Change this to "amd64" if you want to run on x86 | ||
jobs: | ||
setup: | ||
name: Set Architecture | ||
runs-on: ubuntu-latest | ||
outputs: | ||
target_arch: ${{ steps.set-arch.outputs.target_arch }} | ||
runner_label: ${{ steps.set-arch.outputs.runner_label }} | ||
steps: | ||
- name: Determine Target Architecture | ||
id: set-arch | ||
run: | | ||
TARGET_ARCH="arm64" # Change to "amd64" if you want to run on x86 | ||
echo "target_arch=${TARGET_ARCH}" >> $GITHUB_ENV | ||
if [[ "$TARGET_ARCH" == "arm64" ]]; then | ||
echo "runner_label=ubuntu-22.04-arm" >> $GITHUB_ENV | ||
else | ||
echo "runner_label=ubuntu-22.04" >> $GITHUB_ENV | ||
fi | ||
echo "target_arch=${TARGET_ARCH}" >> $GITHUB_OUTPUT | ||
echo "runner_label=${runner_label}" >> $GITHUB_OUTPUT | ||
build-image: | ||
name: Build Image | ||
needs: setup | ||
runs-on: ${{ needs.setup.outputs.runner_label }} | ||
outputs: | ||
image-tag: ${{ steps.prepare.outputs.image-tag }} | ||
repo-name: ${{ steps.prepare.outputs.repo-name }} | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.event.pull_request.head.sha }} | ||
- name: Prepare | ||
id: prepare | ||
run: | | ||
BRANCH_NAME=$(echo "${GITHUB_REF##*/}" | tr '[:upper:]' '[:lower:]') | ||
REPO_NAME=$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]') | ||
echo "image-tag=${BRANCH_NAME}" >> $GITHUB_OUTPUT | ||
echo "repo-name=${REPO_NAME}" >> $GITHUB_OUTPUT | ||
- 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: ${{ env.TARGET_ARCH == 'arm64' && 'ubuntu-22.04-arm' || 'ubuntu-22.04' }} | ||
Check failure on line 83 in .github/workflows/build.yml
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- build_target: arm-linux | ||
host: arm-linux-gnueabihf | ||
- build_target: linux64 | ||
host: aarch64-linux-gnu | ||
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 | ||
with: | ||
ref: ${{ github.event.pull_request.head.sha }} | ||
- name: Cache depends sources | ||
uses: actions/cache@v4 | ||
with: | ||
path: | | ||
depends/sources | ||
key: depends-sources-${{ hashFiles('depends/packages/*') }} | ||
restore-keys: | | ||
depends-sources- | ||
- name: Cache depends | ||
uses: actions/cache@v4 | ||
with: | ||
path: | | ||
depends/built | ||
depends/${{ matrix.host }} | ||
key: ${{ runner.os }}-depends-${{ matrix.build_target }}-${{ hashFiles('depends/packages/*') }} | ||
restore-keys: | | ||
${{ runner.os }}-depends-${{ matrix.build_target }} | ||
- name: Build depends | ||
run: make -j$(nproc) -C depends HOST=${{ matrix.host }} | ||
build: | ||
name: Build | ||
needs: [build-image, build-depends] | ||
runs-on: ${{ env.TARGET_ARCH == 'arm64' && 'ubuntu-22.04-arm' || 'ubuntu-22.04' }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- build_target: arm-linux | ||
host: arm-linux-gnueabihf | ||
runner_label: ubuntu-22.04-arm # Always run on arm64 | ||
- build_target: linux64 | ||
host: ${{ needs.setup.outputs.target_arch == 'arm64' && 'aarch64-linux-gnu' || 'x86_64-linux-gnu' }} | ||
- build_target: linux64_cxx20 | ||
host: ${{ needs.setup.outputs.target_arch == 'arm64' && 'aarch64-linux-gnu' || 'x86_64-linux-gnu' }} | ||
- build_target: linux64_fuzz | ||
host: ${{ needs.setup.outputs.target_arch == 'arm64' && 'aarch64-linux-gnu' || 'x86_64-linux-gnu' }} | ||
- build_target: linux64_nowallet | ||
host: ${{ needs.setup.outputs.target_arch == 'arm64' && 'aarch64-linux-gnu' || 'x86_64-linux-gnu' }} | ||
- build_target: linux64_sqlite | ||
host: ${{ needs.setup.outputs.target_arch == 'arm64' && 'aarch64-linux-gnu' || 'x86_64-linux-gnu' }} | ||
- build_target: linux64_tsan | ||
host: ${{ needs.setup.outputs.target_arch == 'arm64' && 'aarch64-linux-gnu' || 'x86_64-linux-gnu' }} | ||
- build_target: linux64_ubsan | ||
host: ${{ needs.setup.outputs.target_arch == 'arm64' && 'aarch64-linux-gnu' || 'x86_64-linux-gnu' }} | ||
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 | ||
with: | ||
ref: ${{ github.event.pull_request.head.sha }} | ||
fetch-depth: 0 | ||
- 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/*') }} | ||
- name: Determine PR Base SHA | ||
id: vars | ||
run: | | ||
echo "PR_BASE_SHA=${{ github.event.pull_request.base.sha || '' }}" >> $GITHUB_OUTPUT | ||
- name: CCache | ||
uses: actions/cache@v4 | ||
with: | ||
path: | | ||
/cache | ||
key: ${{ runner.os }}-${{ matrix.build_target }}-${{ github.sha }} | ||
restore-keys: | | ||
${{ runner.os }}-${{ matrix.build_target }}-${{ github.sha }} | ||
${{ runner.os }}-${{ matrix.build_target }}-${{ steps.vars.outputs.PR_BASE_SHA }} | ||
${{ runner.os }}-${{ matrix.build_target }} | ||
- name: Build source and run tests | ||
run: | | ||
git config --global --add advice.detachedHead false | ||
git config --global --add safe.directory "$PWD" | ||
GIT_HEAD="$(git rev-parse HEAD)" | ||
git checkout develop | ||
git checkout ${GIT_HEAD} | ||
CCACHE_SIZE="400M" | ||
CACHE_DIR="/cache" | ||
mkdir /output | ||
BASE_OUTDIR="/output" | ||
BUILD_TARGET="${{ matrix.build_target }}" | ||
HOST="${{ matrix.host }}" | ||
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-${{ matrix.build_target }} | ||
path: | | ||
/output |