collectd-plugin 0.16.0

Provides ergonomic API ontop of collectd's C interface and macro for defining plugins easier
Documentation
name: ci
on:
  pull_request:
  push:
    branches:
    - master
  schedule:
  - cron: '00 01 * * *'

jobs:
  test:
    name: test
    runs-on: ${{ matrix.os }} 
    env:
      CARGO: cargo
      TARGET:
      FEATURES:
    strategy:
      fail-fast: false
      matrix:
        build:
        - stable
        - collectd-head
        - armv7-unknown-linux-gnueabihf
        - aarch64-unknown-linux-gnu
        - regen
        include:
        - build: stable
          os: 'ubuntu-latest'
        - build: collectd-head
          os: 'ubuntu-latest'
        - build: aarch64-unknown-linux-gnu
          os: 'ubuntu-latest'
          target: aarch64-unknown-linux-gnu
        - build: armv7-unknown-linux-gnueabihf
          os: 'ubuntu-latest'
          target: armv7-unknown-linux-gnueabihf
        - build: regen
          os: 'ubuntu-latest'
    steps:
    - name: Checkout repository
      uses: actions/checkout@v4
    - uses: dtolnay/rust-toolchain@stable
      with:
        components: rust-src

    - name: Use Cross
      if: matrix.target != ''
      run: |
        cargo install cross
        echo "CARGO=cross" >> $GITHUB_ENV
        echo "TARGET=--target ${{ matrix.target }}" >> $GITHUB_ENV
      
    - name: regenerate-bindings
      if: matrix.build == 'regen'
      run: ./regenerate-bindings.sh

    - name: collectd-head
      if: matrix.build == 'collectd-head'
      run: |
        git clone https://github.com/collectd/collectd /tmp/collectd
        echo "COLLECTD_PATH=/tmp/collectd" >> $GITHUB_ENV
        echo "FEATURES=--features bindgen" >> $GITHUB_ENV

    - name: build
      run: ${{ env.CARGO }} build --examples $FEATURES --verbose $TARGET
  
    - name: tests
      if: matrix.build != 'armv7-unknown-linux-gnueabihf' # layout tests fail
      run: ${{ env.CARGO }} test $FEATURES --verbose $TARGET

    - name: test benchmarks
      if: matrix.build == 'stable'
      run: |
        cargo bench --no-run --features stub

    - name: e2e test
      if: matrix.build == 'stable'
      run: |
        sudo apt-get install collectd openjdk-21-jre-headless- libvirt0-
        sudo ./ci/test.sh