Skip to content
Merged
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
11 changes: 11 additions & 0 deletions .github/actions/checkout-maintainer-tools/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: Checkout Maintainer Tools
description: Checks out the rust-bitcoin maintainer tools repo
runs:
using: "composite"
steps:
- name: Checkout maintainer tools
uses: actions/checkout@v4
with:
repository: rust-bitcoin/rust-bitcoin-maintainer-tools
ref: f92b2766865ce5327eca5cf72f86ceaa6be58ca4
path: maintainer-tools
41 changes: 41 additions & 0 deletions .github/workflows/cron-semi-weekly-update-nightly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Update Nightly rustc
on:
schedule:
- cron: "5 0 * * 1,4" # runs every Monday and Thursday at 00:05 UTC
workflow_dispatch: # allows manual triggering
jobs:
format:
name: Update nightly rustc
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
- name: Update rust.yml to use latest nightly
run: |
set -x
# Not every night has a nightly, so extract the date from whatever
# version of the compiler dtolnay/rust-toolchain gives us.
NIGHTLY_DATE=$(rustc +nightly --verbose --version | sed -ne 's/^commit-date: //p')
# Update the nightly version in the reference file.
echo "nightly-${NIGHTLY_DATE}" > nightly-version
echo "nightly_date=${NIGHTLY_DATE}" >> $GITHUB_ENV
# Some days there is no new nightly. In this case don't make an empty PR.
if ! git diff --exit-code > /dev/null; then
echo "Updated nightly. Opening PR."
echo "changes_made=true" >> $GITHUB_ENV
else
echo "Attempted to update nightly but the latest-nightly date did not change. Not opening any PR."
echo "changes_made=false" >> $GITHUB_ENV
fi
- name: Create Pull Request
if: env.changes_made == 'true'
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.APOELSTRA_CREATE_PR_TOKEN }}
author: Update Nightly Rustc Bot <[email protected]>
committer: Update Nightly Rustc Bot <[email protected]>
title: Automated daily update to rustc (to nightly-${{ env.nightly_date }})
body: |
Automated update to Github CI workflow `rust.yml` by [create-pull-request](https://github.com/peter-evans/create-pull-request) GitHub action
commit-message: Automated update to Github CI to rustc nightly-${{ env.nightly_date }}
branch: create-pull-request/daily-nightly-update
205 changes: 132 additions & 73 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -1,114 +1,173 @@
on:
on: # yamllint disable-line rule:truthy
pull_request:
push:
branches:
- master
pull_request: {}
- 'test-ci/**'

name: Continuous integration

jobs:
Prepare:
runs-on: ubuntu-latest
outputs:
nightly_version: ${{ steps.read_toolchain.outputs.nightly_version }}
msrv_version: ${{ steps.read_msrv.outputs.msrv_version }}
steps:
- name: "Checkout repo"
uses: actions/checkout@v4
- name: "Read nightly version"
id: read_toolchain
run: |
set -euo pipefail
version=$(cat nightly-version)
echo "nightly_version=$version" >> $GITHUB_OUTPUT
- name: Read MSRV from clippy.toml
id: read_msrv
run: |
set -euo pipefail
msrv=$(grep '^msrv *= *"' clippy.toml | sed -E 's/.*"([^"]+)".*/\1/')
echo "msrv_version=$msrv" >> "$GITHUB_OUTPUT"

Stable:
name: Test - stable toolchain
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- name: Checkout Crate
uses: actions/checkout@v3
- name: Checkout Toolchain
# https://github.com/dtolnay/rust-toolchain
- name: "Checkout repo"
uses: actions/checkout@v4
- name: "Checkout maintainer tools"
uses: ./.github/actions/checkout-maintainer-tools
- name: "Select toolchain"
uses: dtolnay/rust-toolchain@stable
- name: Running test script
env:
DO_DOCS: true
DO_DOCSRS: false
DO_FUZZ: false
DO_INTEGRATION: false
DO_LINT: true
DO_FEATURE_MATRIX: true
run: ./contrib/test.sh
- name: "Set dependencies"
run: cp Cargo-latest.lock Cargo.lock
- name: "Run test script"
run: ./maintainer-tools/ci/run_task.sh stable

Nightly:
name: Test - nightly toolchain
needs: Prepare
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- name: Checkout Crate
uses: actions/checkout@v3
- name: Checkout Toolchain
uses: dtolnay/rust-toolchain@nightly
- name: Running test script
env:
DO_DOCS: true
DO_DOCSRS: true
DO_FUZZ: false
DO_INTEGRATION: false
DO_LINT: false
DO_FEATURE_MATRIX: true
run: ./contrib/test.sh
- name: "Checkout repo"
uses: actions/checkout@v4
- name: "Checkout maintainer tools"
uses: ./.github/actions/checkout-maintainer-tools
- name: "Select toolchain"
uses: dtolnay/rust-toolchain@v1
with:
toolchain: ${{ needs.Prepare.outputs.nightly_version }}
- name: "Set dependencies"
run: cp Cargo-latest.lock Cargo.lock
- name: "Run test script"
run: ./maintainer-tools/ci/run_task.sh nightly

MSRV:
name: Test - 1.63.0 toolchain
name: Test - MSRV
needs: Prepare
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- name: Checkout Crate
uses: actions/checkout@v3
- name: Checkout Toolchain
uses: dtolnay/[email protected]
- name: Running test script
env:
DO_DOCS: false
DO_DOCSRS: false
DO_FUZZ: false
DO_INTEGRATION: false
DO_LINT: false
DO_FEATURE_MATRIX: true
run: ./contrib/test.sh
- name: "Checkout repo"
uses: actions/checkout@v4
- name: "Checkout maintainer tools"
uses: ./.github/actions/checkout-maintainer-tools
- name: "Select toolchain"
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ needs.Prepare.outputs.msrv_version }}
- name: "Set dependencies"
run: cp Cargo-latest.lock Cargo.lock
- name: "Run test script"
run: ./maintainer-tools/ci/run_task.sh msrv

Fuzz:
name: Fuzztests - 1.63.0 toolchain
Lint:
name: Lint - nightly toolchain
needs: Prepare
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
dep: [recent]
steps:
- name: Checkout Crate
uses: actions/checkout@v3
- name: Checkout Toolchain
uses: dtolnay/[email protected]
- name: Install test dependencies
run: sudo apt-get update -y && sudo apt-get install -y binutils-dev libunwind8-dev libcurl4-openssl-dev libelf-dev libdw-dev cmake gcc libiberty-dev
- name: Running test script
env:
DO_DOCS: false
DO_DOCSRS: false
DO_FUZZ: true
DO_INTEGRATION: false
DO_LINT: false
DO_FEATURE_MATRIX: false
run: ./contrib/test.sh
- name: "Checkout repo"
uses: actions/checkout@v4
- name: "Checkout maintainer tools"
uses: ./.github/actions/checkout-maintainer-tools
- name: "Select toolchain"
uses: dtolnay/rust-toolchain@v1
with:
toolchain: ${{ needs.Prepare.outputs.nightly_version }}
- name: Install clippy
run: rustup component add clippy
- name: "Set dependencies"
run: cp Cargo-latest.lock Cargo.lock
- name: "Run test script"
run: ./maintainer-tools/ci/run_task.sh lint

Integration:
name: Integration tests - stable
Docs:
name: Docs - stable toolchain
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
dep: [recent]
steps:
- name: Checkout Crate
uses: actions/checkout@v3
- name: Checkout Toolchain
- name: "Checkout repo"
uses: actions/checkout@v4
- name: "Checkout maintainer tools"
uses: ./.github/actions/checkout-maintainer-tools
- name: "Select toolchain"
uses: dtolnay/rust-toolchain@stable
- name: Running test script
env:
DO_DOCS: false
DO_DOCSRS: false
DO_FUZZ: false
DO_INTEGRATION: true
DO_LINT: false
DO_FEATURE_MATRIX: false
run: ./contrib/test.sh
- name: "Set dependencies"
run: cp Cargo-latest.lock Cargo.lock
- name: "Run test script"
run: ./maintainer-tools/ci/run_task.sh docs

Docsrs:
name: Docs - nightly toolchain
needs: Prepare
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
dep: [recent]
steps:
- name: "Checkout repo"
uses: actions/checkout@v4
- name: "Checkout maintainer tools"
uses: ./.github/actions/checkout-maintainer-tools
- name: "Select toolchain"
uses: dtolnay/rust-toolchain@v1
with:
toolchain: ${{ needs.Prepare.outputs.nightly_version }}
- name: "Set dependencies"
run: cp Cargo-latest.lock Cargo.lock
- name: "Run test script"
run: ./maintainer-tools/ci/run_task.sh docsrs

# Format:
# name: Format - nightly toolchain
# needs: Prepare
# runs-on: ubuntu-latest
# strategy:
# fail-fast: false
# steps:
# - name: "Checkout repo"
# uses: actions/checkout@v4
# - name: "Select toolchain"
# uses: dtolnay/rust-toolchain@v1
# with:
# toolchain: ${{ needs.Prepare.outputs.nightly_version }}
# - name: "Install rustfmt"
# run: rustup component add rustfmt
# - name: "Check formatting"
# run: cargo fmt --all -- --check

Wasm:
name: Check WASM
Expand Down
Loading