Skip to content

adding .NET samples containing nested classes (#224) #415

adding .NET samples containing nested classes (#224)

adding .NET samples containing nested classes (#224) #415

Workflow file for this run

name: Tests
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
# file name consistency
test_filenames:
runs-on: ubuntu-20.04
steps:
- name: Checkout testfiles repository
uses: actions/checkout@v3
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Test repository files
run: python .github/check_sample_filenames.py .
# to allow quicker tests, capa should run less than THRESHOLD seconds on added/modified test files
test_runtime:
runs-on: ubuntu-20.04
steps:
# We check the submodules separately as the rules submodule's reference may not be our PR/master
- name: Checkout capa without submodules
uses: actions/checkout@v3
with:
repository: mandiant/capa
- name: Checkout capa-rules
uses: actions/checkout@v3
with:
repository: mandiant/capa-rules
path: rules
- name: Checkout capa-testfiles
uses: actions/checkout@v3
with:
path: tests/data
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Install capa
run: pip install -e .
- name: Get modified files
id: files
uses: Ana06/get-changed-files@v2.2.0
with:
format: 'csv'
- name: Check capa runtime on modified files
run: |
THRESHOLD=180
exitcode=0
cd tests/data
mapfile -d ',' -t added_modified_files < <(printf '%s,' '${{ steps.files.outputs.all }}')
for changed_file in "${added_modified_files[@]}"; do
if [[ $changed_file =~ .exe_|.dll_|.elf_|.sys_|.raw32|.raw64 ]]; then
time0=$SECONDS
capa -q -v "$changed_file"
diff=$(($SECONDS-time0))
if [[ $diff -gt $THRESHOLD ]]; then
echo "capa ran for $diff seconds, please provide a different sample so we can test more quickly"
exitcode=1
else
echo "all good, capa ran for $diff seconds"
fi
fi
done
exit $exitcode