ClamAV GitHub Action

March 2024

In a previous post, I wrote about my goal to develop a well-tested ClamAV client using Rust. In addition to unit tests, testing a client often involves integration tests, either with mocked or real servers. For my Rust-based ClamAV client, I decided to run the integration tests against a lightweight ClamAV server.

Initially, starting clamd clamd is ClamAV’s background service. was hard-coded into my client’s GitHub workflow. However, having recently learned more about GitHub Actions on another project, I extracted it into a reusable GitHub Action and published it on GitHub’s Marketplace. With this action, you can now run a ClamAV server in the background of your own GitHub workflow.

By default, start-clamd-github-action only loads the bytecode.cvd CVD files, short for ClamAV Virus Database files, contain virus signatures used by ClamAV to detect viruses, malware, and other threats. signature file. Larger signature databases, such as daily.cvd and main.cvd, are not loaded. This setup significantly decreases clamd’s startup time and doesn’t put unnecessary load on ClamAV’s download mirrors.

Using start-clamd-github-action is as simple as adding another step to your workflow:

steps:
  - name: Checkout
    uses: actions/checkout@v4
  - name: Start ClamAV daemon
    uses: toblux/start-clamd-github-action@v0.1

It works on Linux, macOS, and Windows runners.

To customize how clamd operates, such as adjusting the socket or the TCP port it listens on, several configuration options (inputs) are already available. If you need additional inputs for your workflows, please don’t hesitate to submit an issue or a pull request.

See all posts