Skip to content

Fix cargo clippy

Fix cargo clippy #5085

Workflow file for this run

name: CI
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
on:
pull_request:
types: [opened, synchronize, reopened]
push:
tags: ["v[0-9]+.[0-9]+.[0-9]+*"]
jobs:
rust_lint:
strategy:
fail-fast: true
matrix:
include:
- rust_version: "stable"
- rust_version: "nightly"
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Install Rust ${{ matrix.rust_version }}
run: |
rustup override set ${{ matrix.rust_version }}
rustup update ${{ matrix.rust_version }}
rustup component add rustfmt clippy
- name: Check fmt
if: matrix.rust_version == 'stable'
run: cd rust && cargo fmt -- --check
- name: Check clippy
if: matrix.rust_version == 'nightly'
run: cd rust && cargo clippy -- -D warnings
- name: Check clippy gen_conf
if: matrix.rust_version == 'nightly'
run: |
cd rust && cargo clippy \
--no-default-features --features gen_conf \
-- -D warnings
- name: Check clippy query_apply
if: matrix.rust_version == 'nightly'
run: |
cd rust && cargo clippy \
--no-default-features --features query_apply \
-- -D warnings
rust_unit:
strategy:
fail-fast: true
matrix:
include:
- rust_version: "stable"
- rust_version: "nightly"
- rust_version: "beta"
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Install Rust ${{ matrix.rust_version }}
run: |
rustup override set ${{ matrix.rust_version }}
rustup update ${{ matrix.rust_version }}
- name: Install tools for tests
run: |
# Workaround for https://github.com/actions/runner-images/issues/9733
sudo rm /etc/apt/sources.list.d/microsoft-prod.list
sudo apt-get update;
sudo apt-get -y install valgrind
- name: Unit test
run: cd rust && cargo test -- --show-output
- name: C library test
run: make clib_check
rpm_build:
runs-on: ubuntu-22.04
strategy:
fail-fast: true
matrix:
include:
- os_type: "el9"
steps:
- uses: actions/checkout@v3
- name: build nmstate rpm
run: .github/workflows/build_rpm.sh ${{ matrix.os_type }}
- uses: actions/upload-artifact@v3
with:
name: rpms_${{ matrix.os_type }}
path: rpms/${{ matrix.os_type }}
retention-days: 5
py_lint:
runs-on: ubuntu-22.04
strategy:
fail-fast: true
matrix:
include:
- job_type: "c9s-nm_stable-format"
- job_type: "c9s-nm_stable-lint"
steps:
- uses: actions/checkout@v3
- name: Run tests
shell: bash
run: sudo .github/workflows/run_test.sh ${{ matrix.job_type }}
integ:
runs-on: ubuntu-22.04
needs: [rust_lint, py_lint, rpm_build]
strategy:
fail-fast: false
matrix:
include:
- job_type: "c9s-nm_stable-integ_tier1"
- job_type: "c9s-nm_stable-integ_tier2"
- job_type: "c9s-nm_stable-integ_slow"
- job_type: "c9s-nm_stable-rust_go"
- job_type: "c9s-nm_main-integ_tier1"
- job_type: "c9s-nm_main-integ_tier2"
- job_type: "c9s-nm_main-integ_slow"
- job_type: "c9s-nm_main-rust_go"
- job_type: "c9s-nm_1.42-integ_tier1"
- job_type: "c9s-nm_1.42-integ_tier2"
- job_type: "c9s-nm_1.42-integ_slow"
- job_type: "fed-nm_stable-integ_tier1"
steps:
- uses: actions/checkout@v3
- name: Enable openvswitch kernel module
run: sudo modprobe openvswitch
- name: Download compiled EL9 rpm
uses: actions/download-artifact@v3
with:
name: rpms_el9
path: rpms/el9
- name: Install extra kernel modules(e.g. vrf)
run: |
# Workaround for https://github.com/actions/runner-images/issues/9733
sudo rm /etc/apt/sources.list.d/microsoft-prod.list
sudo apt-get update;
sudo apt-get -y install "linux-modules-extra-$(uname -r)"
- name: Run tests
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
run: sudo .github/workflows/run_test.sh ${{ matrix.job_type }}
- uses: actions/upload-artifact@v3
with:
name: nmstate-test-junit-artifact-${{ matrix.job_type }}
path: junit.*xml
retention-days: 5
- name: Remove duplicated test state dumps
run: |
if [ -d tests/integration/.states/ ]; then
sudo chmod 777 -R tests/integration/.states/
sudo apt-get install -y fdupes
fdupes -d -N tests/integration/.states/
fi
- uses: actions/upload-artifact@v3
with:
name: nmstate-test-apply-show-dump-artifact-${{ matrix.job_type }}
path: tests/integration/.states/*
retention-days: 5
- name: Set artifacts permissions
if: ${{ failure() }}
run: sudo chmod 777 test_artifacts/*
- uses: actions/upload-artifact@v3
if: ${{ failure() }}
with:
name: nmstate-test-artifact-${{ matrix.job_type }}
path: test_artifacts/
retention-days: 5
build_on_rust_1_66:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Install Rust 1.66
run: rustup install 1.66
- name: Build on rust 1.66
run: cd rust && cargo +1.66 build --ignore-rust-version
macos_gen_conf_build:
strategy:
fail-fast: true
matrix:
include:
- rust_version: "stable"
- rust_version: "nightly"
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- name: Install Rust ${{ matrix.rust_version }}
run: |
rustup override set ${{ matrix.rust_version }}
rustup update ${{ matrix.rust_version }}
rustup component add rustfmt clippy
- name: Build gen_conf
run: |
cd rust && cargo build --no-default-features \
--features gen_conf