-
-
Notifications
You must be signed in to change notification settings - Fork 7
98 lines (96 loc) · 4.09 KB
/
test.yml
File metadata and controls
98 lines (96 loc) · 4.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
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@58077d3c7e43986b6b15fba718e8ea69e387dfcc # v2.15.1
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