Skip to content

Shielded history

Shielded history #643

Workflow file for this run

name: PR checks # targeting only the main branch
on:
pull_request:
branches:
- main
types: [opened, synchronize, reopened, ready_for_review]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true
env:
MINOR_VERSION_RELEASE: "0.150.999" # bump on a major release
BACKPORT_LIBS_LABEL: "backport-libs-0.150" # also bump on major release
MAINT_LIBS_BRANCH: "maint-libs-0.150" # also bump on major release
jobs:
# Check if a PR has no major breaking changes to be backported to library
# maintenance branch.
can-backport:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write # Needed to add label based on the outcome
steps:
- name: Stop if draft
if: github.event.pull_request.draft == true
run: exit 1
- uses: cargo-bins/cargo-binstall@main
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 50
- name: Find branch point of the PR
id: branch_point
run: |
git fetch origin main
# Find common ancestor between main and topic branch
BRANCH_POINT=$(git merge-base $(git rev-parse --abbrev-ref HEAD) origin/main)
[[ -z BRANCH_POINT ]] && echo "No branch point" && exit 1
echo "REF=$BRANCH_POINT" >> $GITHUB_OUTPUT
- name: Checkout libs maintenance branch
uses: actions/checkout@v4
with:
ref: ${{ env.MAINT_LIBS_BRANCH }}
- name: Copy the current folder to be the baseline for semver-checks
run: cp -r "$GITHUB_WORKSPACE" ../baseline
- name: Backport PR to libs maintenance branch
run: |
git config user.email "bing@bong.com"
git config user.name "Bing Bong"
git cherry-pick --strategy=recursive --strategy-option=theirs ${{ steps.branch_point.outputs.REF }}..${{ github.event.pull_request.head.sha }}
- name: Instal cargo release
run: cargo binstall -y cargo-release
- name: Install build deps
run: sudo apt-get install -y protobuf-compiler libudev-dev
- name: Totally safe
# Workaround for https://github.com/actions/checkout/issues/766
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
- name: Change version as if we're doing a minor update
# This is needed so that semver-checks can find the last released
# baseline version to compare with.
run: |
cargo release version --no-confirm --isolated --exclude namada_apps \
--execute ${{ env.MINOR_VERSION_RELEASE }}
- name: Check semver
id: semver
continue-on-error: true
# TODO: Temp using fork for baseline args support.
# Switch back once is merged and released https://github.com/obi1kenobi/cargo-semver-checks-action/pull/96
# uses: obi1kenobi/cargo-semver-checks-action@v2
uses: anoma/cargo-semver-checks-action@8ce111a9587c085c03ca615d22a585da0ce31a93
with:
exclude: namada_apps, namada_benchmarks, namada_light_sdk, namada_examples, namada_fuzz
baseline-root: ../baseline
- name: Label PR on success
uses: actions-ecosystem/action-add-labels@v1
if: >-
${{ steps.semver.outcome == 'success' &&
!contains( github.event.pull_request.labels.*.name, 'breaking:consensus') }}
with:
labels: "${{ env.BACKPORT_LIBS_LABEL }}"
- name: Label PR on failure
uses: actions-ecosystem/action-add-labels@v1
if: steps.semver.outcome == 'failure'
with:
labels: "breaking:api"
# Check minimum supported Rust version of the SDK, tx_prelude, vp_prelude and apps_lib crates
msrv:
name: msrv
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
build: [ ubuntu, macos ]
include:
- build: ubuntu
os: ubuntu-latest
- build: macos
os: macos-latest
continue-on-error: true
timeout-minutes: 20
steps:
- name: checkout_repo
uses: actions/checkout@v4
- name: install_rust
uses: dtolnay/rust-toolchain@stable
- name: install_cargo_msrv
if: matrix.build == 'ubuntu'
run: cargo install cargo-msrv --locked
- name: install_cargo_msrv_no_default
if: matrix.build != 'ubuntu'
run: cargo install cargo-msrv --no-default-features
- name: version_of_cargo_msrv
run: cargo msrv --version
- name: Install build deps
if: matrix.build == 'ubuntu'
run: sudo apt-get install -y protobuf-compiler libudev-dev
- name: Install build deps MacOS
if: matrix.build != 'ubuntu'
run: brew install protobuf
- name: run_cargo_msrv in sdk
run: |
cargo msrv verify --path crates/sdk --output-format json
- name: run_cargo_msrv in tx_prelude
run: |
cargo msrv verify --path crates/tx_prelude --output-format json
- name: run_cargo_msrv in vp_prelude
run: |
cargo msrv verify --path crates/vp_prelude --output-format json
- name: run_cargo_msrv in apps_lib
run: |
cargo msrv verify --path crates/apps_lib --output-format json