Skip to content
Draft
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
3 changes: 3 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
use nix
watch_file flake.nix
watch_file flake.lock
60 changes: 60 additions & 0 deletions .githooks/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#!/usr/bin/env bash
#
# commit-msg hook: Validates that commit messages follow Conventional Commits
# format required by release-please.
#
# Format: <type>[(scope)][!]: <description>
#
# Valid types: feat, fix, perf, revert, docs, chore, style, refactor, test, build, ci
#
# Examples:
# feat: add new authentication flow
# fix(release): correct tag separator
# feat!: breaking change to API
# chore(deps): bump dependencies
#
# To skip this check (e.g. merge commits), use:
# git commit --no-verify

commit_msg_file="$1"
commit_msg=$(head -1 "$commit_msg_file")

# Allow merge commits
if echo "$commit_msg" | grep -qE '^Merge '; then
exit 0
fi

# Allow revert commits
if echo "$commit_msg" | grep -qE '^Revert "'; then
exit 0
fi

# Allow release-please commits
if echo "$commit_msg" | grep -qE '^chore\(release\):'; then
exit 0
fi

# Conventional Commits pattern:
# <type>[(scope)][!]: <description>
pattern='^(feat|fix|perf|revert|docs|chore|style|refactor|test|build|ci)(\([a-zA-Z0-9._-]+\))?(!)?: .+'

if ! echo "$commit_msg" | grep -qE "$pattern"; then
Comment on lines +23 to +41
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For better performance and readability, consider using Bash's built-in regex matching [[ ... =~ ... ]] instead of piping echo to grep. This avoids creating subshells for each check. This applies to all grep checks in this script (lines 23, 28, 33, 41).

echo ""
echo "ERROR: Commit message does not follow Conventional Commits format."
echo ""
echo " Your message: $commit_msg"
echo ""
echo " Expected format: <type>[(scope)]: <description>"
echo ""
echo " Valid types: feat, fix, perf, revert, docs, chore, style, refactor, test, build, ci"
echo ""
echo " Examples:"
echo " feat: add new authentication flow"
echo " fix(release): correct tag separator"
echo " feat!: breaking change to API"
echo ""
echo " This is required for release-please to generate changelogs correctly."
echo " To skip this check: git commit --no-verify"
echo ""
exit 1
fi
35 changes: 33 additions & 2 deletions .github/actions/ci-setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,39 @@ runs:
using: composite

steps:
- uses: cargo-bins/cargo-binstall@main
- name: Make more disk space available on public runner
run: |
cargo binstall -y --force --version 2.2.0 rmz

echo "Available storage before:"
sudo df -h
echo

sudo mv ~/.cargo/bin/rmz /usr/local/bin/rmz

sudo rmz -f $AGENT_TOOLSDIRECTORY
sudo rmz -f /opt/az
sudo rmz -f /opt/ghc
sudo rmz -f /opt/google
sudo rmz -f /opt/microsoft
sudo rmz -f /opt/pipx
sudo rmz -f /usr/lib/mono
sudo rmz -f /usr/local/julia*
sudo rmz -f /usr/local/lib/android
sudo rmz -f /usr/local/share/boost
sudo rmz -f /usr/local/share/chromium
sudo rmz -f /usr/local/share/powershell
sudo rmz -f /usr/share/az_*
sudo rmz -f /usr/share/dotnet
sudo rmz -f /usr/share/gradle-*
sudo rmz -f /usr/share/swift

echo "Available storage after:"
sudo df -h
echo
shell: bash

- name: Install dependencies
run: sudo apt update && sudo apt install -y wabt gotestsum
shell: bash
Expand All @@ -14,8 +47,6 @@ runs:
uses: actions/setup-node@v5
with:
node-version: "24"
cache: yarn
cache-dependency-path: "**/yarn.lock"

- name: Setup Go
uses: actions/setup-go@v6
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/_arbitrator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
jobs:
arbitrator:
name: Run Arbitrator tests
runs-on: arbitrator-ci
runs-on: ubuntu-latest
env:
RUST_BACKTRACE: 1
# RUSTFLAGS: -Dwarnings # TODO: re-enable after wasmer upgrade
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/_bold-legacy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
jobs:
bold-legacy:
name: Run Bold Legacy challenge tests
runs-on: arbitrator-ci
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/_codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ on:
jobs:
report_summary:
name: Aggregate test results
runs-on: ubuntu-4
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
Expand Down
31 changes: 18 additions & 13 deletions .github/workflows/_detect-changes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ on:
jobs:
changes:
name: Detect file changes
runs-on: ubuntu-4
runs-on: ubuntu-latest
outputs:
arbitrator_changed: ${{ steps.changed.outputs.arbitrator_any_changed }}
bold_legacy_changed: ${{ steps.changed.outputs.bold_legacy_any_changed }}
Expand All @@ -26,17 +26,22 @@ jobs:
submodules: recursive
fetch-depth: 10 # Will cover most PRs
persist-credentials: true # In case changed-files requires deeper depth

- name: Determine if Arbitrator or Bold Legacy changed
id: changed
uses: tj-actions/changed-files@v46.0.5
with:
files_yaml: |
arbitrator:
- 'arbitrator/**'
- 'contracts/**'
- 'Makefile'
- '.github/workflows/_arbitrator.yml'
bold_legacy:
- 'bold/legacy/**'
- '.github/workflows/_bold-legacy.yml'
run: |
echo "arbitrator_any_changed=false" >> $GITHUB_OUTPUT
echo "bold_legacy_any_changed=false" >> $GITHUB_OUTPUT

# - name: Determine if Arbitrator or Bold Legacy changed
# id: changed
# uses: tj-actions/changed-files@v46.0.5
# with:
# files_yaml: |
# arbitrator:
# - 'arbitrator/**'
# - 'contracts/**'
# - 'Makefile'
# - '.github/workflows/_arbitrator.yml'
# bold_legacy:
# - 'bold/legacy/**'
# - '.github/workflows/_bold-legacy.yml'
6 changes: 3 additions & 3 deletions .github/workflows/_fast.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
jobs:
lint-and-build:
name: Lint and Build
runs-on: arbitrator-ci
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5
Expand All @@ -17,10 +17,10 @@ jobs:
uses: ./.github/actions/ci-setup

- name: Build
run: make -j8 build test-go-deps
run: make -j4 build test-go-deps

- name: Build all lint dependencies
run: make -j8 build-node-deps
run: make -j build-node-deps

- name: GolangCI Lint
uses: golangci/golangci-lint-action@v9
Expand Down
20 changes: 15 additions & 5 deletions .github/workflows/_go-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ on:
jobs:
go-tests:
name: Full Go tests (matrix)
runs-on: arbitrator-ci
runs-on: ${{ startsWith(matrix.test-mode, 'defaults') && 'ubuntu-24.04-8core' || 'ubuntu-latest' }}
strategy:
fail-fast: false
matrix:
test-mode: [defaults-A, defaults-B, flaky, pathdb, challenge, stylus, l3challenge]
test-mode: [defaults-A, defaults-B, defaults-C, flaky, pathdb, challenge, stylus, l3challenge]
services:
redis:
image: redis
Expand All @@ -35,7 +35,7 @@ jobs:
echo "GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}" >> "$GITHUB_ENV"

- name: Build
run: make -j8 build test-go-deps
run: make -j4 build test-go-deps

- name: Build all lint dependencies
run: make -j8 build-node-deps
Expand Down Expand Up @@ -66,7 +66,16 @@ jobs:
run: >-
${{ github.workspace }}/.github/workflows/gotestsum.sh
--tags cionly --timeout 60m --test_state_scheme hash
--junitfile test-results/junit-b.xml --skip '^Test[A-L]'
--junitfile test-results/junit-b.xml --run '^Test[M-S]'

- name: run tests without race detection and hash state scheme (C-batch)
if: matrix.test-mode == 'defaults-C'
id: run-tests-defaults-c
continue-on-error: true
run: >-
${{ github.workspace }}/.github/workflows/gotestsum.sh
--tags cionly --timeout 60m --test_state_scheme hash
--junitfile test-results/junit-c.xml --skip '^Test[A-S]'

- name: Process JUnit XML logs
if: startsWith(matrix.test-mode, 'defaults') && always()
Expand All @@ -87,8 +96,9 @@ jobs:

- name: run redis tests
if: matrix.test-mode == 'defaults-A'
# TODO: figure out why TestRedisSeqCoordinatorPrioritiesFlaky fails
run: >-
gotestsum --format short-verbose -- -p 1 -run TestRedis ./arbnode/... ./system_tests/...
gotestsum --format short-verbose -- -p 1 -run TestRedis -skip 'TestRedisForwarder|TestRedisProduce|TestRedisSeqCoordinatorPrioritiesFlaky' ./arbnode/... ./system_tests/...
-coverprofile=coverage-redis.txt -covermode=atomic -coverpkg=./... -- --test_redis=redis://localhost:6379/0

- name: Upload coverage to Codecov
Expand Down
25 changes: 25 additions & 0 deletions .github/workflows/_tiitleChecker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: PR Title Lint
run-name: Validate PR title (@${{ github.actor }})

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

on:
pull_request:

jobs:
pr-title:
runs-on: ubuntu-latest
steps:
- name: Validate PR title
env:
GH_TOKEN: ${{ github.token }}
run: |
TITLE=$(gh pr view ${{ github.event.pull_request.number }} --repo ${{ github.repository }} --json title --jq .title)
echo "PR title: $TITLE"

if ! echo "$TITLE" | grep -Eq '^(feat|fix|chore|docs|refactor|test|ci)(\(.+\))?: .+'; then
echo "❌ PR title must follow Conventional Commits"
exit 1
fi
53 changes: 53 additions & 0 deletions .github/workflows/backport.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Backport merged pull request
on:
pull_request_target:
types: [closed]
permissions:
contents: write # so it can comment
pull-requests: write # so it can create pull requests
issues: write # so it can create issues
jobs:
backport:
name: Backport pull request
runs-on: ubuntu-latest
# Don't run on closed unmerged pull requests
if: github.event.pull_request.merged
steps:
- uses: actions/checkout@v4
- name: Create backport pull requests
id: backport
uses: korthout/backport-action@v3

- name: create issue if backport failed
uses: actions/github-script@v7
with:
script: |
const pr = github.event.pull_request;
const byTarget = '${{ steps.backport.outputs.was_successful_by_target }}'
.split(' ')
.map(item => item.split('='))
.filter(arr => arr.length === 2);
const failedTargets = byTarget.filter(([label, ok]) => ok === 'false').map(([label]) => label);
const successfulTargets = byTarget.filter(([label, ok]) => ok === 'true').map(([label]) => label);

if (failedTargets.length === 0) {
// nothing failed — don't create an issue
return;
}

const title = `Backport failed for PR #${pr.number} to: ${failedTargets.join(', ')}`;
const body = `
Backport action failed for PR #${pr.number}.
- **Original PR:** #${pr.number} (${pr.title})
- **Failed targets:** ${failedTargets.length ? failedTargets.map(t => \`\\\`${t}\\\`\`).join(', ') : 'None'}
- **Successful targets:** ${successfulTargets.length ? successfulTargets.map(t => \`\\\`${t}\\\`\`).join(', ') : 'None'}
`;

await github.rest.issues.create({
owner: context.repo.owner,
repo: context.repo.repo,
title,
body,
labels: ['backport-failure'],
assignees: [pr.user.login]
});
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:

can_proceed:
name: can_proceed
runs-on: ubuntu-4
runs-on: ubuntu-latest
needs: [fast]
steps:
- name: OK
Expand All @@ -65,6 +65,6 @@ jobs:
# This job is just to make sure that the "can_proceed" job's status is visible
# on the pull request page, even if it is skipped due to all its dependencies being
# skipped. It does not depend on any other jobs, so it always runs.
runs-on: ubuntu-4
runs-on: ubuntu-latest
steps:
- run: true
Loading
Loading