Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
188 changes: 188 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,188 @@
name: Build and Test

permissions:
contents: read

on:
pull_request:
branches:
- main
workflow_dispatch:

env:
CLAMAV_VERSION: 1.5.2

jobs:
linux:
name: Linux (${{ matrix.mode }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
mode:
- pkg-config
- manual

steps:
- uses: actions/checkout@v4

- name: Install Rust
run: rustup update stable --no-self-update && rustup default stable

- name: Install Linux build dependencies
shell: bash
run: |
sudo apt-get update
sudo apt-get install -y pkg-config libssl-dev

- name: Install ClamAV release package
shell: bash
run: |
wget "https://github.com/Cisco-Talos/clamav/releases/download/clamav-${CLAMAV_VERSION}/clamav-${CLAMAV_VERSION}.linux.x86_64.deb"
sudo dpkg -i "clamav-${CLAMAV_VERSION}.linux.x86_64.deb"

- name: Build and test with pkg-config
if: matrix.mode == 'pkg-config'
shell: bash
env:
LD_LIBRARY_PATH: /usr/local/lib
run: cargo test -- --test-threads=1

- name: Build and test with manual library paths
if: matrix.mode == 'manual'
shell: bash
env:
CLAMAV_LIBRARY: /usr/local/lib/libclamav.so
CLAMAV_INCLUDE: /usr/local/include
OPENSSL_INCLUDE: /usr/include
LD_LIBRARY_PATH: /usr/local/lib
run: cargo test -- --test-threads=1

macos:
name: macOS
runs-on: macos-latest

steps:
- uses: actions/checkout@v4

- name: Install Rust
run: rustup update stable --no-self-update && rustup default stable

- name: Install Homebrew dependencies
shell: bash
run: |
brew update
brew install clamav openssl@3 pkg-config

- name: Build and test
shell: bash
env:
OPENSSL_INCLUDE: ${{ runner.temp }}/openssl-include
PKG_CONFIG_PATH: /opt/homebrew/lib/pkgconfig:/opt/homebrew/opt/clamav/lib/pkgconfig:/opt/homebrew/opt/openssl@3/lib/pkgconfig:/usr/local/lib/pkgconfig:/usr/local/opt/clamav/lib/pkgconfig:/usr/local/opt/openssl@3/lib/pkgconfig
DYLD_LIBRARY_PATH: /opt/homebrew/lib:/opt/homebrew/opt/clamav/lib:/opt/homebrew/opt/openssl@3/lib:/usr/local/lib:/usr/local/opt/clamav/lib:/usr/local/opt/openssl@3/lib
run: |
OPENSSL_PREFIX="$(brew --prefix openssl@3)"
mkdir -p "$OPENSSL_INCLUDE"
rm -rf "$OPENSSL_INCLUDE"
ln -s "$OPENSSL_PREFIX/include" "$OPENSSL_INCLUDE"
cargo test -- --test-threads=1

windows-vcpkg:
name: Windows (vcpkg)
runs-on: windows-latest

steps:
- uses: actions/checkout@v4

- name: Install Rust
shell: powershell
run: |
rustup update stable --no-self-update
rustup default stable

- name: Install LLVM
shell: powershell
run: choco install llvm --no-progress -y

- name: Set up vcpkg
shell: powershell
run: |
git clone https://github.com/microsoft/vcpkg.git C:\vcpkg
& C:\vcpkg\bootstrap-vcpkg.bat
& C:\vcpkg\vcpkg.exe install clamav:x64-windows openssl:x64-windows

- name: Build and test with vcpkg discovery
shell: powershell
env:
VCPKG_ROOT: C:\vcpkg
VCPKGRS_DYNAMIC: 1
LIBCLANG_PATH: C:\Program Files\LLVM\bin
run: |
$env:PATH = "C:\vcpkg\installed\x64-windows\bin;$env:PATH"
cargo test -- --test-threads=1

windows-manual:
name: Windows (manual)
runs-on: windows-latest

steps:
- uses: actions/checkout@v4

- name: Install Rust
shell: powershell
run: |
rustup update stable --no-self-update
rustup default stable

- name: Install LLVM
shell: powershell
run: choco install llvm --no-progress -y

- name: Install OpenSSL
shell: powershell
run: |
choco install openssl --no-progress -y -dv

$candidates = @(
"C:\Program Files\OpenSSL-Win64",
"C:\Program Files\OpenSSL",
"C:\tools\OpenSSL-Win64",
"C:\tools\OpenSSL"
)
$discovered = Get-ChildItem "C:\Program Files","C:\tools" -Directory -Filter "OpenSSL*" -ErrorAction SilentlyContinue |
Select-Object -ExpandProperty FullName
$opensslRoot = @($candidates + $discovered) |
Where-Object { Test-Path (Join-Path $_ "include") } |
Select-Object -First 1

if (-Not $opensslRoot) {
throw "OpenSSL include directory was not found after Chocolatey install"
}

$opensslInclude = Join-Path $opensslRoot "include"
$opensslBin = Join-Path $opensslRoot "bin"
Write-Host "OpenSSL root: $opensslRoot"
Write-Host "OpenSSL include: $opensslInclude"
Write-Host "OpenSSL bin: $opensslBin"

"OPENSSL_ROOT=$opensslRoot" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
"OPENSSL_INCLUDE=$opensslInclude" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
"OPENSSL_BIN=$opensslBin" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append

- name: Download ClamAV release package
shell: powershell
run: |
$archive = "clamav-${env:CLAMAV_VERSION}.win.x64.zip"
$url = "https://github.com/Cisco-Talos/clamav/releases/download/clamav-${env:CLAMAV_VERSION}/$archive"
Invoke-WebRequest -Uri $url -OutFile $archive
Expand-Archive -Path $archive -DestinationPath C:\clamav -Force

- name: Build and test with manual library paths
shell: powershell
env:
CLAMAV_LIBRARY: C:\clamav\clamav-${{ env.CLAMAV_VERSION }}.win.x64\clamav.lib
CLAMAV_INCLUDE: C:\clamav\clamav-${{ env.CLAMAV_VERSION }}.win.x64\include
LIBCLANG_PATH: C:\Program Files\LLVM\bin
run: |
$env:PATH = "C:\clamav\clamav-${env:CLAMAV_VERSION}.win.x64;$env:OPENSSL_BIN;$env:PATH"
cargo test -- --test-threads=1
86 changes: 86 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# Citizen Code of Conduct

## 1. Purpose

A primary goal of the ClamAV community is to be inclusive to the largest number of contributors, with the most varied and diverse backgrounds possible. As such, we are committed to providing a friendly, safe and welcoming environment for all, regardless of gender, sexual orientation, ability, ethnicity, socioeconomic status, and religion (or lack thereof).

This code of conduct outlines our expectations for all those who participate in our community, as well as the consequences for unacceptable behavior.

We invite all those who participate in ClamAV to help us create safe and positive experiences for everyone.

## 2. Open [Source/Culture/Tech] Citizenship

A supplemental goal of this Code of Conduct is to increase open [source/culture/tech] citizenship by encouraging participants to recognize and strengthen the relationships between our actions and their effects on our community.

Communities mirror the societies in which they exist and positive action is essential to counteract the many forms of inequality and abuses of power that exist in society.

If you see someone who is making an extra effort to ensure our community is welcoming, friendly, and encourages all participants to contribute to the fullest extent, we want to know.

## 3. Expected Behavior

The following behaviors are expected and requested of all community members:

* Participate in an authentic and active way. In doing so, you contribute to the health and longevity of this community.
* Exercise consideration and respect in your speech and actions.
* Attempt collaboration before conflict.
* Refrain from demeaning, discriminatory, or harassing behavior and speech.
* Be mindful of your surroundings and of your fellow participants. Alert community leaders if you notice a dangerous situation, someone in distress, or violations of this Code of Conduct, even if they seem inconsequential.
* Remember that community event venues may be shared with members of the public; please be respectful to all patrons of these locations.

## 4. Unacceptable Behavior

The following behaviors are considered harassment and are unacceptable within our community:

* Violence, threats of violence or violent language directed against another person.
* Sexist, racist, homophobic, transphobic, ableist or otherwise discriminatory jokes and language.
* Posting or displaying sexually explicit or violent material.
* Posting or threatening to post other people's personally identifying information ("doxing").
* Personal insults, particularly those related to gender, sexual orientation, race, religion, or disability.
* Inappropriate photography or recording.
* Inappropriate physical contact. You should have someone's consent before touching them.
* Unwelcome sexual attention. This includes, sexualized comments or jokes as well as inappropriate touching or unwelcomed sexual advances.
* Deliberate intimidation, stalking or following (online or in person).
* Advocating for, or encouraging, any of the above behavior.
* Sustained disruption of community events, including talks and presentations.

## 5. Consequences of Unacceptable Behavior

Unacceptable behavior from any community member, including sponsors and those with decision-making authority, will not be tolerated.

Anyone asked to stop unacceptable behavior is expected to comply immediately.

If a community member engages in unacceptable behavior, the community organizers may take any action they deem appropriate, up to and including a temporary ban or permanent expulsion from the community without warning (and without refund in the case of a paid event).

## 6. Reporting Guidelines

If you are subject to or witness unacceptable behavior, or have any other concerns, please notify a community organizer as soon as possible. talos-external@cisco.com.

Additionally, community organizers are available to help community members engage with local law enforcement or to otherwise help those experiencing unacceptable behavior feel safe. In the context of in-person events, organizers will also provide escorts as desired by the person experiencing distress.

## 7. Addressing Grievances

If you feel you have been falsely or unfairly accused of violating this Code of Conduct, you should notify Cisco-Talos with a concise description of your grievance. Your grievance will be handled in accordance with our existing governing policies.

## 8. Scope

We expect all community participants (contributors, paid or otherwise; sponsors; and other guests) to abide by this Code of Conduct in all community venues--online and in-person--as well as in all one-on-one communications pertaining to community business.

This code of conduct and its related procedures also applies to unacceptable behavior occurring outside the scope of community activities when such behavior has the potential to adversely affect the safety and well-being of community members.

## 9. Contact info

talos-external@cisco.com

## 10. License and attribution

The Citizen Code of Conduct is distributed by Stumptown Syndicate under a [Creative Commons Attribution-ShareAlike license](http://creativecommons.org/licenses/by-sa/3.0/).

Portions of text derived from the [Django Code of Conduct](https://www.djangoproject.com/conduct/) and the [Geek Feminism Anti-Harassment Policy](http://geekfeminism.wikia.com/wiki/Conference_anti-harassment/Policy).

_Revision 2.3. Posted 6 March 2017._

_Revision 2.2. Posted 4 February 2016._

_Revision 2.1. Posted 23 June 2014._

_Revision 2.0, adopted by the Stumptown Syndicate board on 10 January 2013. Posted 17 March 2013._
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
authors = [
"Jonas Zaddach <jzaddach@cisco.com>",
"Scott Hutton <schutton@cisco.com>",
"Valerie Snyder <valsnyde@cisco.com>",
]
categories = ["external-ffi-bindings"]
description = "ClamAV low level bindings for Rust"
Expand All @@ -10,7 +11,7 @@ homepage = "https://github.com/Cisco-Talos/clamav-sys/"
license = "GPL-2.0"
name = "clamav-sys"
repository = "https://github.com/Cisco-Talos/clamav-sys/"
version = "1.0.0"
version = "1.5.0"

[build-dependencies]
bindgen = "0.64.0"
Expand Down
Loading
Loading