1name: Scapy unit tests 2 3on: 4 push: 5 branches: [master] 6 pull_request: 7 # The branches below must be a subset of the branches above 8 branches: [master] 9 10permissions: 11 contents: read 12 13jobs: 14 health: 15 name: Code health check 16 runs-on: ubuntu-latest 17 steps: 18 - name: Checkout Scapy 19 uses: actions/checkout@v4 20 - name: Setup Python 21 uses: actions/setup-python@v5 22 with: 23 python-version: "3.12" 24 - name: Install tox 25 run: pip install tox 26 - name: Run flake8 tests 27 run: tox -e flake8 28 - name: Run codespell 29 run: tox -e spell 30 - name: Run twine check 31 run: tox -e twine 32 - name: Run gitarchive check 33 run: tox -e gitarchive 34 docs: 35 # 'runs-on' and 'python-version' should match the ones defined in .readthedocs.yml 36 name: Build doc 37 runs-on: ubuntu-22.04 38 steps: 39 - name: Checkout Scapy 40 uses: actions/checkout@v4 41 - name: Setup Python 42 uses: actions/setup-python@v5 43 with: 44 python-version: "3.12" 45 - name: Install tox 46 run: pip install tox 47 - name: Build docs 48 run: tox -e docs 49 spdx: 50 name: Check SPDX identifiers 51 runs-on: ubuntu-latest 52 steps: 53 - name: Checkout Scapy 54 uses: actions/checkout@v4 55 - name: Launch script 56 run: bash scapy/tools/check_spdx.sh 57 mypy: 58 name: Type hints check 59 runs-on: ubuntu-latest 60 steps: 61 - name: Checkout Scapy 62 uses: actions/checkout@v4 63 - name: Setup Python 64 uses: actions/setup-python@v5 65 with: 66 python-version: "3.12" 67 - name: Install tox 68 run: pip install tox 69 - name: Run mypy 70 run: tox -e mypy 71 72 utscapy: 73 name: ${{ matrix.os }} ${{ matrix.installmode }} ${{ matrix.python }} ${{ matrix.mode }} ${{ matrix.flags }} 74 runs-on: ${{ matrix.os }} 75 timeout-minutes: 20 76 continue-on-error: ${{ matrix.allow-failure == 'true' }} 77 strategy: 78 fail-fast: false 79 matrix: 80 os: [ubuntu-latest] 81 python: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] 82 mode: [non_root] 83 installmode: [''] 84 flags: [" -K scanner"] 85 allow-failure: ['false'] 86 include: 87 # Linux root tests 88 - os: ubuntu-latest 89 python: "3.12" 90 mode: root 91 flags: " -K scanner" 92 # PyPy tests: root only 93 - os: ubuntu-latest 94 python: "pypy3.9" 95 mode: root 96 flags: " -K scanner" 97 # Libpcap test 98 - os: ubuntu-latest 99 python: "3.12" 100 mode: root 101 installmode: 'libpcap' 102 flags: " -K scanner" 103 # macOS tests 104 - os: macos-14 105 python: "3.12" 106 mode: both 107 flags: " -K scanner" 108 # Scanner tests 109 - os: ubuntu-latest 110 python: "3.12" 111 mode: root 112 allow-failure: 'true' 113 flags: " -k scanner" 114 - os: ubuntu-latest 115 python: "pypy3.9" 116 mode: root 117 allow-failure: 'true' 118 flags: " -k scanner" 119 - os: macos-14 120 python: "3.12" 121 mode: both 122 allow-failure: 'true' 123 flags: " -k scanner" 124 steps: 125 - name: Checkout Scapy 126 uses: actions/checkout@v4 127 # Codecov requires a fetch-depth > 1 128 with: 129 fetch-depth: 2 130 - name: Setup Python 131 uses: actions/setup-python@v5 132 with: 133 python-version: ${{ matrix.python }} 134 - name: Install Tox and any other packages 135 run: ./.config/ci/install.sh ${{ matrix.installmode }} 136 - name: Run Tox 137 run: UT_FLAGS="${{ matrix.flags }}" ./.config/ci/test.sh ${{ matrix.python }} ${{ matrix.mode }} 138 - name: Codecov 139 uses: codecov/codecov-action@v4 140 continue-on-error: true 141 with: 142 token: ${{ secrets.CODECOV_TOKEN }} 143 144 cryptography: 145 name: pyca/cryptography test 146 runs-on: ubuntu-latest 147 steps: 148 - name: Checkout repository 149 uses: actions/checkout@v4 150 - name: Setup Python 151 uses: actions/setup-python@v5 152 with: 153 python-version: "3.12" 154 - name: Install tox 155 run: pip install tox 156 # pyca/cryptography's CI installs cryptography 157 # then runs the tests. We therefore didn't include it in tox 158 - name: Install cryptography 159 run: pip install cryptography 160 - name: Run tests 161 run: tox -e cryptography 162 163 # CODE-QL 164 analyze: 165 name: CodeQL analysis 166 runs-on: ubuntu-latest 167 permissions: 168 security-events: write 169 steps: 170 - name: Checkout repository 171 uses: actions/checkout@v4 172 with: 173 fetch-depth: 2 174 - name: Initialize CodeQL 175 uses: github/codeql-action/init@v3 176 with: 177 languages: 'python' 178 - name: Perform CodeQL Analysis 179 uses: github/codeql-action/analyze@v3 180