Files
noq/.github/workflows/iroh-patchbay.yml
Floris Bruynooghe 966398681f chore: improve semver checks for stable releases (#734)
## Description

This updates semver checks with the following behaviour:

- The baseline for the check is now the latest published release on
  crates.io

- If you make a semver-breaking change you must also bump the package
  version number so that the semver check will pass. Because we like
  to bump the versions of all crates at the same time you can not use
  pre-releases since cargo does not allow mixing those and the iroh
  patchbay tests has 2nd-level dependencies on noq-udp (via netwatch).

- Adding deprecated items is allowed in minor version bumps, matching
  https://semver.org/#how-should-i-handle-deprecating-functionality

- Bump noq-proto version because we previously added deprecations.

- Now the baseline is somewhat stable, enable caching.


## Breaking Changes

none

## Notes & open questions

I tested this first by not bumping the noq-proto version number and it
fails in that case. Which is due to #725.

Once this is merged I will make the semver check required in noq.

The version bumping required to make semver-checks pass could be a bit
annoying. It will also make patching iroh for noq a little bit harder.
As shown by what the patchbay check has to do now. I'm tempted to think
for now that this is worth it, but happy to think about how to tweak
this as we gain experience.

OTOH having to bump to the right version means that come to a release we
do know what the next version should be. Which is probably good.

## Change checklist

- [x] Self-review.
2026-07-13 16:40:27 +00:00

113 lines
4.1 KiB
YAML

name: iroh-patchbay
on:
pull_request:
merge_group:
push:
branches:
- main
concurrency:
group: iroh-patchbay-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
RUST_BACKTRACE: 1
SCCACHE_CACHE_SIZE: "10G"
IROH_FORCE_STAGING_RELAYS: "1"
NEXTEST_VERSION: "0.9.80"
jobs:
iroh_patchbay:
name: iroh patchbay
timeout-minutes: 30
runs-on: [self-hosted, linux, X64]
env:
RUSTC_WRAPPER: "sccache"
steps:
- name: Enable unprivileged user namespaces
run: sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0
continue-on-error: true
- name: Checkout noq
uses: actions/checkout@v6
with:
path: noq
- name: Checkout iroh
uses: actions/checkout@v6
with:
repository: n0-computer/iroh
ref: main
path: iroh
- uses: dtolnay/rust-toolchain@stable
- uses: mozilla-actions/sccache-action@v0.0.9
- name: Install cargo-make and cargo-nextest
uses: taiki-e/install-action@v2
with:
tool: nextest@${{ env.NEXTEST_VERSION }},cargo-make
- name: Patch noq crates in iroh workspace
working-directory: iroh
run: |
# Delete any pre-existing trailing patch section. This
# assumes the patch section is trailing and the only reason
# there would be any patch is because of noq. Could be
# smarter.
mv Cargo.toml Cargo.toml.in
awk 'BEGIN { in_patch = 0 }; /\[patch\.crates-io\]/ { in_patch = 1 }; !in_patch { print }' Cargo.toml.in > Cargo.toml
# Add our own patch section.
cat >> Cargo.toml <<'EOF'
[patch.crates-io]
noq = { path = "../noq/noq" }
noq-proto = { path = "../noq/noq-proto" }
noq-udp = { path = "../noq/noq-udp" }
EOF
# Patch the version numbers. Note because the output of
# cargo-metadata is JSON, these variables will include the
# quotes around the version numbers.
NOQ_VERSION=$(cargo metadata --manifest-path=../noq/Cargo.toml --format-version=1 --no-deps | jq '.packages[] | select(.name == "noq") | .version')
NOQ_PROTO_VERSION=$(cargo metadata --manifest-path=../noq/Cargo.toml --format-version=1 --no-deps | jq '.packages[] | select(.name == "noq-proto") | .version')
NOQ_UDP_VERSION=$(cargo metadata --manifest-path=../noq/Cargo.toml --format-version=1 --no-deps | jq '.packages[] | select(.name == "noq-udp") | .version')
echo noq version: $NOQ_VERSION
echo noq-proto version: $NOQ_PROTO_VERSION
echo noq-udp version: $NOQ_UDP_VERSION
sed -i -E "/^noq .*version/s/(version += +)\"[0-9.]+\"/\1 $NOQ_VERSION/" iroh/Cargo.toml
sed -i -E "/^noq .*version/s/(version += +)\"[0-9.]+\"/\1 $NOQ_VERSION/" iroh-relay/Cargo.toml
sed -i -E "/^noq-proto .*version/s/(version += +)\"[0-9.]+\"/\1 $NOQ_PROTO_VERSION/" iroh/Cargo.toml
sed -i -E "/^noq-proto .*version/s/(version += +)\"[0-9.]+\"/\1 $NOQ_PROTO_VERSION/" iroh-relay/Cargo.toml
sed -i -E "/^noq-udp .*version/s/(version += +)\"[0-9.]+\"/\1 $NOQ_UDP_VERSION/" iroh/Cargo.toml
sed -i -E "/^noq-udp .*version/s/(version += +)\"[0-9.]+\"/\1 $NOQ_UDP_VERSION/" iroh-relay/Cargo.toml
sed -i -E "/^noq = \"[0-9.]+\"/s/\"[0-9.]+\"/$NOQ_VERSION/" iroh/bench/Cargo.toml
- name: Build patchbay tests
working-directory: iroh
run: cargo make patchbay --no-run
- name: Run patchbay tests
working-directory: iroh
run: |
set -o pipefail
cargo make patchbay 2>&1 | tee "$RUNNER_TEMP/logs.txt"
env:
PATCHBAY_LOG: ${{ runner.debug && 'trace' || 'debug' }}
RUST_LOG: ${{ runner.debug && 'trace' || 'debug' }}
- name: Upload test results
if: always()
uses: actions/upload-artifact@v7
with:
name: iroh-patchbay-testdir-${{ github.sha }}
path: |
iroh/target/testdir-*/
${{ runner.temp }}/logs.txt
retention-days: 7
if-no-files-found: ignore