chg: [apollo] include some changes from @Shadow0ps, @stark4n6, @raidrob #192
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This workflow will install Python dependencies, run tests and lint with a single version of Python | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python | |
name: Python application | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
permissions: | |
contents: read | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, macos-latest] | |
python-version: ['3.11'] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up unifiedlog_parser_json | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
git clone https://github.com/mandiant/macos-UnifiedLogs | |
cd macos-UnifiedLogs/examples/unifiedlog_parser_json/ | |
cargo build --release | |
sudo cp ../target/release/unifiedlog_parser_json /usr/local/bin/ | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{matrix.python-version}} | |
- name: Install Python dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install flake8 pytest coverage | |
pip install . | |
- name: Install yara | |
run: | | |
if [ ${{ matrix.os }} == 'ubuntu-latest' ]; then | |
sudo apt-get install -y yara | |
elif [ ${{ matrix.os }} == 'macos-latest' ]; then | |
brew install yara | |
fi | |
mkdir yara | |
echo -e 'rule match_for_sure_on_ios\n{\n strings:\n $a01 = "/System/Library/CoreServices/powerd.bundle/powerd"\n\n condition:\n any of them\n}\n' > yara/match_for_sure.yar | |
- name: Lint with flake8 | |
run: | | |
# stop the build if there are Python syntax errors or undefined names | |
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | |
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | |
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | |
- name: Extract sysdiagnose test files ubuntu | |
run: | | |
git submodule update --init --recursive | |
cd tests/testdata | |
echo "Extracting sysdiagnose test files" | |
find . -iname '*.tar.gz' -execdir tar xzf {} \; 2> /dev/null | |
- name: Test with python unittest | |
run: | | |
python -m coverage run -m unittest -v | |
- name: Generate coverage report | |
run: | | |
python -m coverage report -m |