Skip to content
This repository has been archived by the owner on Dec 18, 2023. It is now read-only.

chore: Migrate iroh-bitswap to libp2p 0.53 #30

chore: Migrate iroh-bitswap to libp2p 0.53

chore: Migrate iroh-bitswap to libp2p 0.53 #30

Workflow file for this run

name: Continuous integration
on:
pull_request:
push:
branches:
- main
jobs:
build_and_test:
name: Build and test
runs-on: ${{ matrix.runner }}
continue-on-error: false
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macOS-latest]
rust: [stable]
experimental: [false]
include:
- os: ubuntu-latest
release-os: linux
release-arch: amd64
protoc-arch: linux-x86_64
runner: [self-hosted, linux, X64]
- os: macos-latest
release-os: darwin
release-arch: aarch64
protoc-arch: osx-aarch_64
runner: [self-hosted, macOS, ARM64]
# - os: windows-latest
# release-os: windows
# release-arch: amd64
# runner: [self-hosted, windows, X64]
env:
RUST_BACKTRACE: full
# Force not building debuginfo to save space on disk.
RUSTFLAGS: "-C debuginfo=0"
RUSTV: ${{ matrix.rust }}
MSRV: "1.65"
steps:
- uses: actions/checkout@master
- name: Set build arch
run: |
echo "PROTOC_ARCH=${{ matrix.protoc-arch }}" >> $GITHUB_ENV
- name: Install ${{ matrix.rust }}
run: |
rustup toolchain install --profile default ${{ matrix.rust }}
- name: Install Rust MSRV
if: matrix.os != 'windows-latest'
run: |
rustup toolchain install --profile minimal $MSRV
- name: Install Rust MSRV
if: matrix.os == 'windows-latest'
run: |
rustup toolchain install --profile minimal $Env:MSRV
- name: Install Protoc windows
if: matrix.os == 'windows-latest'
uses: arduino/setup-protoc@v1
with:
version: '3.20.1'
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Install Protoc
if: matrix.os != 'windows-latest'
run: |
PROTOC_VERSION=3.20.1
PROTOC_ZIP=protoc-$PROTOC_VERSION-$PROTOC_ARCH.zip
curl --retry 3 --retry-max-time 90 -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" -OL https://github.com/protocolbuffers/protobuf/releases/download/v$PROTOC_VERSION/$PROTOC_ZIP
sudo unzip -o $PROTOC_ZIP -d /usr/local bin/protoc
sudo unzip -o $PROTOC_ZIP -d /usr/local 'include/*'
rm -f $PROTOC_ZIP
echo "PROTOC=/usr/local/bin/protoc" >> $GITHUB_ENV
echo "PROTOC_INCLUDE=/usr/local/include" >> $GITHUB_ENV
- name: check MSRV default features
if: matrix.os != 'windows-latest'
run: |
cargo +$MSRV check --workspace --all-targets
- name: check MSRV all features
if: matrix.os != 'windows-latest'
run: |
cargo +$MSRV check --workspace --all-features --all-targets
- name: check MSRV default features
if: matrix.os == 'windows-latest'
run: |
cargo +$Env:MSRV check --workspace --all-targets
- name: check MSRV all features
if: matrix.os == 'windows-latest'
run: |
cargo +$Env:MSRV check --workspace --all-features --all-targets
- name: check default features
run: |
cargo check --workspace --all-targets
- name: check all features
run: |
cargo check --workspace --all-features --all-targets
- name: clippy default features
run: |
cargo clippy --workspace --all-targets -- -D warnings
- name: clippy all features
run: |
cargo clippy --workspace --all-features --all-targets -- -D warnings
- name: docs
env:
RUSTDOCFLAGS: -Dwarnings
run: |
cargo doc --workspace --all-features --no-deps --document-private-items
- name: tests
timeout-minutes: 30
run: |
cargo test --workspace --all-features --lib --bins --tests --examples
- name: tests w/o default features
timeout-minutes: 30
run: |
cargo test --workspace --no-default-features --lib --bins --tests --examples
# build_release:
# name: Build release binaries
# runs-on: ${{ matrix.runner }}
# continue-on-error: false
# needs: build_and_test
# if: ${{ always() && github.ref_name=='main' }}
# strategy:
# fail-fast: false
# matrix:
# name: [ubuntu-latest, ubuntu-arm-latest, macOS-latest, macOS-arm-latest]
# rust: [stable]
# experimental: [false]
# include:
# - name: ubuntu-arm-latest
# os: ubuntu-latest
# release-os: linux
# release-arch: aarch64
# protoc-arch: linux-aarch_64
# runner: [self-hosted, linux, ARM64]
# - name: ubuntu-latest
# os: ubuntu-latest
# release-os: linux
# release-arch: amd64
# protoc-arch: linux-x86_64
# runner: [self-hosted, linux, X64]
# - name: macOS-latest
# os: macOS-latest
# release-os: darwin
# release-arch: x86_64
# protoc-arch: osx-x86_64
# runner: [self-hosted, macOS, X64]
# - name: macOS-arm-latest
# os: macOS-latest
# release-os: darwin
# release-arch: aarch64
# protoc-arch: osx-aarch_64
# runner: [self-hosted, macOS, ARM64]
# # - os: windows-latest
# # release-os: windows
# # release-arch: amd64
# # runner: [windows-latest]
# env:
# RUST_BACKTRACE: full
# # Force not building debuginfo to save space on disk.
# RUSTFLAGS: "-C debuginfo=0"
# RUSTV: ${{ matrix.rust }}
# steps:
# - uses: actions/checkout@master
# - name: Set build arch
# run: |
# echo "RELEASE_ARCH=${{ matrix.release-arch }}" >> $GITHUB_ENV
# echo "RELEASE_OS=${{ matrix.release-os }}" >> $GITHUB_ENV
# echo "PROTOC_ARCH=${{ matrix.protoc-arch }}" >> $GITHUB_ENV
# - name: Install ${{ matrix.rust }}
# run: |
# rustup toolchain install ${{ matrix.rust }}
# - name: Install Protoc windows
# if: matrix.os == 'windows-latest'
# uses: arduino/setup-protoc@v1
# with:
# version: '3.20.1'
# repo-token: ${{ secrets.GITHUB_TOKEN }}
# - name: Install Protoc
# if: matrix.os != 'windows-latest'
# run: |
# PROTOC_VERSION=3.20.1
# PROTOC_ZIP=protoc-$PROTOC_VERSION-$PROTOC_ARCH.zip
# curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v$PROTOC_VERSION/$PROTOC_ZIP
# sudo unzip -o $PROTOC_ZIP -d /usr/local bin/protoc
# sudo unzip -o $PROTOC_ZIP -d /usr/local 'include/*'
# rm -f $PROTOC_ZIP
# echo "PROTOC=/usr/local/bin/protoc" >> $GITHUB_ENV
# echo "PROTOC_INCLUDE=/usr/local/include" >> $GITHUB_ENV
# - name: build release
# run: |
# cargo build --profile optimized-release -p iroh -p iroh-gateway -p iroh-p2p -p iroh-store -p iroh-one
# - name: Setup awscli on linux
# if: matrix.name == 'ubuntu-latest'
# run: |
# curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
# unzip awscliv2.zip
# sudo ./aws/install --update
# - name: Setup awscli on linux
# if: matrix.name == 'ubuntu-arm-latest'
# run: |
# curl "https://awscli.amazonaws.com/awscli-exe-linux-aarch64.zip" -o "awscliv2.zip"
# unzip awscliv2.zip
# sudo ./aws/install --update
# - name: Setup awscli on mac
# if: matrix.os == 'macos-latest'
# run: |
# curl "https://awscli.amazonaws.com/AWSCLIV2.pkg" -o "AWSCLIV2.pkg"
# sudo installer -pkg AWSCLIV2.pkg -target /
# - name: Set aws credentials
# if: matrix.os != 'windows-latest'
# run: |
# echo "AWS_ACCESS_KEY_ID=${{secrets.S3_ACCESS_KEY_ID}}" >> $GITHUB_ENV
# echo "AWS_SECRET_ACCESS_KEY=${{secrets.S3_ACCESS_KEY}}" >> $GITHUB_ENV
# echo "AWS_DEFAULT_REGION=us-west-2" >> $GITHUB_ENV
# - name: push release
# if: matrix.os != 'windows-latest'
# run: |
# aws s3 cp ./target/optimized-release/iroh-gateway s3://vorc/iroh-gateway-${RELEASE_OS}-${RELEASE_ARCH}-${GITHUB_SHA::7} --no-progress
# aws s3 cp ./target/optimized-release/iroh-p2p s3://vorc/iroh-p2p-${RELEASE_OS}-${RELEASE_ARCH}-${GITHUB_SHA::7} --no-progress
# aws s3 cp ./target/optimized-release/iroh-store s3://vorc/iroh-store-${RELEASE_OS}-${RELEASE_ARCH}-${GITHUB_SHA::7} --no-progress
# 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-one s3://vorc/iroh-one-${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-gateway s3://vorc/iroh-gateway-${RELEASE_OS}-${RELEASE_ARCH}-latest --no-progress
# aws s3 cp ./target/optimized-release/iroh-p2p s3://vorc/iroh-p2p-${RELEASE_OS}-${RELEASE_ARCH}-latest --no-progress
# aws s3 cp ./target/optimized-release/iroh-store s3://vorc/iroh-store-${RELEASE_OS}-${RELEASE_ARCH}-latest --no-progress
# aws s3 cp ./target/optimized-release/iroh s3://vorc/iroh-${RELEASE_OS}-${RELEASE_ARCH}-latest --no-progress
# aws s3 cp ./target/optimized-release/iroh-one s3://vorc/iroh-one-${RELEASE_OS}-${RELEASE_ARCH}-latest --no-progress
coverage:
name: Coverage
runs-on: ${{ matrix.runner }}
continue-on-error: false
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
rust: [stable]
experimental: [false]
include:
- os: ubuntu-latest
release-os: linux
release-arch: amd64
protoc-arch: linux-x86_64
runner: [self-hosted, linux, X64]
env:
RUST_BACKTRACE: full
RUSTV: ${{ matrix.rust }}
steps:
- uses: actions/checkout@master
- name: Set build arch
run: |
echo "PROTOC_ARCH=${{ matrix.protoc-arch }}" >> $GITHUB_ENV
- name: Install ${{ matrix.rust }}
run: |
rustup toolchain install --profile default ${{ matrix.rust }}
rustup component add llvm-tools-preview
- name: Install Protoc
run: |
PROTOC_VERSION=3.20.1
PROTOC_ZIP=protoc-$PROTOC_VERSION-$PROTOC_ARCH.zip
curl --retry 3 --retry-max-time 90 -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" -OL https://github.com/protocolbuffers/protobuf/releases/download/v$PROTOC_VERSION/$PROTOC_ZIP
sudo unzip -o $PROTOC_ZIP -d /usr/local bin/protoc
sudo unzip -o $PROTOC_ZIP -d /usr/local 'include/*'
rm -f $PROTOC_ZIP
echo "PROTOC=/usr/local/bin/protoc" >> $GITHUB_ENV
echo "PROTOC_INCLUDE=/usr/local/include" >> $GITHUB_ENV
- name: Install grcov
run: |
mkdir -p "${HOME}/.local/bin"
curl -sL https://github.com/mozilla/grcov/releases/download/v0.8.10/grcov-x86_64-unknown-linux-gnu.tar.bz2 | tar jxf - -C "${HOME}/.local/bin"
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: coverage
timeout-minutes: 30
run: |
cargo xtask coverage
- name: Upload to codecov.io
uses: codecov/codecov-action@v3
with:
files: coverage/*.lcov
fmt:
name: Rustfmt
runs-on: ubuntu-latest
strategy:
matrix:
rust:
- stable
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
override: true
- run: rustup component add rustfmt
- uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
audit:
name: audit
runs-on: ubuntu-latest
strategy:
matrix:
rust:
- stable
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
override: true
- uses: actions-rs/cargo@v1
with:
command: install
args: --force cargo-audit
- uses: actions-rs/cargo@v1
with:
command: generate-lockfile
- uses: actions-rs/cargo@v1
with:
command: audit