|
| 1 | +name: static analysis |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + pull_request: |
| 6 | + workflow_dispatch: |
| 7 | + schedule: |
| 8 | + - cron: '0 6 * * 1' |
| 9 | + |
| 10 | +permissions: |
| 11 | + contents: read |
| 12 | + |
| 13 | +concurrency: |
| 14 | + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} |
| 15 | + cancel-in-progress: true |
| 16 | + |
| 17 | +jobs: |
| 18 | + clang-tidy: |
| 19 | + name: clang-tidy |
| 20 | + runs-on: ubuntu-24.04 |
| 21 | + timeout-minutes: 15 |
| 22 | + steps: |
| 23 | + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 24 | + |
| 25 | + - name: Set up Python |
| 26 | + uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 |
| 27 | + with: |
| 28 | + python-version: '3.12' |
| 29 | + |
| 30 | + - name: Install dependencies |
| 31 | + run: | |
| 32 | + sudo apt-get update |
| 33 | + sudo apt-get install -y clang clang-tidy ninja-build pkg-config libglib2.0-dev libfuse3-dev |
| 34 | + pip3 install meson |
| 35 | +
|
| 36 | + - name: Build compile database |
| 37 | + env: |
| 38 | + CC: clang |
| 39 | + run: meson setup build |
| 40 | + |
| 41 | + - name: Run clang-tidy |
| 42 | + run: run-clang-tidy -p build sshfs.c cache.c |
| 43 | + |
| 44 | + clang-tidy-extended: |
| 45 | + name: clang-tidy (extended) |
| 46 | + runs-on: ubuntu-24.04 |
| 47 | + timeout-minutes: 20 |
| 48 | + continue-on-error: true |
| 49 | + steps: |
| 50 | + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 51 | + |
| 52 | + - name: Set up Python |
| 53 | + uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 |
| 54 | + with: |
| 55 | + python-version: '3.12' |
| 56 | + |
| 57 | + - name: Install dependencies |
| 58 | + run: | |
| 59 | + sudo apt-get update |
| 60 | + sudo apt-get install -y clang clang-tidy ninja-build pkg-config libglib2.0-dev libfuse3-dev |
| 61 | + pip3 install meson |
| 62 | +
|
| 63 | + - name: Build compile database |
| 64 | + env: |
| 65 | + CC: clang |
| 66 | + run: meson setup build |
| 67 | + |
| 68 | + - name: Run extended clang-tidy |
| 69 | + run: | |
| 70 | + run-clang-tidy -p build \ |
| 71 | + -checks='-*,bugprone-*,cert-*,clang-analyzer-*,performance-*,portability-*' \ |
| 72 | + sshfs.c cache.c |
| 73 | +
|
| 74 | + tsan: |
| 75 | + name: ThreadSanitizer |
| 76 | + runs-on: ubuntu-24.04 |
| 77 | + timeout-minutes: 30 |
| 78 | + continue-on-error: true |
| 79 | + steps: |
| 80 | + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 81 | + |
| 82 | + - name: Set up Python |
| 83 | + uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 |
| 84 | + with: |
| 85 | + python-version: '3.12' |
| 86 | + |
| 87 | + - name: Install dependencies |
| 88 | + run: | |
| 89 | + sudo apt-get update |
| 90 | + sudo apt-get install -y clang llvm ninja-build pkg-config libglib2.0-dev libfuse3-dev fuse3 openssh-client openssh-server |
| 91 | + pip3 install meson pytest pytest-timeout |
| 92 | +
|
| 93 | + - name: Setup SSH |
| 94 | + run: | |
| 95 | + mkdir -p ~/.ssh |
| 96 | + chmod 700 ~/.ssh |
| 97 | + ssh-keygen -t ed25519 -f ~/.ssh/id_ed25519 -q -N "" |
| 98 | + cat ~/.ssh/id_ed25519.pub > ~/.ssh/authorized_keys |
| 99 | + chmod 600 ~/.ssh/authorized_keys |
| 100 | + sudo systemctl start ssh || sudo service ssh start |
| 101 | + ssh -o StrictHostKeyChecking=no -o BatchMode=yes localhost true |
| 102 | +
|
| 103 | + - name: Build with TSan |
| 104 | + env: |
| 105 | + CC: clang |
| 106 | + run: | |
| 107 | + meson setup build -Db_sanitize=thread -Db_lundef=false -Dwerror=true |
| 108 | + ninja -C build |
| 109 | +
|
| 110 | + - name: Check FUSE availability |
| 111 | + run: | |
| 112 | + test -e /dev/fuse |
| 113 | + command -v fusermount3 |
| 114 | +
|
| 115 | + - name: Create TSan log directory |
| 116 | + run: mkdir -p tsan-logs |
| 117 | + |
| 118 | + - name: Test |
| 119 | + env: |
| 120 | + TSAN_OPTIONS: "halt_on_error=1:second_deadlock_stack=1:log_path=${{ github.workspace }}/tsan-logs/tsan" |
| 121 | + run: | |
| 122 | + cd build |
| 123 | + python3 -m pytest test/ --timeout=180 --maxfail=99 --junitxml=test-results.xml |
| 124 | + timeout-minutes: 20 |
| 125 | + |
| 126 | + - name: Upload test results |
| 127 | + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 |
| 128 | + if: always() |
| 129 | + with: |
| 130 | + name: test-results-tsan |
| 131 | + path: | |
| 132 | + build/test-results.xml |
| 133 | + build/meson-logs/ |
| 134 | + tsan-logs/ |
0 commit comments