Merge pull request #1380 from mandiant/dependabot/npm_and_yarn/viewer… #2131
This file contains hidden or 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
| name: CI | |
| on: | |
| push: | |
| branches: [ master, quantumstrand ] | |
| pull_request: | |
| branches: [ master, quantumstrand ] | |
| permissions: | |
| contents: read | |
| # Cancel outdated runs when a new commit is pushed to the same branch/PR. | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| # save workspaces to speed up testing | |
| env: | |
| FLOSS_SAVE_WORKSPACE: "True" | |
| jobs: | |
| code_style: | |
| runs-on: ubuntu-22.04 | |
| # Pin action version by commit hash to maximize trust, ref: https://securitylab.github.com/research/github-actions-building-blocks/ | |
| steps: | |
| - name: Checkout FLOSS | |
| uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
| with: | |
| # tag DBs and FLIRT sigs are LFS; mypy does not need them but keep checkout consistent | |
| lfs: true | |
| - name: Set up Python 3.10 | |
| uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0 | |
| with: | |
| python-version: '3.10' | |
| - name: Install dependencies | |
| run: | | |
| pip install -r requirements.txt | |
| pip install -e .[dev] | |
| - name: Lint with isort | |
| run: pre-commit run isort | |
| - name: Lint with black | |
| run: pre-commit run black | |
| - name: Check types with mypy | |
| run: pre-commit run mypy | |
| tests: | |
| name: Tests in ${{ matrix.python-version }} on ${{ matrix.os }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-22.04, windows-2022, macos-14] | |
| # across all operating systems | |
| # version numbers are strings, not floats | |
| python-version: ['3.10', '3.11'] | |
| include: | |
| # on Ubuntu run these as well | |
| - os: ubuntu-22.04 | |
| python-version: '3.12' | |
| steps: | |
| - name: Checkout FLOSS with submodule | |
| uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
| with: | |
| submodules: true | |
| # layout/tag DBs and FLIRT signatures are stored in Git LFS | |
| lfs: true | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install pyyaml | |
| if: matrix.os == 'ubuntu-22.04' | |
| run: sudo apt-get install -y libyaml-dev | |
| - name: Install FLOSS | |
| run: | | |
| pip install -r requirements.txt | |
| pip install -e .[dev] | |
| - name: Cache vivisect workspaces | |
| uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 | |
| with: | |
| path: tests/data/**/*.viv | |
| key: viv-${{ runner.os }}-${{ runner.arch }}-${{ matrix.python-version }}-${{ hashFiles('**/requirements.txt') }} | |
| - name: Run tests | |
| run: pytest tests/ |