Skip to content

Commit

Permalink
Merge branch 'main' into remove-sync-peers-on-remove-replica
Browse files Browse the repository at this point in the history
  • Loading branch information
dignifiedquire authored Jan 18, 2024
2 parents dda490c + db41c5e commit fe83af9
Show file tree
Hide file tree
Showing 22 changed files with 1,032 additions and 709 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/beta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Run tests using the beta Rust compiler

name: Beta Rust

on:
schedule:
# 06:50 UTC every Monday
- cron: '50 6 * * 1'
workflow_dispatch:

concurrency:
group: beta-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
tests:
uses: './.github/workflows/tests.yaml'
with:
rust-version: beta
notify:
needs: tests
if: ${{ always() }}
runs-on: ubuntu-latest
steps:
- name: Extract test results
run: |
printf '${{ toJSON(needs) }}\n'
result=$(echo '${{ toJSON(needs) }}' | jq -r .tests.result)
echo TESTS_RESULT=$result
echo "TESTS_RESULT=$result" >>"$GITHUB_ENV"
- name: Notify discord on failure
uses: n0-computer/discord-webhook-notify@v1
if: ${{ env.TESTS_RESULT == 'failure' }}
with:
severity: error
details: |
Rustc beta tests failed
See https://github.com/n0-computer/iroh/actions/workflows/beta.yaml
webhookUrl: ${{ secrets.DISCORD_N0_GITHUB_CHANNEL_WEBHOOK_URL }}

169 changes: 9 additions & 160 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ name: CI

on:
pull_request:
types: [ 'labeled', 'unlabeled', 'opened', 'synchronize', 'reopened' ]
merge_group:
push:
branches:
- main

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
group: ci-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

env:
Expand All @@ -20,163 +21,13 @@ env:
SCCACHE_CACHE_SIZE: "50G"

jobs:
build_and_test_nix:
timeout-minutes: 30
name: "Tests"
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
name: [ubuntu-latest, macOS-arm-latest]
rust: [nightly, stable]
features: [all, none, default]
include:
- name: ubuntu-latest
os: ubuntu-latest
release-os: linux
release-arch: amd64
runner: [self-hosted, linux, X64]
- name: macOS-arm-latest
os: macOS-latest
release-os: darwin
release-arch: aarch64
runner: [self-hosted, macOS, ARM64]
env:
# Using self-hosted runners so use local cache for sccache and
# not SCCACHE_GHA_ENABLED.
RUSTC_WRAPPER: "sccache"
steps:
- name: Checkout
uses: actions/checkout@master
with:
submodules: recursive

- name: Install ${{ matrix.rust }}
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}

- name: Install cargo-nextest
uses: taiki-e/install-action@v2
with:
tool: nextest

- name: Install sccache
uses: mozilla-actions/[email protected]

- name: Select features
run: |
case "${{ matrix.features }}" in
all)
echo "FEATURES=--all-features" >> "$GITHUB_ENV"
;;
none)
echo "FEATURES=--no-default-features" >> "$GITHUB_ENV"
;;
default)
echo "FEATURES=" >> "$GITHUB_ENV"
;;
*)
exit 1
esac
- name: check features
run: |
for i in ${CRATES_LIST//,/ }
do
echo "Checking $i $FEATURES"
cargo check -p $i $FEATURES --lib --bins
done
env:
RUST_LOG: ${{ runner.debug && 'DEBUG' || 'INFO'}}

- name: tests
run: |
cargo nextest run --workspace ${{ env.FEATURES }} --lib --bins --tests
env:
RUST_LOG: "TRACE"

- name: doctests
if: ${{ matrix.features == 'all' }}
run: |
if [ -n "${{ runner.debug }}" ]; then
export RUST_LOG=DEBUG
fi
cargo test --workspace --all-features --doc
build_and_test_windows:
timeout-minutes: 30
name: "Tests"
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
name: [windows-latest]
rust: [nightly, stable]
features: [all, none, default]
target:
- x86_64-pc-windows-msvc
include:
- name: windows-latest
os: windows
runner: [self-hosted, windows, x64]
env:
# Using self-hosted runners so use local cache for sccache and
# not SCCACHE_GHA_ENABLED.
RUSTC_WRAPPER: "sccache"
steps:
- name: Checkout
uses: actions/checkout@master
with:
submodules: recursive

- name: Install ${{ matrix.rust }}
run: |
rustup toolchain install ${{ matrix.rust }}
rustup toolchain default ${{ matrix.rust }}
rustup target add ${{ matrix.target }}
rustup set default-host ${{ matrix.target }}
- name: Install cargo-nextest
shell: powershell
run: |
$tmp = New-TemporaryFile | Rename-Item -NewName { $_ -replace 'tmp$', 'zip' } -PassThru
Invoke-WebRequest -OutFile $tmp https://get.nexte.st/latest/windows
$outputDir = if ($Env:CARGO_HOME) { Join-Path $Env:CARGO_HOME "bin" } else { "~/.cargo/bin" }
$tmp | Expand-Archive -DestinationPath $outputDir -Force
$tmp | Remove-Item
- name: Select features
run: |
switch ("${{ matrix.features }}") {
"all" {
echo "FEATURES=--all-features" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
}
"none" {
echo "FEATURES=--no-default-features" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
}
"default" {
echo "FEATURES=" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
}
default {
Exit 1
}
}
# TODO: disabled while we do not have Powershell 7+ on the runner
# as default shell. See https://github.com/actions/toolkit/issues/1179
- name: Install sccache
uses: mozilla-actions/[email protected]

- uses: msys2/setup-msys2@v2

- name: tests
run: |
cargo nextest run --workspace ${{ env.FEATURES }} --lib --bins --tests --target ${{ matrix.target }}
env:
RUST_LOG: "TRACE"
tests:
name: CI Test Suite
if: "github.event_name != 'pull_request' || ! contains(github.event.pull_request.labels.*.name, 'flaky-test')"
uses: './.github/workflows/tests.yaml'

cross:
if: "github.event_name != 'pull_request' || ! contains(github.event.pull_request.labels.*.name, 'flaky-test')"
timeout-minutes: 30
name: Cross compile
runs-on: [self-hosted, linux, X64]
Expand Down Expand Up @@ -274,6 +125,7 @@ jobs:
run: cargo clippy --workspace --all-targets

msrv:
if: "github.event_name != 'pull_request' || ! contains(github.event.pull_request.labels.*.name, 'flaky-test')"
timeout-minutes: 30
name: Minimal Supported Rust Version
runs-on: ubuntu-latest
Expand Down Expand Up @@ -305,6 +157,7 @@ jobs:
command-arguments: "-Dwarnings"

netsim-integration-tests:
if: "github.event_name != 'pull_request' || ! contains(github.event.pull_request.labels.*.name, 'flaky-test')"
timeout-minutes: 30
name: Run network simulations/benchmarks
runs-on: [self-hosted, linux, X64]
Expand Down Expand Up @@ -399,10 +252,6 @@ jobs:
tar cvzf report.tar.gz report_prom.txt report_metro.txt report_metro_integration.txt logs/ report/ viz/
aws s3 cp ./report.tar.gz s3://${{secrets.S3_REPORT_BUCKET}}/$aws_fname --no-progress
link_data='dump{fname="'$aws_fname'",commit="'${{ env.LAST_COMMIT_SHA }}'",branch="'${{ env.HEAD_REF }}'"} 1.0'
link_data=$(printf "%s\n " "$link_data")
curl -X POST -H "Content-Type: text/plain" --data "$link_data" ${{secrets.PROM_ENDPOINT}}/metrics/job/netsim/instance/${instance}
- name: Echo metrics
run: |
cd ../chuck/netsim
Expand Down
46 changes: 46 additions & 0 deletions .github/workflows/flaky.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Run all tests, including flaky test.
#
# The default CI workflow ignores flaky tests. This workflow will run
# all tests, including ignored ones.
#
# To use this workflow you can either:
#
# - Label a PR with "flaky-test", the normal CI workflow will not run
# any jobs but the jobs here will be run. Note that to merge the PR
# you'll need to remove the label eventually because the normal CI
# jobs are required by branch protection.
#
# - Manually trigger the workflow, you may choose a branch for this to
# run on.
#
# Additionally this jobs runs once a day on a schedule.
#
# Currently doctests are not run by this workflow.

name: Flaky CI

on:
pull_request:
types: [ 'labeled', 'unlabeled', 'opened', 'synchronize', 'reopened' ]
schedule:
# 06:30 UTC every day
- cron: '30 6 * * *'
workflow_dispatch:
inputs:
branch:
description: 'Branch to run on, defaults to main'
required: true
default: 'main'
type: string

concurrency:
group: flaky-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
tests:
if: "contains(github.event.pull_request.labels.*.name, 'flaky-test') || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule'"
uses: './.github/workflows/tests.yaml'
with:
flaky: true
git-ref: ${{ inputs.branch }}
9 changes: 0 additions & 9 deletions .github/workflows/netsim.yml
Original file line number Diff line number Diff line change
Expand Up @@ -215,15 +215,6 @@ jobs:
tar cvzf report.tar.gz report_prom.txt report.txt report_metro.txt report_metro_integration.txt logs/ report/ viz/
aws s3 cp ./report.tar.gz s3://${{secrets.S3_REPORT_BUCKET}}/$aws_fname --no-progress
instance=$(echo "${{ env.HEAD_REF }}" | tr -c '[:alnum:]' '_')
d=$(cat report_prom.txt)
prom_data=$(printf "%s\n " "$d")
curl -X POST -H "Content-Type: text/plain" --data "$prom_data" ${{secrets.PROM_ENDPOINT}}/metrics/job/netsim/instance/${instance}
link_data='dump{fname="'$aws_fname'",commit="'${{ env.LAST_COMMIT_SHA }}'",branch="'${{ env.HEAD_REF }}'"} 1.0'
link_data=$(printf "%s\n " "$link_data")
curl -X POST -H "Content-Type: text/plain" --data "$link_data" ${{secrets.PROM_ENDPOINT}}/metrics/job/netsim/instance/${instance}
- name: Post metrics
if: github.ref_name=='main' && github.event_name != 'issue_comment'
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
- "v*"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
group: release-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
Expand Down Expand Up @@ -116,7 +116,7 @@ jobs:
aws s3 cp ./target/optimized-release/derper s3://vorc/derper-${RELEASE_OS}-${RELEASE_ARCH}-${GITHUB_SHA::7} --no-progress
- name: push release latest
if: matrix.os != 'windows-latest' && github.ref_name=='main'
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/derper s3://vorc/derper-${RELEASE_OS}-${RELEASE_ARCH}-latest --no-progress
9 changes: 0 additions & 9 deletions .github/workflows/test.sh

This file was deleted.

9 changes: 7 additions & 2 deletions .github/workflows/test_derper.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- cron: '0 4 * * *'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
group: derper-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
Expand Down Expand Up @@ -52,6 +52,11 @@ jobs:
run: |
aws s3 cp ./target/release/derper s3://vorc/derper-linux-amd64-${GITHUB_SHA::7} --no-progress
- name: Set derper tag
id: set_tag
run: |
echo ::set-output name=tag::${GITHUB_SHA::7}

deploy_derper:
runs-on: ubuntu-latest
Expand All @@ -67,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=${GITHUB_SHA::7}
options: --extra-vars ansible_ssh_user=root --extra-vars derper_version=${{ needs.build_derper.outputs.set_tag.tag }}
Loading

0 comments on commit fe83af9

Please sign in to comment.