|
| 1 | +name: E2E Test |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main] |
| 6 | + pull_request: |
| 7 | + |
| 8 | +jobs: |
| 9 | + e2e-scan: |
| 10 | + runs-on: ubuntu-latest |
| 11 | + steps: |
| 12 | + - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 |
| 13 | + with: |
| 14 | + fetch-depth: 0 |
| 15 | + |
| 16 | + - uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 |
| 17 | + with: |
| 18 | + python-version: '3.12' |
| 19 | + |
| 20 | + - name: Install CLI from local repo |
| 21 | + run: | |
| 22 | + python -m pip install --upgrade pip |
| 23 | + pip install . |
| 24 | +
|
| 25 | + - name: Run Socket CLI scan |
| 26 | + env: |
| 27 | + SOCKET_SECURITY_API_KEY: ${{ secrets.SOCKET_CLI_API_TOKEN }} |
| 28 | + run: | |
| 29 | + set -o pipefail |
| 30 | + socketcli \ |
| 31 | + --target-path tests/e2e/fixtures/simple-npm \ |
| 32 | + --disable-blocking \ |
| 33 | + --enable-debug \ |
| 34 | + 2>&1 | tee /tmp/scan-output.log |
| 35 | +
|
| 36 | + - name: Verify scan produced a report |
| 37 | + run: | |
| 38 | + if grep -q "Full scan report URL: https://socket.dev/" /tmp/scan-output.log; then |
| 39 | + echo "PASS: Full scan report URL found" |
| 40 | + grep "Full scan report URL:" /tmp/scan-output.log |
| 41 | + elif grep -q "Diff Url: https://socket.dev/" /tmp/scan-output.log; then |
| 42 | + echo "PASS: Diff URL found" |
| 43 | + grep "Diff Url:" /tmp/scan-output.log |
| 44 | + else |
| 45 | + echo "FAIL: No report URL found in scan output" |
| 46 | + cat /tmp/scan-output.log |
| 47 | + exit 1 |
| 48 | + fi |
| 49 | +
|
| 50 | + e2e-reachability: |
| 51 | + runs-on: ubuntu-latest |
| 52 | + steps: |
| 53 | + - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 |
| 54 | + with: |
| 55 | + fetch-depth: 0 |
| 56 | + |
| 57 | + - uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 |
| 58 | + with: |
| 59 | + python-version: '3.12' |
| 60 | + |
| 61 | + - uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af |
| 62 | + with: |
| 63 | + node-version: '20' |
| 64 | + |
| 65 | + - name: Install CLI from local repo |
| 66 | + run: | |
| 67 | + python -m pip install --upgrade pip |
| 68 | + pip install . |
| 69 | +
|
| 70 | + - name: Install uv |
| 71 | + run: pip install uv |
| 72 | + |
| 73 | + - name: Run Socket CLI with reachability |
| 74 | + env: |
| 75 | + SOCKET_SECURITY_API_KEY: ${{ secrets.SOCKET_CLI_API_TOKEN }} |
| 76 | + run: | |
| 77 | + set -o pipefail |
| 78 | + socketcli \ |
| 79 | + --target-path tests/e2e/fixtures/simple-npm \ |
| 80 | + --reach \ |
| 81 | + --disable-blocking \ |
| 82 | + --enable-debug \ |
| 83 | + 2>&1 | tee /tmp/reach-output.log |
| 84 | +
|
| 85 | + - name: Verify reachability analysis completed |
| 86 | + run: | |
| 87 | + if grep -q "Reachability analysis completed successfully" /tmp/reach-output.log; then |
| 88 | + echo "PASS: Reachability analysis completed" |
| 89 | + grep "Reachability analysis completed successfully" /tmp/reach-output.log |
| 90 | + grep "Results written to:" /tmp/reach-output.log || true |
| 91 | + else |
| 92 | + echo "FAIL: Reachability analysis did not complete successfully" |
| 93 | + cat /tmp/reach-output.log |
| 94 | + exit 1 |
| 95 | + fi |
| 96 | +
|
| 97 | + - name: Verify scan produced a report |
| 98 | + run: | |
| 99 | + if grep -q "Full scan report URL: https://socket.dev/" /tmp/reach-output.log; then |
| 100 | + echo "PASS: Full scan report URL found" |
| 101 | + grep "Full scan report URL:" /tmp/reach-output.log |
| 102 | + elif grep -q "Diff Url: https://socket.dev/" /tmp/reach-output.log; then |
| 103 | + echo "PASS: Diff URL found" |
| 104 | + grep "Diff Url:" /tmp/reach-output.log |
| 105 | + else |
| 106 | + echo "FAIL: No report URL found in scan output" |
| 107 | + cat /tmp/reach-output.log |
| 108 | + exit 1 |
| 109 | + fi |
0 commit comments