Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into feat/sync-test-restart
Browse files Browse the repository at this point in the history
  • Loading branch information
Frando committed May 2, 2024
2 parents 5d03c2c + 6fbf4a9 commit 965a751
Show file tree
Hide file tree
Showing 173 changed files with 12,092 additions and 4,881 deletions.
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Set line endings to LF, even on Windows. Otherwise, execution within CI fails.
# See https://help.github.com/articles/dealing-with-line-endings/
*.sh text eol=lf
8 changes: 4 additions & 4 deletions .github/ansible/redeploy-relay.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
tasks:
- name: Fetch iroh-relay binary
get_url:
url: https://vorc.s3.us-east-2.amazonaws.com/derper-linux-amd64-{{ derper_version }}
url: https://vorc.s3.us-east-2.amazonaws.com/iroh-relay-linux-amd64-{{ relay_version }}
mode: '0755'
force: yes
dest: /usr/local/bin/derper
dest: /usr/local/bin/iroh-relay
- name: Allow ports
shell:
cmd: sudo setcap CAP_NET_BIND_SERVICE=+eip /usr/local/bin/derper
cmd: sudo setcap CAP_NET_BIND_SERVICE=+eip /usr/local/bin/iroh-relay
- name: Make sure iroh-relay is started
ansible.builtin.systemd:
state: restarted
enabled: yes
name: derper
name: iroh-relay
5 changes: 5 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

<!-- A summary of what this pull request achieves and a rough list of changes. -->

## Breaking Changes

<!-- Optional, if there are any breaking changes document them, including how to migrate older code. -->

## Notes & open questions

<!-- Any notes, remarks or open questions you have to make about the PR. -->
Expand All @@ -11,3 +15,4 @@
- [ ] Self-review.
- [ ] Documentation updates if relevant.
- [ ] Tests if relevant.
- [ ] All breaking changes documented.
35 changes: 33 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,37 @@ jobs:
env:
RUST_LOG: ${{ runner.debug && 'TRACE' || 'DEBUG' }}


check_semver:
runs-on: ubuntu-latest
env:
RUSTC_WRAPPER: "sccache"
SCCACHE_GHA_ENABLED: "on"
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install sccache
uses: mozilla-actions/[email protected]

- name: Setup Environment (PR)
if: ${{ github.event_name == 'pull_request' }}
shell: bash
run: |
echo "HEAD_COMMIT_SHA=$(git rev-parse origin/${{ github.base_ref }})" >> ${GITHUB_ENV}
- name: Setup Environment (Push)
if: ${{ github.event_name == 'push' || github.event_name == 'merge_group' }}
shell: bash
run: |
echo "HEAD_COMMIT_SHA=$(git rev-parse origin/main)" >> ${GITHUB_ENV}
- name: Check semver
# uses: obi1kenobi/cargo-semver-checks-action@v2
uses: n0-computer/cargo-semver-checks-action@feat-baseline
with:
package: iroh, iroh-base, iroh-bytes, iroh-cli, iroh-dns-server, iroh-gossip, iroh-metrics, iroh-net, iroh-sync
baseline-rev: ${{ env.HEAD_COMMIT_SHA }}
use-cache: false

check_fmt_and_docs:
timeout-minutes: 30
name: Checking fmt and docs
Expand Down Expand Up @@ -192,7 +223,7 @@ jobs:
- name: Copy binaries to right location
run: |
cp target/release/iroh ../chuck/netsim/bins/iroh
cp target/release/iroh-relay ../chuck/netsim/bins/derper
cp target/release/iroh-relay ../chuck/netsim/bins/iroh-relay
cp ../chuck/target/release/chuck ../chuck/netsim/bins/chuck
- name: Run tests
Expand All @@ -204,7 +235,7 @@ jobs:
sudo python3 main.py ${{ runner.debug && '--debug' || ''}} --integration sims/integration
- name: Cleanup
run: |
sudo kill -9 $(pgrep derper) || true
sudo kill -9 $(pgrep iroh-relay) || true
sudo kill -9 $(pgrep iroh) || true
sudo kill -9 $(pgrep ovs) || true
sudo mn --clean || true
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ jobs:
- name: check-for-cc
id: check-for-cc
uses: agenthunt/[email protected]
with:
pr-title-regex: "^(.+)(?:(([^)s]+)))?!?: (.+)"
4 changes: 2 additions & 2 deletions .github/workflows/netsim.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ jobs:
- name: Copy binaries to right location
run: |
cp target/optimized-release/iroh ../chuck/netsim/bins/iroh
cp target/optimized-release/iroh-relay ../chuck/netsim/bins/derper
cp target/optimized-release/iroh-relay ../chuck/netsim/bins/iroh-relay
cp ../chuck/target/release/chuck ../chuck/netsim/bins/chuck
- name: Detect comment commands
Expand Down Expand Up @@ -132,7 +132,7 @@ jobs:
- name: Cleanup
run: |
sudo kill -9 $(pgrep derper) || true
sudo kill -9 $(pgrep iroh-relay) || true
sudo kill -9 $(pgrep iroh) || true
sudo kill -9 $(pgrep ovs) || true
sudo mn --clean || true
Expand Down
141 changes: 130 additions & 11 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,20 @@
name: Release

on:
workflow_dispatch: # allow manually triggering this workflow
workflow_dispatch:
inputs:
release_version:
description: "Release version"
required: true
default: ""
create_release:
description: "Create release"
required: true
default: "true"
upload_artifacts:
description: "Upload artifacts"
required: true
default: "true"
push:
tags:
- "v*"
Expand All @@ -16,11 +29,48 @@ env:
RUSTDOCFLAGS: -Dwarnings
MSRV: "1.75"
SCCACHE_CACHE_SIZE: "50G"
BIN_NAMES: "iroh,iroh-relay,iroh-dns-server"
RELEASE_VERSION: ${{ github.event.inputs.release_version }}

jobs:
create-release:
name: create-release
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.release.outputs.upload_url }}
release_version: ${{ env.RELEASE_VERSION }}
steps:
- name: Get the release version from the tag or input
shell: bash
if: env.RELEASE_VERSION == ''
run: |
if "${{ github.event.inputs.release_version }}" != ""; then
echo "RELEASE_VERSION=${{ github.event.inputs.release_version }}" >> $GITHUB_ENV
echo "version is: ${{ env.RELEASE_VERSION }}"
else
# See: https://github.jparrowsec.cnmunity/t5/GitHub-Actions/How-to-get-just-the-tag-name/m-p/32167/highlight/true#M1027
echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
echo "version is: ${{ env.RELEASE_VERSION }}"
fi
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Create GitHub release
id: release
if: github.event.inputs.create_release == 'true' || github.event_name == 'push'
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
draft: true
tag_name: ${{ env.RELEASE_VERSION || github.event.inputs.release_version}}
release_name: ${{ env.RELEASE_VERSION || github.event.inputs.release_version }}

build_release:
timeout-minutes: 60
name: Build release binaries
needs: create-release
runs-on: ${{ matrix.runner }}
continue-on-error: false
strategy:
Expand All @@ -34,26 +84,31 @@ jobs:
os: ubuntu-latest
release-os: linux
release-arch: aarch64
cargo_targets: "aarch64-unknown-linux-musl"
runner: [self-hosted, linux, ARM64]
- name: ubuntu-latest
os: ubuntu-latest
release-os: linux
release-arch: amd64
cargo_targets: "x86_64-unknown-linux-musl"
runner: [self-hosted, linux, X64]
- name: macOS-latest
os: macOS-latest
release-os: darwin
release-arch: x86_64
cargo_targets: "x86_64-apple-darwin"
runner: [self-hosted, macOS, X64]
- name: macOS-arm-latest
os: macOS-latest
release-os: darwin
release-arch: aarch64
cargo_targets: "aarch64-apple-darwin"
runner: [self-hosted, macOS, ARM64]
- name: windows-latest
os: windows-latest
release-os: windows
release-arch: amd64
cargo_targets: "x86_64-pc-windows-msvc"
runner: [self-hosted, windows, X64]
env:
# Using self-hosted runners so use local cache for sccache and
Expand All @@ -71,29 +126,52 @@ jobs:
run: |
echo "RELEASE_ARCH=${{ matrix.release-arch }}" >> $GITHUB_ENV
echo "RELEASE_OS=${{ matrix.release-os }}" >> $GITHUB_ENV
- name: Ensure musl support
if: ${{ contains(matrix.cargo_targets, '-musl') }}
run: sudo apt-get install musl-tools -y

- name: Install ${{ matrix.rust }}
- name: Install Rust
if: matrix.os != 'windows-latest'
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ matrix.rust }}
targets: ${{ matrix.cargo_targets }}

- name: Install Rust
if: matrix.os == 'windows-latest'
run: |
rustup toolchain install ${{ matrix.rust }}
rustup toolchain install stable
rustup target add ${{ matrix.cargo_targets }}
- name: build release
if: matrix.os != 'windows-latest'
shell: bash
run: |
cargo build --profile optimized-release --all-features
if [ "${{ matrix.name }}" = "ubuntu-arm-latest" ]; then
export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER=aarch64-linux-gnu-gcc
export CC=aarch64-linux-gnu-gcc
fi
cargo build --profile optimized-release --all-features --target ${{ matrix.cargo_targets }}
- name: build release
if: matrix.os == 'windows-latest'
run: cargo build --profile optimized-release --all-features --target ${{ matrix.cargo_targets }}

- name: attach artifacts
if: matrix.os != 'windows-latest'
uses: actions/upload-artifact@v4
with:
name: iroh-${{env.RELEASE_OS }}-${{env.RELEASE_ARCH}}
path: target/optimized-release/iroh
path: target/${{ matrix.cargo_targets }}/optimized-release/iroh
compression-level: 0

- name: attach artifacts
if: matrix.os == 'windows-latest'
uses: actions/upload-artifact@v4
with:
name: iroh-windows-amd64.exe
path: target/optimized-release/iroh.exe
path: target/${{ matrix.cargo_targets }}/optimized-release/iroh.exe
compression-level: 0

- name: Setup awscli on linux
Expand Down Expand Up @@ -126,11 +204,52 @@ jobs:
- name: push release
if: matrix.os != 'windows-latest'
run: |
aws s3 cp ./target/optimized-release/iroh s3://vorc/iroh-${RELEASE_OS}-${RELEASE_ARCH}-${GITHUB_SHA::7} --no-progress
aws s3 cp ./target/optimized-release/iroh-relay s3://vorc/derper-${RELEASE_OS}-${RELEASE_ARCH}-${GITHUB_SHA::7} --no-progress
aws s3 cp ./target/${{ matrix.cargo_targets }}/optimized-release/iroh s3://vorc/iroh-${RELEASE_OS}-${RELEASE_ARCH}-${GITHUB_SHA::7} --no-progress
aws s3 cp ./target/${{ matrix.cargo_targets }}/optimized-release/iroh-relay s3://vorc/iroh-relay-${RELEASE_OS}-${RELEASE_ARCH}-${GITHUB_SHA::7} --no-progress
aws s3 cp ./target/${{ matrix.cargo_targets }}/optimized-release/iroh-dns-server s3://vorc/iroh-dns-server-${RELEASE_OS}-${RELEASE_ARCH}-${GITHUB_SHA::7} --no-progress
- name: push release latest
if: matrix.os != 'windows-latest'
run: |
aws s3 cp ./target/optimized-release/iroh s3://vorc/iroh-${RELEASE_OS}-${RELEASE_ARCH}-latest --no-progress
aws s3 cp ./target/optimized-release/iroh-relay s3://vorc/derper-${RELEASE_OS}-${RELEASE_ARCH}-latest --no-progress
aws s3 cp ./target/${{ matrix.cargo_targets }}/optimized-release/iroh s3://vorc/iroh-${RELEASE_OS}-${RELEASE_ARCH}-latest --no-progress
aws s3 cp ./target/${{ matrix.cargo_targets }}/optimized-release/iroh-relay s3://vorc/iroh-relay-${RELEASE_OS}-${RELEASE_ARCH}-latest --no-progress
aws s3 cp ./target/${{ matrix.cargo_targets }}/optimized-release/iroh-dns-server s3://vorc/iroh-dns-server-${RELEASE_OS}-${RELEASE_ARCH}-latest --no-progress
- name: Build archives
if: matrix.os != 'windows-latest'
shell: bash
run: |
IFS=',' read -ra BIN_NAMES <<< "${{ env.BIN_NAMES }}"
ASSETS=""
for BIN_NAME in "${BIN_NAMES[@]}"; do
staging="$BIN_NAME-${{ needs.create-release.outputs.release_version }}-${{ matrix.cargo_targets }}"
mkdir -p "$staging"
cp "target/${{ matrix.cargo_targets }}/optimized-release/$BIN_NAME" "$staging/"
tar czf "$staging.tar.gz" -C "$staging" .
ASSETS+="$staging.tar.gz,"
done
echo "ASSET=$(echo $ASSETS | sed 's/,$//')" >> $GITHUB_ENV
- name: Build archives (windows)
if: matrix.os == 'windows-latest'
shell: pwsh
run: |
$BIN_NAMES = "${{ env.BIN_NAMES }}".Split(',')
$ASSETS = @()
foreach ($BIN_NAME in $BIN_NAMES) {
$staging = "$BIN_NAME-${{ needs.create-release.outputs.release_version }}-${{ matrix.cargo_targets }}"
New-Item -ItemType Directory -Force -Path "$staging"
Copy-Item -Path "target/${{ matrix.cargo_targets }}/optimized-release/$BIN_NAME.exe" -Destination "$staging/"
Set-Location -Path "$staging"
Compress-Archive -Path * -DestinationPath "../$staging.zip"
$ASSETS += "$staging.zip"
Set-Location -Path ..
}
$ASSETS = $ASSETS -join ','
Add-Content -Path $env:GITHUB_ENV -Value "ASSET=$ASSETS"
- uses: n0-computer/actions-upload-release-asset@main
if: (github.event.inputs.upload_artifacts == 'true' || github.event_name == 'push')
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: ${{ env.ASSET }}
4 changes: 2 additions & 2 deletions .github/workflows/test_relay_server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
- name: push release
run: |
aws s3 cp ./target/release/iroh-relay s3://vorc/derper-linux-amd64-${GITHUB_SHA::7} --no-progress
aws s3 cp ./target/release/iroh-relay s3://vorc/iroh-relay-linux-amd64-${GITHUB_SHA::7} --no-progress
- name: Set iroh-relay tag
id: set_tag
Expand All @@ -72,4 +72,4 @@ jobs:
key: ${{ secrets.TEST_DERPER_SSH_PKEY }}
inventory: ${{ secrets.TEST_DERPER_INVENTORY }}
known_hosts: ${{ secrets.TEST_DERPER_KNOWN_HOSTS }}
options: --extra-vars ansible_ssh_user=root --extra-vars derper_version=${{ needs.build_derper.outputs.set_tag.tag }}
options: --extra-vars ansible_ssh_user=root --extra-vars relay_version=${{ needs.build_relay_server.outputs.set_tag.tag }}
2 changes: 1 addition & 1 deletion .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ env:
RUSTFLAGS: -Dwarnings
RUSTDOCFLAGS: -Dwarnings
SCCACHE_CACHE_SIZE: "50G"
CRATES_LIST: "iroh,iroh-bytes,iroh-gossip,iroh-metrics,iroh-net,iroh-sync,iroh-test,iroh-cli"
CRATES_LIST: "iroh,iroh-bytes,iroh-gossip,iroh-metrics,iroh-net,iroh-sync,iroh-test,iroh-cli,iroh-dns-server"

jobs:
build_and_test_nix:
Expand Down
Loading

0 comments on commit 965a751

Please sign in to comment.