malwaredb 0.3.2

Service for storing malicious, benign, or unknown files and related metadata and relationships.
name: Test
on:
  pull_request:
    paths:
      - '**.rs'
      - '**/Cargo.toml'
      - 'Cargo.lock'
      - '.github/workflows/test.yml'
  push:
    paths:
      - '**.rs'
      - '**/Cargo.toml'
      - 'Cargo.lock'
      - '.github/workflows/test.yml'
permissions:
  contents: read
jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - name: Harden Runner
        uses: step-security/harden-runner@a90bcbc6539c36a85cdfeb73f7e2f433735f215b # v2.15.0
        with:
          egress-policy: block
          allowed-endpoints: >
            archive.ubuntu.com:443
            azure.archive.ubuntu.com:80
            crates.io:443
            esm.ubuntu.com:443
            files.pythonhosted.org:443
            github.com:443
            githubapp.com:443
            index.crates.io:443
            motd.ubuntu.com:443
            ppa.launchpadcontent.net:443
            pypi.org:443
            release-assets.githubusercontent.com:443
            security.ubuntu.com:443
            static.crates.io:443
            static.rust-lang.org:443

      - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
      - uses: rui314/setup-mold@725a8794d15fc7563f59595bd9556495c0564878 #v1
      - name: Update Rust toolchain
        run: rustup update
      - name: Install dependencies
        run: |
          sudo apt-get update
          sudo apt-get install -y libmagic-dev
      - name: cargo test
        run: cargo test --workspace
      - name: test publish
        run: cargo publish --workspace --dry-run
      - name: test python client
        run: |
          sudo apt-get update
          sudo apt-get install python3-venv python3-pip
          python3 -m venv venv
          source venv/bin/activate # Maturin requires a virtual environment
          pip install maturin
          cd client-py
          maturin develop
          cd py_test
          python cart.py

  #postgres:
  #  runs-on: ubuntu-latest
  #  services:
  #    postgres:
  #      image: ghcr.io/malwaredb/docker:main
  #      env:
  #        POSTGRES_PASSWORD: malwaredbtesting
  #        POSTGRES_HOST_AUTH_METHOD: trust
  #        POSTGRES_DB: malwaredbtesting
  #        POSTGRES_USER: malwaredbtesting
  #      ports:
  #        - 5432:5432
  #      options: >-
  #        --health-cmd pg_isready
  #        --health-interval 10s
  #        --health-timeout 5s
  #        --health-retries 5
  #        -h 0.0.0.0
  #  steps:
  #    - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
      #- name: Create database
      #  run: |
      #    PGPASSWORD=malwaredbtesting psql -h 127.0.0.1 -p ${{ job.services.postgres.ports[5432] }} -tc "create user malwaredbtesting with password 'malwaredbtesting';"
      #    PGPASSWORD=malwaredbtesting psql -h 127.0.0.1 -p ${{ job.services.postgres.ports[5432] }} -tc "create database malwaredbtesting owner malwaredbtesting;"
  #    - name: Load extensions
  #      run: |
  #        PGPASSWORD=malwaredbtesting psql -U malwaredbtesting -h 127.0.0.1 -p ${{ job.services.postgres.ports[5432] }} -d malwaredbtesting -tc "CREATE OR REPLACE FUNCTION fuzzy_hash_compare(TEXT, TEXT) RETURNS INTEGER AS 'ssdeep_psql.so', 'pg_fuzzy_hash_compare' LANGUAGE 'c';"
  #        PGPASSWORD=malwaredbtesting psql -U malwaredbtesting -h 127.0.0.1 -p ${{ job.services.postgres.ports[5432] }} -d malwaredbtesting -tc "CREATE OR REPLACE FUNCTION tlsh_compare(TEXT, TEXT) RETURNS INTEGER AS 'tlsh_psql.so', 'pg_tlsh_compare' LANGUAGE 'c';"
  #        PGPASSWORD=malwaredbtesting psql -U malwaredbtesting -h 127.0.0.1 -p ${{ job.services.postgres.ports[5432] }} -d malwaredbtesting -tc "CREATE OR REPLACE FUNCTION sdhash_compare(TEXT, TEXT) RETURNS INTEGER AS 'sdhash_psql.so', 'pg_sdhash_compare' LANGUAGE 'c';"
  #        PGPASSWORD=malwaredbtesting psql -U malwaredbtesting -h 127.0.0.1 -p ${{ job.services.postgres.ports[5432] }} -d malwaredbtesting -tc "CREATE OR REPLACE FUNCTION lzjd_compare(TEXT, TEXT) RETURNS INTEGER AS 'lzjd_psql.so', 'pg_lzjd_compare' LANGUAGE 'c';"
  #    - name: MalwareDB postgres test
  #      run: |
  #        PG_PORT=${{ job.services.postgres.ports[5432] }} cargo test db --workspace -- --ignored