2024-08-04 09:32:54 +02:00
|
|
|
name: CI
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
pull_request_target:
|
|
|
|
|
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
packages: write
|
|
|
|
|
|
|
|
env:
|
|
|
|
DOCKER_DRIVER: overlay2
|
|
|
|
FAST_MODE: false
|
|
|
|
|
|
|
|
jobs:
|
2024-08-04 10:10:22 +02:00
|
|
|
build-image:
|
|
|
|
name: Build Image
|
2024-11-02 20:32:27 +01:00
|
|
|
runs-on: ubuntu-22.04
|
2024-08-04 09:32:54 +02:00
|
|
|
outputs:
|
|
|
|
image-tag: ${{ steps.prepare.outputs.image-tag }}
|
|
|
|
repo-name: ${{ steps.prepare.outputs.repo-name }}
|
|
|
|
steps:
|
|
|
|
- name: Checkout code
|
|
|
|
uses: actions/checkout@v4
|
2024-09-06 05:37:06 +02:00
|
|
|
with:
|
|
|
|
ref: ${{ github.event.pull_request.head.sha }}
|
|
|
|
|
2024-08-04 09:32:54 +02:00
|
|
|
- name: Prepare
|
|
|
|
id: prepare
|
|
|
|
run: |
|
|
|
|
BRANCH_NAME=$(echo "${GITHUB_REF##*/}" | tr '[:upper:]' '[:lower:]')
|
|
|
|
REPO_NAME=$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]')
|
2024-08-24 00:15:31 +02:00
|
|
|
echo "image-tag=${BRANCH_NAME}" >> $GITHUB_OUTPUT
|
|
|
|
echo "repo-name=${REPO_NAME}" >> $GITHUB_OUTPUT
|
2024-08-04 09:32:54 +02:00
|
|
|
|
|
|
|
- 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: |
|
2024-08-04 10:10:22 +02:00
|
|
|
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
|
2024-08-04 09:32:54 +02:00
|
|
|
cache-to: type=inline
|
|
|
|
|
|
|
|
build-depends:
|
|
|
|
name: Build Dependencies
|
2024-08-04 10:10:22 +02:00
|
|
|
needs: build-image
|
2024-11-02 20:32:27 +01:00
|
|
|
runs-on: ubuntu-22.04
|
2024-08-04 09:32:54 +02:00
|
|
|
strategy:
|
2024-08-06 12:51:04 +02:00
|
|
|
fail-fast: false
|
2024-08-04 09:32:54 +02:00
|
|
|
matrix:
|
|
|
|
include:
|
|
|
|
- build_target: arm-linux
|
|
|
|
host: arm-linux-gnueabihf
|
2024-08-06 12:51:04 +02:00
|
|
|
- build_target: linux64
|
|
|
|
host: x86_64-pc-linux-gnu
|
|
|
|
|
2024-08-04 09:32:54 +02:00
|
|
|
container:
|
2024-08-04 10:10:22 +02:00
|
|
|
image: ghcr.io/${{ needs.build-image.outputs.repo-name }}/dashcore-ci-runner:${{ needs.build-image.outputs.image-tag }}
|
2024-08-04 09:32:54 +02:00
|
|
|
options: --user root
|
|
|
|
steps:
|
|
|
|
- name: Checkout code
|
|
|
|
uses: actions/checkout@v4
|
2024-09-06 05:37:06 +02:00
|
|
|
with:
|
|
|
|
ref: ${{ github.event.pull_request.head.sha }}
|
|
|
|
|
2024-10-25 01:54:41 +02:00
|
|
|
- name: Cache depends sources
|
|
|
|
uses: actions/cache@v4
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
depends/sources
|
|
|
|
key: depends-sources-${{ hashFiles('depends/packages/*') }}
|
|
|
|
restore-keys: |
|
|
|
|
depends-sources-
|
|
|
|
|
2024-11-19 22:08:46 +01:00
|
|
|
- name: Cache depends
|
2024-08-04 09:32:54 +02:00
|
|
|
uses: actions/cache@v4
|
|
|
|
with:
|
|
|
|
path: |
|
2024-11-18 20:16:37 +01:00
|
|
|
depends/built
|
2024-11-19 22:08:46 +01:00
|
|
|
depends/${{ matrix.host }}
|
2024-10-25 05:47:19 +02:00
|
|
|
key: ${{ runner.os }}-depends-${{ matrix.build_target }}-${{ hashFiles('depends/packages/*') }}
|
2024-08-04 09:32:54 +02:00
|
|
|
restore-keys: |
|
2024-10-25 05:47:19 +02:00
|
|
|
${{ runner.os }}-depends-${{ matrix.build_target }}-${{ hashFiles('depends/packages/*') }}
|
|
|
|
${{ runner.os }}-depends-${{ matrix.build_target }}
|
2024-08-04 09:32:54 +02:00
|
|
|
|
2024-11-19 22:08:46 +01:00
|
|
|
- name: Build depends
|
2024-08-04 09:32:54 +02:00
|
|
|
run: make -j$(nproc) -C depends HOST=${{ matrix.host }}
|
|
|
|
|
|
|
|
build:
|
|
|
|
name: Build
|
2024-08-04 10:10:22 +02:00
|
|
|
needs: [build-image, build-depends]
|
2024-11-02 20:32:27 +01:00
|
|
|
runs-on: ubuntu-22.04
|
2024-08-04 09:32:54 +02:00
|
|
|
strategy:
|
2024-08-06 12:51:04 +02:00
|
|
|
fail-fast: false
|
2024-08-04 09:32:54 +02:00
|
|
|
matrix:
|
|
|
|
include:
|
|
|
|
- build_target: arm-linux
|
|
|
|
host: arm-linux-gnueabihf
|
2024-11-18 20:18:03 +01:00
|
|
|
depends_on: arm-linux
|
2024-08-06 12:51:04 +02:00
|
|
|
- build_target: linux64
|
|
|
|
host: x86_64-pc-linux-gnu
|
2024-11-18 20:18:03 +01:00
|
|
|
depends_on: linux64
|
2024-08-06 12:51:04 +02:00
|
|
|
- build_target: linux64_tsan
|
|
|
|
host: x86_64-pc-linux-gnu
|
2024-11-18 20:18:03 +01:00
|
|
|
depends_on: linux64
|
2024-08-06 12:51:04 +02:00
|
|
|
- build_target: linux64_ubsan
|
|
|
|
host: x86_64-pc-linux-gnu
|
2024-11-18 20:18:03 +01:00
|
|
|
depends_on: linux64
|
2024-08-06 12:51:04 +02:00
|
|
|
- build_target: linux64_fuzz
|
|
|
|
host: x86_64-pc-linux-gnu
|
2024-11-18 20:18:03 +01:00
|
|
|
depends_on: linux64
|
2024-08-06 12:51:04 +02:00
|
|
|
- build_target: linux64_cxx20
|
|
|
|
host: x86_64-pc-linux-gnu
|
2024-11-18 20:18:03 +01:00
|
|
|
depends_on: linux64
|
2024-08-06 12:51:04 +02:00
|
|
|
- build_target: linux64_sqlite
|
|
|
|
host: x86_64-pc-linux-gnu
|
2024-11-18 20:18:03 +01:00
|
|
|
depends_on: linux64
|
2024-08-06 12:51:04 +02:00
|
|
|
- build_target: linux64_nowallet
|
|
|
|
host: x86_64-pc-linux-gnu
|
2024-11-18 20:18:03 +01:00
|
|
|
depends_on: linux64
|
2024-08-04 09:32:54 +02:00
|
|
|
container:
|
2024-08-04 10:10:22 +02:00
|
|
|
image: ghcr.io/${{ needs.build-image.outputs.repo-name }}/dashcore-ci-runner:${{ needs.build-image.outputs.image-tag }}
|
2024-08-04 09:32:54 +02:00
|
|
|
options: --user root
|
|
|
|
steps:
|
|
|
|
- name: Checkout code
|
|
|
|
uses: actions/checkout@v4
|
2024-09-06 05:37:06 +02:00
|
|
|
with:
|
|
|
|
ref: ${{ github.event.pull_request.head.sha }}
|
|
|
|
|
2024-11-19 22:08:46 +01:00
|
|
|
- name: Restore depends cache
|
|
|
|
uses: actions/cache/restore@v4
|
2024-08-04 09:32:54 +02:00
|
|
|
with:
|
2024-11-19 22:08:46 +01:00
|
|
|
path: |
|
|
|
|
depends/built
|
|
|
|
depends/${{ matrix.host }}
|
|
|
|
key: ${{ runner.os }}-depends-${{ matrix.depends_on }}-${{ hashFiles('depends/packages/*') }}
|
2024-10-25 05:05:01 +02:00
|
|
|
|
|
|
|
- name: Determine PR Base SHA
|
|
|
|
id: vars
|
|
|
|
run: |
|
|
|
|
echo "PR_BASE_SHA=${{ github.event.pull_request.base.sha || '' }}" >> $GITHUB_OUTPUT
|
2024-08-04 09:32:54 +02:00
|
|
|
|
|
|
|
- name: CCache
|
|
|
|
uses: actions/cache@v4
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
/cache
|
2024-10-25 05:47:19 +02:00
|
|
|
key: ${{ runner.os }}-${{ matrix.build_target }}-${{ github.sha }}
|
2024-08-04 09:32:54 +02:00
|
|
|
restore-keys: |
|
2024-10-25 05:47:19 +02:00
|
|
|
${{ runner.os }}-${{ matrix.build_target }}-${{ github.sha }}
|
|
|
|
${{ runner.os }}-${{ matrix.build_target }}-${{ steps.vars.outputs.PR_BASE_SHA }}
|
|
|
|
${{ runner.os }}-${{ matrix.build_target }}
|
2024-08-04 09:32:54 +02:00
|
|
|
|
|
|
|
- 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:
|
2024-08-06 12:51:04 +02:00
|
|
|
name: build-artifacts-${{ matrix.build_target }}
|
2024-08-04 09:32:54 +02:00
|
|
|
path: |
|
|
|
|
/output
|