Skip to content

rust: Migrate zbus v1 to V5 #5759

rust: Migrate zbus v1 to V5

rust: Migrate zbus v1 to V5 #5759

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@v4
- 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@v4
- 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: Disable MPTCP
# Nmstate query will fail due to permission deny when MPTCP is enabled
# due to kernel limitation(bug),
# once https://github.com/nispor/nispor/pull/276 is released, we
# can remove this workaround
run: |
sudo sysctl -w net.mptcp.enabled=0
- name: Unit test
run: cd rust && cargo test -- --show-output
- name: C library test
# As https://github.com/tokio-rs/tokio/issues/6889 mentioned
# rust nightly might lead to valgrind warnings, this project
# has no intention to spend time on testing rust nightly for memory leak.
if: matrix.rust_version == 'stable'
run: make clib_check
rpm_build:
runs-on: ubuntu-22.04
strategy:
fail-fast: true
matrix:
include:
- os_type: "el9"
steps:
- uses: actions/checkout@v4
- name: build nmstate rpm
run: .github/workflows/build_rpm.sh ${{ matrix.os_type }}
- uses: actions/upload-artifact@v4
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@v4
- 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_main-integ_tier1"
- job_type: "c10s-nm_stable-integ_tier1"
steps:
- uses: actions/checkout@v4
- name: Enable openvswitch kernel module
run: sudo modprobe openvswitch
- name: Download compiled EL9 rpm
uses: actions/download-artifact@v4
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@v4
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@v4
with:
name: nmstate-test-apply-show-dump-artifact-${{ matrix.job_type }}
path: tests/integration/.states/*
retention-days: 5
include-hidden-files: true
- name: Set artifacts permissions
if: ${{ failure() }}
run: sudo chmod 777 test_artifacts/*
- uses: actions/upload-artifact@v4
if: ${{ failure() }}
with:
name: nmstate-test-artifact-${{ matrix.job_type }}
path: test_artifacts/
retention-days: 5
macos_gen_conf_build:
strategy:
fail-fast: true
matrix:
include:
- rust_version: "stable"
- rust_version: "nightly"
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- 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