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
103 changes: 50 additions & 53 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ on:
pull_request:
branches:
- "**"
# Release candidates call these same jobs at their tested commit.
workflow_call:
concurrency:
# Cancel any previous workflows if they are from a PR or push.
group: ${{ github.event.pull_request.number || github.ref }}
# Separate standalone/called CI from its release caller to avoid cancellation.
group: ci-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

defaults:
Expand All @@ -30,7 +32,8 @@ env:
BITCOIND_VERSION: '22.0'
BITCOIND_IMAGE: 'lightninglabs/bitcoin-core'

BTCD_VERSION_LATEST: v0.25.0
# Share the current miner pin with the btcd job's named version axis.
BTCD_VERSION_LATEST: &btcd_latest v0.27.0

jobs:
########################
Expand Down Expand Up @@ -229,16 +232,17 @@ jobs:
########################
# Run bwtest integration tests against each supported chain backend.
#
# btcd and neutrino run with kvdb and sqlite. The bitcoind matrix crosses
# every supported bitcoind version with kvdb, sqlite, and postgres so it
# catches compatibility bugs specific to a node version and wallet database.
# Ordinary CI checks current daemon releases across the existing databases.
# Historical release compatibility runs in the release-check workflow.
########################
itest-btcd:
name: Wallet itest (btcd, ${{ matrix.db }})
name: Wallet itest (btcd ${{ matrix.btcd_version }}, ${{ matrix.db }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# Keep the current release visible in job and failure-artifact names.
btcd_version: [*btcd_latest]
db: [kvdb, sqlite]
steps:
- name: git checkout
Expand All @@ -252,14 +256,15 @@ jobs:
with:
go-version: '${{ env.GO_VERSION }}'

# The harness resolves both daemon executables through this PATH.
- name: add go bin to PATH
run: echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
run: echo "$(go env GOPATH)/bin" >> "$GITHUB_PATH"

- name: install btcd ${{ env.BTCD_VERSION_LATEST }}
run: go install -v github.com/btcsuite/btcd@${{ env.BTCD_VERSION_LATEST }}

- name: check btcd version
run: btcd --version
# Share authenticated installation and the exact backend/miner version guard.
- name: install and check btcd ${{ matrix.btcd_version }}
env:
BTCD_VERSION: ${{ matrix.btcd_version }}
run: scripts/install-btcd.sh "$BTCD_VERSION"

# The btcd backend job runs btcd for both the shared miner and the chain
# backend under test.
Expand All @@ -270,7 +275,8 @@ jobs:
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: itest-logs-btcd-${{ matrix.db }}
# Identify the exact daemon/database pair when a lane fails.
name: itest-logs-btcd-${{ matrix.btcd_version }}-${{ matrix.db }}
path: itest/test-logs
retention-days: 5

Expand Down Expand Up @@ -302,14 +308,15 @@ jobs:
with:
go-version: '${{ env.GO_VERSION }}'

# Expose the verified miner on the PATH used by the harness.
- name: add go bin to PATH
run: echo "$(go env GOPATH)/bin" >> $GITHUB_PATH

- name: install btcd ${{ env.BTCD_VERSION_LATEST }}
run: go install -v github.com/btcsuite/btcd@${{ env.BTCD_VERSION_LATEST }}
run: echo "$(go env GOPATH)/bin" >> "$GITHUB_PATH"

- name: check btcd version
run: btcd --version
# Share authenticated installation and the exact backend/miner version guard.
- name: install and check btcd ${{ env.BTCD_VERSION_LATEST }}
env:
BTCD_VERSION: ${{ env.BTCD_VERSION_LATEST }}
run: scripts/install-btcd.sh "$BTCD_VERSION"

# Neutrino runs in-process, but it still relies on the shared btcd miner
# for chain data and peer connectivity.
Expand All @@ -329,18 +336,20 @@ jobs:
#
# Job flow:
# - Install btcd `${{ env.BTCD_VERSION_LATEST }}` as the shared miner.
# - Cross bitcoind versions `30` (latest) and `28` (older) with every wallet
# database so each version/database combination is tested independently.
# - Extract each matrix binary from the docker image and run
# `make itest chain=bitcoind db=${{ matrix.db }}`.
# - Test the pinned Core release on every existing wallet database.
# - Verify its official archive before running the complete suite; older
# supported releases run in the release-check workflow.
########################
itest-bitcoind:
name: Wallet itest (bitcoind v${{ matrix.bitcoind_version }}, ${{ matrix.db }})
name: Wallet itest (bitcoind v${{ matrix.bitcoind.version }}, ${{ matrix.db }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
bitcoind_version: ['30', '28']
# Pin the current Core artifact independently of mutable image tags.
bitcoind:
- version: '32.1'
sha256: '61545c17c3120fb7412f896d248b11993af04ec8817aad3649c55b2afb044963'
db: [kvdb, sqlite, postgres]
steps:
- name: git checkout
Expand All @@ -354,35 +363,22 @@ jobs:
with:
go-version: '${{ env.GO_VERSION }}'

# Core and its btcd miner must resolve to the provisioned executables.
- name: add go bin to PATH
run: echo "$(go env GOPATH)/bin" >> $GITHUB_PATH

- name: install btcd ${{ env.BTCD_VERSION_LATEST }}
run: go install -v github.com/btcsuite/btcd@${{ env.BTCD_VERSION_LATEST }}

- name: check btcd version
run: btcd --version
run: echo "$(go env GOPATH)/bin" >> "$GITHUB_PATH"

# For bitcoind backend tests, btcd remains the shared miner while the
# matrix covers both bitcoind v30 (latest) and v28 (older).
- name: extract bitcoind from docker image (${{ matrix.bitcoind_version }})
run: |-
IMAGE=${{ env.BITCOIND_IMAGE }}:${{ matrix.bitcoind_version }}
docker pull $IMAGE

BIN_PATH=$(docker run --rm --entrypoint sh $IMAGE -c '
command -v bitcoind ||
find /opt /usr -type f -name bitcoind 2>/dev/null | head -n 1
')
if [ -z "$BIN_PATH" ]; then
echo "could not locate bitcoind in $IMAGE" >&2
exit 1
fi
# Share authenticated installation and the exact backend/miner version guard.
- name: install and check btcd ${{ env.BTCD_VERSION_LATEST }}
env:
BTCD_VERSION: ${{ env.BTCD_VERSION_LATEST }}
run: scripts/install-btcd.sh "$BTCD_VERSION"

CONTAINER_ID=$(docker create $IMAGE)
sudo docker cp $CONTAINER_ID:$BIN_PATH /usr/local/bin/bitcoind
docker rm $CONTAINER_ID
bitcoind --version
# Verify the pinned archive and installed version before running Core.
- name: install bitcoind ${{ matrix.bitcoind.version }}
env:
CORE_VERSION: ${{ matrix.bitcoind.version }}
CORE_SHA256: ${{ matrix.bitcoind.sha256 }}
run: scripts/install-bitcoind.sh "$CORE_VERSION" "$CORE_SHA256"

- name: run itest (bitcoind, ${{ matrix.db }})
run: make itest chain=bitcoind db=${{ matrix.db }}
Expand All @@ -391,7 +387,8 @@ jobs:
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: itest-logs-bitcoind-${{ matrix.bitcoind_version }}-${{ matrix.db }}
# Keep failure uploads distinct for each exact Core/database pair.
name: itest-logs-bitcoind-${{ matrix.bitcoind.version }}-${{ matrix.db }}
path: itest/test-logs
retention-days: 5

Expand Down
116 changes: 116 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
name: Release checks
# Identify the exact tested commit for the maintainer's later signed tag.
run-name: Release checks ${{ github.ref_name }} @ ${{ github.sha }}

on:
# Check each release candidate and subsequent fix before publishing its tag.
push:
branches:
- 'v0.*-branch'
# Allow intentional retries on a selected ref once enabled on master.
workflow_dispatch:

# Discovery reads upstream releases; these checks never create tags or releases.
permissions:
contents: read

# Keep normal CI on the same push from cancelling release compatibility checks.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

defaults:
run:
shell: bash

# Reuse ordinary CI's toolchain and paths for the same maintained suite.
env:
GOCACHE: /home/runner/work/go/pkg/build
GOPATH: /home/runner/work/go
GOBIN: /home/runner/work/go/bin
GO111MODULE: 'on'
GO_VERSION: 1.25.11

# Discovery reads the current pin from main.yml; only the previous tag lives here.
BTCD_VERSION_PREVIOUS: v0.26.2

# Require the full ordinary suite plus the rolling five-version SQLite matrix.
jobs:
# Reuse the caller commit's CI so release checks cannot omit normal coverage.
normal-ci:
name: Full CI
uses: ./.github/workflows/main.yml

fetch-chain-backend-versions:
name: Resolve release test versions
runs-on: ubuntu-latest
# Resolve once so every lane receives the same release/checksum snapshot.
outputs:
matrix: ${{ steps.matrix.outputs.matrix }}
btcd_version: ${{ steps.matrix.outputs.btcd_version }}
steps:
- name: git checkout
uses: actions/checkout@v5

# The hosted runner supplies gh/jq/curl/yq; use its token for release reads.
- name: resolve supported Core releases
id: matrix
env:
GH_TOKEN: ${{ github.token }}
run: scripts/chain-test-matrix.sh "$BTCD_VERSION_PREVIOUS"

itest-chain-backend-versions:
# Failed discovery must prevent expansion into an incomplete test matrix.
needs: fetch-chain-backend-versions
name: Release itest (${{ matrix.chain }} ${{ matrix.version }}, sqlite)
runs-on: ubuntu-latest
strategy:
fail-fast: false
# Expand the complete validated output, including its exact archive hashes.
matrix: ${{ fromJSON(needs.fetch-chain-backend-versions.outputs.matrix) }}
steps:
# Default checkout selects the event commit recorded in the workflow run.
- name: git checkout
uses: actions/checkout@v5

# Reuse ordinary CI cleanup to make room for daemon archives and builds.
- name: Clean up runner space
uses: ./.github/actions/cleanup-space

# Wallet tests keep the repository compiler despite daemon requirements.
- name: setup go ${{ env.GO_VERSION }}
uses: actions/setup-go@v7
with:
go-version: '${{ env.GO_VERSION }}'

# Both daemon discovery and the suite use these installed executables.
- name: add go bin to PATH
run: echo "$(go env GOPATH)/bin" >> "$GITHUB_PATH"

# Core keeps the current miner; btcd rows install their tested release.
# The script scopes compiler selection to its authenticated install.
- name: install and check btcd
env:
BTCD_VERSION: ${{ matrix.chain == 'btcd' && matrix.version || needs.fetch-chain-backend-versions.outputs.btcd_version }}
run: scripts/install-btcd.sh "$BTCD_VERSION"

# Share the same archive/checksum and exact-version guard as ordinary CI.
- name: install bitcoind ${{ matrix.version }}
if: matrix.chain == 'bitcoind'
env:
CORE_VERSION: ${{ matrix.version }}
CORE_SHA256: ${{ matrix.sha256 }}
run: scripts/install-bitcoind.sh "$CORE_VERSION" "$CORE_SHA256"

# Every selected version executes the complete maintained SQLite suite.
- name: run itest (${{ matrix.chain }}, sqlite)
run: make itest chain=${{ matrix.chain }} db=sqlite

# Preserve unambiguous evidence for the exact failing release lane.
- name: upload itest logs
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: itest-logs-release-${{ matrix.chain }}-${{ matrix.version }}-sqlite
path: itest/test-logs
retention-days: 5
29 changes: 29 additions & 0 deletions itest/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,32 @@ Wallet logs are created per test case:
- `wallet-<testname>.log`

The log directory path is printed when it is created.

## Release Compatibility Checks

After this workflow is present on `sql-wallet`, cut a release branch such as
`v0.19-branch` from the maintained commit and push the version bump there. Every
push to `v0.*-branch`, including later fixes without a version change, starts
**Release checks** automatically. Ordinary pull requests keep normal CI.

A release run calls the full normal CI workflow at the same candidate commit:
static/generated checks, lint, unit/race tests, database integration tests and
current-version chain integration tests. The commit-range check stays PR-only
because it needs a pull-request base. Release compatibility runs in addition
to this full suite, and both must pass before tagging.

The discovery job selects the latest stable patch of the three newest Bitcoin
Core major lines and reads their official archive checksums. The next job runs
the complete SQLite suite for each Core release and the two selected btcd
releases. The support window rolls forward rather than growing. Core uses the
latest selected btcd as its miner; Neutrino stays in normal CI.

After the complete release run passes, create and push the maintainer-signed
release tag at the exact commit SHA shown in that successful run. If the
candidate changes, wait for the new push's checks before tagging it. These
checks do not create tags, build release artifacts or publish releases.

Use Actions' rerun operation to retry the same tested commit. Manual dispatch
for a selected ref is also available once `release.yml` exists on the default
branch, `master`. Automatic release-branch pushes only require the workflow
on that branch; they do not depend on manual-dispatch registration on master.
54 changes: 54 additions & 0 deletions scripts/chain-test-matrix.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#!/bin/bash

# chain-test-matrix.sh resolves the release-check suite's Core window and checksums.
# The caller supplies the previous btcd release; main.yml owns the current pin.
# Publish one complete matrix so downstream lanes share this run's evidence.
set -euo pipefail

# Reuse ordinary CI's canonical pin for the current release row and Core miner.
btcd_version=$(yq -er '.env.BTCD_VERSION_LATEST' .github/workflows/main.yml)

# Paginate the official releases, excluding drafts/RCs. Compare numeric parts
# rather than publish order so older-line patches cannot displace newer majors.
versions=$(
gh api --paginate --slurp 'repos/bitcoin/bitcoin/releases?per_page=100' |
jq -er '
[.[][] | select(.draft == false and .prerelease == false)
| .tag_name
| select(test("^v[0-9]+\\.[0-9]+(\\.[0-9]+)?$"))
| ltrimstr("v")]
| group_by(split(".")[0] | tonumber)
| map(max_by(split(".") | map(tonumber)))
| sort_by(split(".")[0] | tonumber) | reverse | .[:3]
| if length == 3 then .[]
else error("need three stable Core major lines") end
'
)

# Bind each release to its exact official Linux archive. Missing evidence fails
# the pipeline before an output can silently shrink the requested test window.
# Explicit exits also propagate failures inside Bash command substitutions.
matrix=$(
while IFS= read -r version; do
archive="bitcoin-${version}-x86_64-linux-gnu.tar.gz"
checksum=$(
curl --fail --location --retry 3 \
"https://bitcoincore.org/bin/bitcoin-core-${version}/SHA256SUMS" |
awk -v archive="$archive" '$2 == archive { print $1 }'
) || exit 1
[[ $checksum =~ ^[[:xdigit:]]{64}$ ]] || exit 1
jq -nc --arg version "$version" --arg sha256 "$checksum" \
'{chain: "bitcoind", version: $version, sha256: $sha256}' || exit 1
done <<< "$versions" |
jq -sc --arg latest "$btcd_version" --arg previous "$1" \
'{include: (. + [
{chain: "btcd", version: $latest},
{chain: "btcd", version: $previous}
])}'
)

# Publish the matrix and miner pin together only after discovery succeeds,
# so dependent suites cannot consume a partial compatibility window.
printf '%s\n' "$matrix"
printf 'matrix=%s\nbtcd_version=%s\n' "$matrix" "$btcd_version" \
>> "$GITHUB_OUTPUT"
Loading
Loading