From 8fb34901a7255da855ac62712bdb8ae501820721 Mon Sep 17 00:00:00 2001 From: Adam Greig Date: Tue, 22 Dec 2020 12:11:10 +0000 Subject: [PATCH] Add Github Actions for CI --- .github/workflows/clippy.yml | 25 ++++++++++++ .github/workflows/fuzz.yml | 21 ++++++++++ .github/workflows/test.yml | 79 ++++++++++++++++++++++++++++++++++++ README.md | 2 +- 4 files changed, 126 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/clippy.yml create mode 100644 .github/workflows/fuzz.yml create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/clippy.yml b/.github/workflows/clippy.yml new file mode 100644 index 0000000..d55d697 --- /dev/null +++ b/.github/workflows/clippy.yml @@ -0,0 +1,25 @@ +on: + push: + branches: [ staging, trying, master ] + pull_request_target: + +name: Clippy check +jobs: + clippy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + if: github.event_name == 'pull_request_target' + with: + ref: refs/pull/${{ github.event.number }}/head + - uses: actions/checkout@v2 + if: github.event_name != 'pull_request_target' + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true + components: clippy + - uses: actions-rs/clippy-check@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/fuzz.yml b/.github/workflows/fuzz.yml new file mode 100644 index 0000000..c09bb5d --- /dev/null +++ b/.github/workflows/fuzz.yml @@ -0,0 +1,21 @@ +on: + push: + branches: [ staging, trying, master ] + pull_request: + +name: Fuzz + +jobs: + fuzz: + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: nightly + override: true + - name: Install cargo-fuzz + run: cargo install cargo-fuzz + - name: Fuzz + run: cargo fuzz run packet_parser -- -max_len=1536 -max_total_time=30 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..a821187 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,79 @@ +on: + push: + branches: [ staging, trying, master ] + pull_request: + +name: Test + +jobs: + test: + runs-on: ubuntu-20.04 + continue-on-error: ${{ matrix.rust == 'nightly' }} + strategy: + matrix: + # Test on stable, MSRV 1.36, and nightly. + # Failure is permitted on nightly. + rust: + - stable + - 1.36.0 + - nightly + + features: + # Test default features. + - default + + # Test features chosen to be as orthogonal as possible. + - std ethernet phy-raw_socket proto-ipv6 socket-udp + - std ethernet phy-tap_interface proto-ipv6 socket-udp + - std ethernet proto-ipv4 proto-igmp socket-raw + - std ethernet proto-ipv4 socket-udp socket-tcp + - std ethernet proto-ipv4 proto-dhcpv4 socket-udp + - std ethernet proto-ipv6 socket-udp + - std ethernet proto-ipv6 socket-tcp + - std ethernet proto-ipv4 socket-icmp socket-tcp + - std ethernet proto-ipv6 socket-icmp socket-tcp + + # Test features chosen to be as aggressive as possible. + - std ethernet proto-ipv4 proto-ipv6 socket-raw socket-udp socket-tcp socket-icmp + + include: + # Test alloc feature which requires nightly. + - rust: nightly + features: alloc ethernet proto-ipv4 proto-ipv6 socket-raw socket-udp socket-tcp socket-icmp + - rust: nightly + features: alloc proto-ipv4 proto-ipv6 socket-raw socket-udp socket-tcp socket-icmp + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: ${{ matrix.rust }} + override: true + - name: Run Tests + run: cargo test --no-default-features --features "${{ matrix.features }}" + + check: + runs-on: ubuntu-20.04 + continue-on-error: ${{ matrix.rust == 'nightly' }} + strategy: + matrix: + # Test on stable, MSRV 1.36, and nightly. + # Failure is permitted on nightly. + rust: + - stable + - 1.36.0 + - nightly + + features: + # These feature sets cannot run tests, so we only check they build. + - ethernet proto-ipv6 proto-ipv6 proto-igmp proto-dhcpv4 socket-raw socket-udp socket-tcp socket-icmp + + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: ${{ matrix.rust }} + override: true + - name: Check + run: cargo check --no-default-features --features "${{ matrix.features }}" diff --git a/README.md b/README.md index bc2cecc..a240a15 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ include complicated compile-time computations, such as macro or type tricks, eve at cost of performance degradation. _smoltcp_ does not need heap allocation *at all*, is [extensively documented][docs], -and compiles on stable Rust 1.28 and later. +and compiles on stable Rust 1.36 and later. _smoltcp_ achieves [~Gbps of throughput](#examplesbenchmarkrs) when tested against the Linux TCP stack in loopback mode.