kqueue 1.2.1

kqueue interface for BSDs
Documentation
---
.macos_saas_runners:
  tags:
    - saas-macos-medium-m1
  image: macos-15-xcode-16
  before_script: |
    if [[ "$(uname -s)" == "Darwin" ]]; then
      asdf plugin remove rust
      brew install rustup
      export PATH="$(brew --prefix rustup)/bin:${HOME}/.cargo/bin:${PATH}"
      rustup default nightly
      curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
      cargo binstall cargo-nextest cargo-llvm-cov
    fi
  variables:
    HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1
    HOMEBREW_NO_AUTO_UPDATE: 1
    HOMEBREW_NO_INSTALL_CLEANUP: 1
    HOMEBREW_NO_ANALYTICS: 1

stages:
  - build
  - test
  - perf

workflow:
  rules:
    - if: $CI_PIPELINE_SOURCE == "merge_request_event"
    - if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS
      when: never
    - if: $CI_COMMIT_BRANCH

.test:cargo:
  stage: test
  coverage: '/TOTAL\s+(\d+\s+)+(\d+\.\d+\%)/'
  script:
    - ./ci/build.sh
  after_script:
    - ./ci/post.sh
  variables:
    RUST_BACKTRACE: full
    CARGO_INCREMENTAL: 0
  artifacts:
    reports:
      junit: target/nextest/default/junit.xml
      coverage_report:
        coverage_format: cobertura
        path: target/llvm-cov-target/cobertura.xml
    expire_in: 1 month
  cache:
    key: deps
    paths:
      - target/

test:gitlab:macos:
  extends:
    - .macos_saas_runners
    - .test:cargo

include: .dalligi.yml
test:srht:openbsd:79:
  extends: .dalligi
  artifacts: &test_artifacts
    reports:
      junit: rust-kqueue/target/nextest/default/junit.xml
      coverage_report:
        coverage_format: cobertura
        path: rust-kqueue/target/llvm-cov-target/cobertura.xml
    expire_in: 1 month
test:srht:netbsd:10:
  extends: .dalligi
  artifacts: *test_artifacts
test:srht:freebsd:14:
  extends: .dalligi
  coverage: '/TOTAL\s+(\d+\s+)+(\d+\.\d+\%)/'
  artifacts: *test_artifacts
test:srht:freebsd:15:
  extends: .dalligi
  coverage: '/TOTAL\s+(\d+\s+)+(\d+\.\d+\%)/'
  artifacts: *test_artifacts
test:srht:freebsd:16:
  extends: .dalligi
  coverage: '/TOTAL\s+(\d+\s+)+(\d+\.\d+\%)/'
  artifacts: *test_artifacts

cross:cargo:
  image: rust:1.96
  stage: build
  tags:
    - gitlab-org-docker
  parallel:
    matrix:
      - TARGET: x86_64-unknown-netbsd
      - TARGET: x86_64-unknown-freebsd
      - TARGET: i686-unknown-freebsd
      - TARGET: aarch64-apple-darwin
      - TARGET: x86_64-apple-darwin
      - TARGET: aarch64-apple-ios
      - TARGET: x86_64-apple-ios
  before_script:
    - wget -nv -O /etc/apt/keyrings/githubcli-archive-keyring.gpg https://cli.github.com/packages/githubcli-archive-keyring.gpg
    - chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg
    - echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" > /etc/apt/sources.list.d/github-cli.list
    - apt update
    - apt install -y gh minisign
    - rustup component add clippy rustfmt
    - rustup target add $TARGET
    - gh release download -R cargo-bins/cargo-binstall -p cargo-binstall-x86_64-unknown-linux-gnu.tgz\* -p minisign.pub
    - minisign -V -x cargo-binstall-x86_64-unknown-linux-gnu.tgz.sig -m cargo-binstall-x86_64-unknown-linux-gnu.tgz
    - tar xzf cargo-binstall-x86_64-unknown-linux-gnu.tgz -C /usr/local/cargo/bin/
    - cargo binstall cargo-semver-checks cargo-sonar gitlab-cargo-audit
    - gh attestation verify /usr/local/cargo/bin/gitlab-cargo-audit -R dcoles/gitlab-cargo-audit
  script:
    - rustc --version && cargo --version  # Print version info for debugging
    - cargo fmt --check
    - cargo build --target $TARGET
    - cargo clippy --target $TARGET --message-format=json --all-targets --all-features
        -- -D warnings
        > clippy.json
    - cargo semver-checks --target $TARGET
  after_script:
    - cargo codeclimate --clippy --codeclimate-path gl-code-quality-report.json
    - gitlab-cargo-audit --output-path gl-dep-report.json
  artifacts:
    reports:
      codequality: gl-code-quality-report.json
      dependency_scanning: gl-dep-report.json
    expire_in: 1 month
  cache:
    key: deps-$TARGET-cross
    paths:
      - target/

perf:criterion:
  rules:
    - if: $CI_PIPELINE_SOURCE == "merge_request_event"
      changes:
        - "src/**.rs"
  stage: perf
  tags:
    - $OS
  script:
    - rustc --version && cargo --version  # Print version info for debugging
    - rm -rf target/criterion
    - echo -e "\e[0Ksection_start:`date +%s`:main_build\r\e[0KRunning benchmarks on main for baseline"
    - git checkout "origin/${CI_DEFAULT_BRANCH}"
    - cargo bench
    - echo -e "\e[0Ksection_end:`date +%s`:main_build\r\e[0K"
    - echo -e "\e[0Ksection_start:`date +%s`:mr_build\r\e[0KRunning benchmarks on MR for perf diff"
    - git checkout "origin/${CI_MERGE_REQUEST_SOURCE_BRANCH_NAME}"
    - cargo bench
    - echo -e "\e[0Ksection_end:`date +%s`:mr_build\r\e[0K"
  variables:
    RUST_BACKTRACE: full
    CARGO_INCREMENTAL: 0
  parallel:
    matrix:
      - OS:
        - freebsd
  artifacts:
    name: criterion-report
    paths:
      - target/criterion
  cache:
    key: perf
    paths:
      - target/