mirror of
https://github.com/mandiant/capa.git
synced 2025-12-24 20:10:07 -08:00
87 lines
2.3 KiB
YAML
87 lines
2.3 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [ master ]
|
|
pull_request:
|
|
branches: [ master ]
|
|
|
|
jobs:
|
|
changelog_format:
|
|
runs-on: ubuntu-20.04
|
|
steps:
|
|
- name: Checkout capa
|
|
uses: actions/checkout@v2
|
|
# The sync GH action in capa-rules relies on a single '- *$' in the CHANGELOG file
|
|
- name: Ensure CHANGELOG has '- *$'
|
|
run: |
|
|
number=$(grep '\- *$' CHANGELOG.md | wc -l)
|
|
if [ $number != 1 ]; then exit 1; fi
|
|
|
|
code_style:
|
|
runs-on: ubuntu-20.04
|
|
steps:
|
|
- name: Checkout capa
|
|
uses: actions/checkout@v2
|
|
- name: Set up Python 3.8
|
|
uses: actions/setup-python@v2
|
|
with:
|
|
python-version: 3.8
|
|
- name: Install dependencies
|
|
run: pip install -e .[dev]
|
|
- name: Lint with isort
|
|
run: isort --profile black --length-sort --line-width 120 -c .
|
|
- name: Lint with black
|
|
run: black -l 120 --check .
|
|
- name: Check types with mypy
|
|
run: mypy --config-file .github/mypy/mypy.ini capa/ scripts/ tests/
|
|
|
|
rule_linter:
|
|
runs-on: ubuntu-20.04
|
|
steps:
|
|
- name: Checkout capa with rules submodule
|
|
uses: actions/checkout@v2
|
|
with:
|
|
submodules: true
|
|
- name: Set up Python 3.8
|
|
uses: actions/setup-python@v2
|
|
with:
|
|
python-version: 3.8
|
|
- name: Install capa
|
|
run: pip install -e .
|
|
- name: Run rule linter
|
|
run: python scripts/lint.py rules/
|
|
|
|
tests:
|
|
name: Tests in ${{ matrix.python-version }} on ${{ matrix.os }}
|
|
runs-on: ${{ matrix.os }}
|
|
needs: [code_style, rule_linter]
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os: [ubuntu-20.04, windows-2019, macos-10.15]
|
|
# across all operating systems
|
|
python-version: [3.6, 3.9]
|
|
include:
|
|
# on Ubuntu run these as well
|
|
- os: ubuntu-20.04
|
|
python-version: 3.7
|
|
- os: ubuntu-20.04
|
|
python-version: 3.8
|
|
steps:
|
|
- name: Checkout capa with submodules
|
|
uses: actions/checkout@v2
|
|
with:
|
|
submodules: true
|
|
- name: Set up Python ${{ matrix.python-version }}
|
|
uses: actions/setup-python@v2
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
- name: Install pyyaml
|
|
if: matrix.os == 'ubuntu-20.04'
|
|
run: sudo apt-get install -y libyaml-dev
|
|
- name: Install capa
|
|
run: pip install -e .[dev]
|
|
- name: Run tests
|
|
run: pytest tests/
|