Skip to content
Open
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/workflows/build-container.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,15 @@ jobs:
uses: actions/checkout@v6
with:
ref: ${{ github.event.pull_request.head.sha }}
persist-credentials: false

- name: Prepare variables
id: prepare
env:
GITHUB_REPOSITORY_LC: ${{ github.repository }}
run: |
BRANCH_NAME=$(echo "${GITHUB_REF##*/}" | tr '[:upper:]' '[:lower:]')
REPO_NAME=$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]')
REPO_NAME=$(echo "${GITHUB_REPOSITORY_LC}" | tr '[:upper:]' '[:lower:]')
echo "tag=${BRANCH_NAME}" >> "$GITHUB_OUTPUT"
echo "repo=${REPO_NAME}" >> "$GITHUB_OUTPUT"

Expand Down
13 changes: 10 additions & 3 deletions .github/workflows/build-depends.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ jobs:
uses: actions/checkout@v6
with:
ref: ${{ github.event.pull_request.head.sha }}
persist-credentials: false
sparse-checkout: |
ci/dash
ci/test
Expand All @@ -52,8 +53,9 @@ jobs:

- name: Compute cache key
id: setup
env:
BUILD_TARGET: ${{ inputs.build-target }}
run: |
BUILD_TARGET="${{ inputs.build-target }}"
source ./ci/dash/matrix.sh
echo "DEP_OPTS=${DEP_OPTS}" >> "${GITHUB_OUTPUT}"
echo "HOST=${HOST}" >> "${GITHUB_OUTPUT}"
Expand Down Expand Up @@ -127,9 +129,14 @@ jobs:
depends-${{ hashFiles('contrib/containers/ci/ci.Dockerfile', 'contrib/containers/ci/ci-slim.Dockerfile') }}-${{ inputs.build-target }}-

- name: Build depends
env:
HOST: ${{ steps.setup.outputs.HOST }}
DEP_OPTS: ${{ steps.setup.outputs.DEP_OPTS }}
run: |
export HOST="${{ needs.check-cache.outputs.host }}"
env ${{ needs.check-cache.outputs.dep-opts }} make -j$(nproc) -C depends
if [ "${HOST}" = "x86_64-apple-darwin" ]; then
./contrib/containers/guix/scripts/setup-sdk
fi
env ${DEP_OPTS} make -j$(nproc) -C depends
Comment thread
coderabbitai[bot] marked this conversation as resolved.

- name: Save depends cache
uses: actions/cache/save@v5
Expand Down
21 changes: 14 additions & 7 deletions .github/workflows/build-src.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,19 @@ jobs:
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 50
persist-credentials: false

- name: Initial setup
id: setup
env:
BUILD_TARGET: ${{ inputs.build-target }}
PR_BASE_SHA: ${{ github.event.pull_request.base.sha || '' }}
run: |
git config --global --add safe.directory "$PWD"
git fetch -fu origin develop:develop
BUILD_TARGET="${{ inputs.build-target }}"
source ./ci/dash/matrix.sh
echo "HOST=${HOST}" >> $GITHUB_OUTPUT
echo "PR_BASE_SHA=${{ github.event.pull_request.base.sha || '' }}" >> $GITHUB_OUTPUT
echo "PR_BASE_SHA=${PR_BASE_SHA}" >> $GITHUB_OUTPUT
shell: bash

- name: Restore SDKs cache
Expand Down Expand Up @@ -93,12 +96,13 @@ jobs:
ccache-${{ hashFiles('contrib/containers/ci/ci.Dockerfile', 'depends/packages/*') }}-${{ inputs.build-target }}-

- name: Build source
env:
BUILD_TARGET: ${{ inputs.build-target }}
run: |
CCACHE_MAXSIZE="600M"
CACHE_DIR="/cache"
mkdir /output
BASE_OUTDIR="/output"
BUILD_TARGET="${{ inputs.build-target }}"
source ./ci/dash/matrix.sh
./ci/dash/build_src.sh
ccache -X 9
Expand Down Expand Up @@ -129,9 +133,9 @@ jobs:

- name: Run linters
if: inputs.build-target == 'linux64_multiprocess'
env:
BUILD_TARGET: ${{ inputs.build-target }}
run: |
CACHE_DIR="/cache"
export BUILD_TARGET="${{ inputs.build-target }}"
source ./ci/dash/matrix.sh
./ci/dash/lint-tidy.sh
shell: bash
Expand All @@ -148,16 +152,19 @@ jobs:
key: ctcache-${{ hashFiles('contrib/containers/ci/ci.Dockerfile', 'depends/packages/*') }}-${{ inputs.build-target }}-${{ github.sha }}

- name: Run unit tests
env:
BUILD_TARGET: ${{ inputs.build-target }}
run: |
BUILD_TARGET="${{ inputs.build-target }}"
BASE_OUTDIR="/output"
source ./ci/dash/matrix.sh
./ci/dash/test_unittests.sh
Comment thread
coderabbitai[bot] marked this conversation as resolved.
shell: bash

- name: Bundle artifacts
id: bundle
env:
BUILD_TARGET: ${{ inputs.build-target }}
run: |
export BUILD_TARGET="${{ inputs.build-target }}"
export BUNDLE_KEY="build-${BUILD_TARGET}-$(git rev-parse --short=8 HEAD)"
find "build-ci/dashcore-${BUILD_TARGET}/src/" -name "*.a" -type f -delete
find "build-ci/dashcore-${BUILD_TARGET}/src/" -name "*.o" -type f -delete
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,15 @@ jobs:
steps:
- name: Check skip environment variables
id: skip-check
env:
EVENT_NAME: ${{ github.event_name }}
SKIP_ON_PUSH: ${{ vars.SKIP_ON_PUSH }}
SKIP_ON_PR: ${{ vars.SKIP_ON_PR }}
run: |
if [[ "${{ github.event_name }}" == "push" && "${{ vars.SKIP_ON_PUSH }}" != "" ]]; then
if [[ "${EVENT_NAME}" == "push" && "${SKIP_ON_PUSH}" != "" ]]; then
echo "Skipping build on push due to SKIP_ON_PUSH environment variable"
echo "skip=true" >> $GITHUB_OUTPUT
elif [[ "${{ github.event_name }}" == "pull_request_target" && "${{ vars.SKIP_ON_PR }}" != "" ]]; then
elif [[ "${EVENT_NAME}" == "pull_request_target" && "${SKIP_ON_PR}" != "" ]]; then
echo "Skipping build on pull request due to SKIP_ON_PR environment variable"
echo "skip=true" >> $GITHUB_OUTPUT
else
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/clang-diff-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ on:
pull_request:
branches:
- develop

permissions:
contents: read

jobs:
ClangFormat:
runs-on: ubuntu-latest
Expand All @@ -12,6 +16,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v6
with:
persist-credentials: false
- name: Fetch git
run: git fetch --no-tags -fu origin develop:develop
- name: Run Clang-Format-Diff.py
Expand Down
39 changes: 28 additions & 11 deletions .github/workflows/guix-build.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
name: Guix Build

permissions:
packages: write
id-token: write
attestations: write

on:
pull_request_target:
types: [labeled]
Expand All @@ -13,9 +8,15 @@ on:
# Run weekly at 3 AM UTC on Sunday on the default branch
- cron: '0 3 * * 0'

permissions:
contents: read

jobs:
build-image:
runs-on: ubuntu-24.04-arm
permissions:
contents: read
packages: write
if: |
(github.event_name == 'push' && (startsWith(github.ref, 'refs/tags/') || vars.RUN_GUIX_ON_ALL_PUSH == 'true')) ||
contains(github.event.pull_request.labels.*.name, 'guix-build') ||
Expand All @@ -30,18 +31,21 @@ jobs:
ref: ${{ github.event.pull_request.head.sha }}
path: dash
fetch-depth: 0
persist-credentials: false

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4

- name: Commit variables
id: prepare
env:
GITHUB_REPOSITORY_LC: ${{ github.repository }}
run: |
echo "hash=$(sha256sum ./dash/contrib/containers/guix/Dockerfile | cut -d ' ' -f1)" >> $GITHUB_OUTPUT
echo "host_user_id=$(id -u)" >> $GITHUB_OUTPUT
echo "host_group_id=$(id -g)" >> $GITHUB_OUTPUT
BRANCH_NAME=$(echo "${GITHUB_REF##*/}" | tr '[:upper:]' '[:lower:]')
REPO_NAME=$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]')
REPO_NAME=$(echo "${GITHUB_REPOSITORY_LC}" | tr '[:upper:]' '[:lower:]')
echo "image-tag=${BRANCH_NAME}" >> $GITHUB_OUTPUT
echo "repo-name=${REPO_NAME}" >> $GITHUB_OUTPUT

Expand Down Expand Up @@ -73,6 +77,10 @@ jobs:
needs: build-image
# runs-on: [ "self-hosted", "linux", "x64", "ubuntu-core" ]
runs-on: ubuntu-24.04-arm
permissions:
contents: read
id-token: write
attestations: write
strategy:
matrix:
build_target: [x86_64-linux-gnu, aarch64-linux-gnu, riscv64-linux-gnu, powerpc64-linux-gnu, x86_64-w64-mingw32, x86_64-apple-darwin, arm64-apple-darwin]
Expand All @@ -89,6 +97,7 @@ jobs:
ref: ${{ github.event.pull_request.head.sha }}
path: dash
fetch-depth: 0
persist-credentials: false

- name: Cache depends sources
uses: actions/cache@v5
Expand Down Expand Up @@ -118,14 +127,19 @@ jobs:

- name: Run Guix build
timeout-minutes: 480
env:
WORKSPACE: ${{ github.workspace }}
REPO_NAME: ${{ needs.build-image.outputs.repo-name }}
IMAGE_TAG: ${{ needs.build-image.outputs.image-tag }}
BUILD_TARGET: ${{ matrix.build_target }}
run: |
docker run --privileged -d --rm -t \
--name guix-daemon \
-v ${{ github.workspace }}/dash:/src/dash \
-v ${{ github.workspace }}/.cache:/home/ubuntu/.cache \
-v "${WORKSPACE}/dash:/src/dash" \
-v "${WORKSPACE}/.cache:/home/ubuntu/.cache" \
-w /src/dash \
ghcr.io/${{ needs.build-image.outputs.repo-name }}/dashcore-guix-builder:${{ needs.build-image.outputs.image-tag }} && \
docker exec guix-daemon bash -c 'HOSTS=${{ matrix.build_target }} /usr/local/bin/guix-start /src/dash'
"ghcr.io/${REPO_NAME}/dashcore-guix-builder:${IMAGE_TAG}" && \
docker exec guix-daemon bash -c "HOSTS=${BUILD_TARGET} /usr/local/bin/guix-start /src/dash"

- name: Ensure build passes
run: |
Expand All @@ -136,8 +150,11 @@ jobs:

- name: Compute SHA256 checksums
continue-on-error: true # It will complain on depending on only some hosts
env:
BUILD_TARGET: ${{ matrix.build_target }}
WORKSPACE: ${{ github.workspace }}
run: |
HOSTS=${{ matrix.build_target }} ./dash/contrib/containers/guix/scripts/guix-check ${{ github.workspace }}/dash
HOSTS="${BUILD_TARGET}" ./dash/contrib/containers/guix/scripts/guix-check "${WORKSPACE}/dash"

- name: Upload build artifacts
uses: actions/upload-artifact@v6
Expand Down
12 changes: 8 additions & 4 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ jobs:
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 50
persist-credentials: false

- name: Initial setup
run: |
Expand All @@ -33,15 +34,18 @@ jobs:
shell: bash

- name: Run linters
env:
EVENT_NAME: ${{ github.event_name }}
REF: ${{ github.ref }}
run: |
export BUILD_TARGET="linux64"
export CHECK_DOC=1

# Determine if this is a PR and set commit range accordingly
if [ "${{ github.event_name }}" = "pull_request_target" ]; then
if [ "${EVENT_NAME}" = "pull_request_target" ]; then
export COMMIT_RANGE="$(git merge-base origin/develop HEAD)..HEAD"
export PULL_REQUEST="true"
elif [ "${{ github.event_name }}" = "push" ] && [ "${{ github.ref }}" != "refs/heads/develop" ] && [ "${{ github.ref }}" != "refs/heads/master" ]; then
elif [ "${EVENT_NAME}" = "push" ] && [ "${REF}" != "refs/heads/develop" ] && [ "${REF}" != "refs/heads/master" ]; then
# For push events on feature branches, check against develop
export COMMIT_RANGE="$(git merge-base origin/develop HEAD)..HEAD"
export PULL_REQUEST="true"
Expand All @@ -51,8 +55,8 @@ jobs:
export PULL_REQUEST="false"
fi

echo "Event name: ${{ github.event_name }}"
echo "Ref: ${{ github.ref }}"
echo "Event name: ${EVENT_NAME}"
echo "Ref: ${REF}"
echo "COMMIT_RANGE=${COMMIT_RANGE}"
echo "PULL_REQUEST=${PULL_REQUEST}"
echo "Running git log for commit range:"
Expand Down
17 changes: 12 additions & 5 deletions .github/workflows/merge-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,34 @@ jobs:
uses: actions/checkout@v6
with:
fetch-depth: 0
persist-credentials: false

- name: Set up Git
run: |
git config user.name "GitHub Action"
git config user.email "noreply@example.com"

- name: Check merge --ff-only
env:
REF_NAME: ${{ github.ref_name }}
EVENT_NAME: ${{ github.event_name }}
PR_BASE_REF: ${{ github.event.pull_request.base.ref }}
PR_NUMBER: ${{ github.event.pull_request.number }}
COMMIT_SHA: ${{ github.sha }}
run: |
if [[ "${{ github.ref_name }}" == "master" ]]; then
if [[ "${REF_NAME}" == "master" ]]; then
echo "Already on master, no need to check --ff-only"
else
git fetch --no-tags origin master:master
if [[ "${{ github.event_name }}" == "pull_request"* ]]; then
git fetch --no-tags origin ${{ github.event.pull_request.base.ref }}:base_branch
if [[ "${EVENT_NAME}" == "pull_request"* ]]; then
git fetch --no-tags origin "${PR_BASE_REF}":base_branch
git checkout base_branch
git pull --rebase=false origin pull/${{ github.event.pull_request.number }}/head
git pull --rebase=false origin "pull/${PR_NUMBER}/head"
git checkout master
git merge --ff-only base_branch
else
git checkout master
git merge --ff-only ${{ github.sha }}
git merge --ff-only "${COMMIT_SHA}"
fi
fi

Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/predict-conflicts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ jobs:
ghToken: "${{ secrets.GITHUB_TOKEN }}"
- name: Checkout
uses: actions/checkout@v6
with:
persist-credentials: false
- name: validate potential conflicts
id: validate_conflicts
run: pip3 install hjson && .github/workflows/handle_potential_conflicts.py "$conflicts"
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/prevent-master-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ on:
branches:
- master

permissions: {}

jobs:
fail:
runs-on: ubuntu-latest
Expand Down
Loading
Loading