Skip to content
Open
Show file tree
Hide file tree
Changes from all 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 @@ -32,12 +32,15 @@ jobs:
uses: actions/checkout@v4
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
11 changes: 7 additions & 4 deletions .github/workflows/build-depends.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,19 @@ jobs:
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
persist-credentials: false

- name: Initial setup
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}"
DEP_HASH="$(echo -n "${BUILD_TARGET}" "${DEP_OPTS}" "${HOST}" | sha256sum | head -c 64)"
echo "\"${BUILD_TARGET}\" has HOST=\"${HOST}\" and DEP_OPTS=\"${DEP_OPTS}\" with hash \"${DEP_HASH}\""
echo "DEP_HASH=${DEP_HASH}" >> "${GITHUB_OUTPUT}"

shell: bash

- name: Cache depends sources
Expand Down Expand Up @@ -76,12 +77,14 @@ jobs:
depends-${{ hashFiles('contrib/containers/ci/ci.Dockerfile') }}-${{ inputs.build-target }}-

- name: Build depends
env:
HOST: ${{ steps.setup.outputs.HOST }}
DEP_OPTS: ${{ steps.setup.outputs.DEP_OPTS }}
run: |
export HOST="${{ steps.setup.outputs.HOST }}"
if [ "${HOST}" = "x86_64-apple-darwin" ]; then
./contrib/containers/guix/scripts/setup-sdk
fi
env ${{ steps.setup.outputs.DEP_OPTS }} make -j$(nproc) -C depends
env ${DEP_OPTS} make -j$(nproc) -C depends

- name: Save depends cache
uses: actions/cache/save@v4
Expand Down
19 changes: 13 additions & 6 deletions .github/workflows/build-src.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,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 @@ -75,12 +78,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="400M"
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 All @@ -89,24 +93,27 @@ jobs:

- name: Run linters
if: inputs.build-target == 'linux64_multiprocess'
env:
BUILD_TARGET: ${{ inputs.build-target }}
run: |
export BUILD_TARGET="${{ inputs.build-target }}"
source ./ci/dash/matrix.sh
./ci/dash/lint-tidy.sh
shell: bash

- name: Run unit tests
env:
BUILD_TARGET: ${{ inputs.build-target }}
run: |
BASE_OUTDIR="/output"
BUILD_TARGET="${{ inputs.build-target }}"
source ./ci/dash/matrix.sh
./ci/dash/test_unittests.sh
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)"
./ci/dash/bundle-artifacts.sh create
echo "key=${BUNDLE_KEY}" >> "${GITHUB_OUTPUT}"
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,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,12 +4,18 @@ on:
pull_request:
branches:
- develop

permissions:
contents: read

jobs:
ClangFormat:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
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,19 +1,20 @@
name: Guix Build

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

on:
pull_request_target:
pull_request:
types: [labeled]
push:

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 @@ -27,18 +28,21 @@ jobs:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
path: dash
fetch-depth: 0
persist-credentials: false

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

- 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 @@ -70,6 +74,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, arm-linux-gnueabihf, aarch64-linux-gnu, riscv64-linux-gnu, powerpc64-linux-gnu, x86_64-w64-mingw32, x86_64-apple-darwin, arm64-apple-darwin]
Expand All @@ -86,6 +94,7 @@ jobs:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
path: dash
fetch-depth: 0
persist-credentials: false

- name: Cache depends sources
uses: actions/cache@v4
Expand Down Expand Up @@ -115,14 +124,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 @@ -133,8 +147,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@v4
Expand Down
12 changes: 8 additions & 4 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ jobs:
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 50
persist-credentials: false

- name: Initial setup
run: |
Expand All @@ -29,15 +30,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 @@ -47,8 +51,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@v3
with:
fetch-depth: 0
persist-credentials: false

- name: Set up Git
run: |
git config user.name "GitHub Action"
git config user.email "[email protected]"

- 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@v4
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