From 31c03d4e8fc6ee02566c12f4687464c4640f45a1 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 19 Aug 2025 22:48:21 +0000 Subject: [PATCH 1/2] Initial plan From 85b05c30726cf49e24919dc188bec3374fd87eeb Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 19 Aug 2025 22:52:41 +0000 Subject: [PATCH 2/2] Add GitHub Copilot setup steps workflow Co-authored-by: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com> --- .github/workflows/copilot-setup-steps.yml | 241 ++++++++++++++++++++++ 1 file changed, 241 insertions(+) create mode 100644 .github/workflows/copilot-setup-steps.yml diff --git a/.github/workflows/copilot-setup-steps.yml b/.github/workflows/copilot-setup-steps.yml new file mode 100644 index 0000000000000..3f5ac54cf9579 --- /dev/null +++ b/.github/workflows/copilot-setup-steps.yml @@ -0,0 +1,241 @@ +name: "Copilot Setup Steps" + +# Automatically run the setup steps when they are changed to allow for easy validation, and +# allow manual testing through the repository's "Actions" tab +on: + workflow_dispatch: + push: + paths: + - .github/workflows/copilot-setup-steps.yml + pull_request: + paths: + - .github/workflows/copilot-setup-steps.yml + +jobs: + # The job MUST be called `copilot-setup-steps` or it will not be picked up by Copilot. + copilot-setup-steps: + runs-on: ubuntu-latest + timeout-minutes: 59 + + # Set the permissions to the lowest permissions possible needed for your steps. + # Copilot will be given its own token for its operations. + permissions: + # If you want to clone the repository as part of your setup steps, for example to install dependencies, you'll need the `contents: read` permission. If you don't clone the repository in your setup steps, Copilot will do this for you automatically after the steps complete. + contents: read + + # You can define any steps you want, and they will run before the agent starts. + # If you do not check out your code, Copilot will do this for you. + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Cache system packages + uses: actions/cache@v4 + with: + path: /var/cache/apt + key: apt-cache-${{ runner.os }}-${{ hashFiles('.github/workflows/copilot-setup-steps.yml') }} + restore-keys: | + apt-cache-${{ runner.os }}- + + - name: Install system dependencies + run: | + # Update package list + sudo apt-get update + + # Install core build dependencies matching CI environment + sudo apt-get install -y --no-install-recommends \ + build-essential \ + autoconf \ + automake \ + autotools-dev \ + libtool \ + pkg-config \ + bsdmainutils \ + curl \ + ca-certificates \ + git \ + ccache \ + cmake \ + make \ + xz-utils \ + zip \ + python3-dev \ + python3-pip \ + python3-setuptools \ + python3-wheel \ + parallel \ + bc \ + bison \ + gawk \ + gettext \ + m4 \ + zstd \ + rsync \ + procps + + - name: Install LLVM/Clang 18 + run: | + # Add LLVM repository + curl -fsSL https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc > /dev/null + echo "deb [signed-by=/etc/apt/trusted.gpg.d/apt.llvm.org.asc] http://apt.llvm.org/jammy/ llvm-toolchain-jammy-18 main" | sudo tee /etc/apt/sources.list.d/llvm.list + + sudo apt-get update + sudo apt-get install -y --no-install-recommends \ + clang-18 \ + clangd-18 \ + clang-format-18 \ + clang-tidy-18 \ + libc++-18-dev \ + libc++abi-18-dev \ + libclang-18-dev \ + libclang-rt-18-dev \ + lld-18 \ + lldb-18 \ + llvm-18-dev + + # Set clang-18 as default + sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-18 100 + sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-18 100 + sudo update-alternatives --install /usr/bin/clang-format clang-format /usr/bin/clang-format-18 100 + sudo update-alternatives --install /usr/bin/clang-tidy clang-tidy /usr/bin/clang-tidy-18 100 + + - name: Set up Python 3.9.18 + uses: actions/setup-python@v4 + with: + python-version: '3.9.18' + cache: 'pip' + + - name: Install Python dependencies + run: | + python3 -m pip install --upgrade pip + python3 -m pip install \ + codespell==1.17.1 \ + flake8==3.8.3 \ + jinja2 \ + lief==0.13.2 \ + multiprocess \ + mypy==0.910 \ + pyzmq==22.3.0 \ + vulture==2.3 + + - name: Install dash_hash + run: | + # Install dash_hash Python package needed for tests + git clone --depth 1 --no-tags --branch=1.4.0 https://github.com/dashpay/dash_hash /tmp/dash_hash + cd /tmp/dash_hash + python3 -m pip install -r requirements.txt . + cd / + rm -rf /tmp/dash_hash + + - name: Install additional tools + run: | + # Install shellcheck + curl -fL "https://github.com/koalaman/shellcheck/releases/download/v0.7.1/shellcheck-v0.7.1.linux.x86_64.tar.xz" -o /tmp/shellcheck.tar.xz + sudo mkdir -p /opt/shellcheck + sudo tar -xf /tmp/shellcheck.tar.xz -C /opt/shellcheck --strip-components=1 + sudo ln -sf /opt/shellcheck/shellcheck /usr/local/bin/shellcheck + rm /tmp/shellcheck.tar.xz + + # Install cppcheck + CPPCHECK_VERSION=2.13.0 + curl -fL "https://github.com/danmar/cppcheck/archive/${CPPCHECK_VERSION}.tar.gz" -o /tmp/cppcheck.tar.gz + mkdir -p /tmp/cppcheck-src + tar -xzf /tmp/cppcheck.tar.gz -C /tmp/cppcheck-src --strip-components=1 + cd /tmp/cppcheck-src + mkdir build && cd build + cmake .. && cmake --build . -j"$(nproc)" + sudo cp bin/cppcheck /usr/local/bin/ + sudo mkdir -p /usr/local/share/Cppcheck + sudo cp -r ../cfg /usr/local/share/Cppcheck/ + cd / + rm -rf /tmp/cppcheck.tar.gz /tmp/cppcheck-src + + - 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 build + uses: actions/cache@v4 + with: + path: | + depends/built + depends/x86_64-pc-linux-gnu + key: depends-linux64-${{ hashFiles('depends/packages/*', '.github/workflows/copilot-setup-steps.yml') }} + restore-keys: | + depends-linux64- + + - name: Set up ccache + uses: actions/cache@v4 + with: + path: ~/.ccache + key: ccache-${{ runner.os }}-${{ github.sha }} + restore-keys: | + ccache-${{ runner.os }}- + + - name: Configure ccache + run: | + ccache --set-config=max_size=400M + ccache --set-config=compression=true + ccache --set-config=compression_level=6 + ccache --zero-stats + + - name: Generate build system + run: | + ./autogen.sh + + - name: Build dependencies + run: | + # Build for native linux platform + export HOST=x86_64-pc-linux-gnu + make -j"$(nproc)" -C depends + + - name: Configure Dash Core + run: | + # Configure with depends and development flags + ./configure \ + --prefix="$(pwd)/depends/x86_64-pc-linux-gnu" \ + --disable-hardening \ + --enable-crash-hooks \ + --enable-debug \ + --enable-reduce-exports \ + --enable-stacktraces \ + --enable-suppress-external-warnings \ + --enable-werror \ + CC=clang \ + CXX=clang++ + + - name: Build Dash Core + run: | + make -j"$(nproc)" + + - name: Display ccache stats + run: | + ccache --show-stats + + - name: Run basic tests + run: | + # Run a quick smoke test to verify the build works + ./src/test/test_dash --run_test=getarg_tests + + # Test that dashd can start and stop + timeout 30s ./src/dashd -regtest -daemon -datadir=/tmp/dash_test || true + sleep 5 + ./src/dash-cli -regtest -datadir=/tmp/dash_test stop || true + sleep 5 + + - name: Verify linting tools + run: | + # Verify all linting tools are available and working + python3 --version + clang-format --version + clang-tidy --version + shellcheck --version + cppcheck --version + python3 -c "import codespell; print('codespell available')" + python3 -c "import flake8; print('flake8 available')" + python3 -c "import mypy; print('mypy available')" \ No newline at end of file