/
githubmirror
/
libusb
Обзор
Документация
Войти
/
githubmirror
/
libusb
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
.github/workflows/linux.yml
175 строк
6 KB
Ihor Dutchak
ci: gate testcore stress test (#1913)
01 авг 2026, 16:36
Не верифицирован
01 авг 2026, 16:36
ddc6c52
Код
Авторство
О чём код?
name: linux on: push: branches: - master tags: - '**' pull_request: types: [opened, synchronize, reopened, labeled] # Keep the long-running stress test on master unless a PR explicitly opts in. env: TESTCORE_CONFIGURE_FLAG: >- ${{ (github.ref == 'refs/heads/master' || contains(github.event.pull_request.labels.*.name, 'force_testcore') || contains(github.event.pull_request.labels.*.name, 'force_long_tests')) && '--enable-testcore' || '' }} # Isolate unrelated label events from code and force-label CI runs. concurrency: group: >- ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-${{ github.event.action == 'labeled' && github.event.label.name != 'force_testcore' && github.event.label.name != 'force_long_tests' && github.run_id || 'ci' }} cancel-in-progress: ${{ github.event_name == 'pull_request' }} jobs: c23: if: >- github.event.action != 'labeled' || github.event.label.name == 'force_testcore' || github.event.label.name == 'force_long_tests' name: GCC 16 / C23 runs-on: ubuntu-latest container: gcc:16 timeout-minutes: 30 steps: - uses: actions/checkout@v6 with: # Full history + tags for build-aux/gen-describe.sh. fetch-depth: 0 - name: setup prerequisites run: | apt-get update apt-get install -y --no-install-recommends autoconf automake libtool pkg-config - name: bootstrap run: ./bootstrap.sh - name: build libusb with C23 env: CC: gcc CFLAGS: -std=c23 run: | gcc --version mkdir build-c23 cd build-c23 || exit 1 ../configure --disable-udev make -j"$(nproc)" build: if: >- github.event.action != 'labeled' || github.event.label.name == 'force_testcore' || github.event.label.name == 'force_long_tests' runs-on: ubuntu-latest timeout-minutes: 60 steps: - uses: actions/checkout@v6 with: # Fetch full history + tags so build-aux/gen-describe.sh can # produce a tag-prefixed `git describe` string. fetch-depth: 0 - name: setup prerequisites run: | sudo apt update sudo apt install -y autoconf automake libtool libudev-dev m4 pkg-config clang llvm doxygen - name: bootstrap run: ./bootstrap.sh - name: netlink # Disable tests for netlink as it doesn't seem to work in the CI environment. run: .private/ci-build.sh --werror --build-dir build-netlink --no-test -- --disable-udev - name: udev run: .private/ci-build.sh --werror --build-dir build-udev -- --enable-udev - name: Release build run: | mkdir build-release && cd build-release ../configure --enable-udev --enable-man-pages make -j$(nproc) make install DESTDIR="$PWD/staging" - name: Upload Release build artifact uses: actions/upload-artifact@v7 with: name: linux-release path: build-release/staging/ - name: debug-log run: .private/ci-build.sh --werror --build-dir build-debug -- --enable-debug-log - name: disable-log run: .private/ci-build.sh --werror --build-dir build-nolog -- --disable-log - uses: emscripten-core/setup-emsdk@v16 - run: npm ci working-directory: tests/webusb-test-shim - name: emscripten run: emconfigure .private/ci-build.sh --build-dir build-emscripten -- --host=wasm32-unknown-emscripten - name: umockdev test run: .private/ci-container-build.sh docker.io/amd64/ubuntu:rolling # --- Sanitizers + BOS fuzzer smoke, inside linux job (PRs only) --- - name: Sanitized rebuild (ASan/UBSan + hardening flags) if: ${{ github.event_name == 'pull_request' }} env: CC: clang CXX: clang++ CFLAGS: "-O1 -g -fsanitize=address,undefined -fno-omit-frame-pointer -fstack-protector-all -ftrivial-auto-var-init=pattern -Wwrite-strings" CXXFLAGS: "-O1 -g -fsanitize=address,undefined -fno-omit-frame-pointer -fstack-protector-all -ftrivial-auto-var-init=pattern -Wwrite-strings" LDFLAGS: "-fsanitize=address,undefined" run: | rm -rf build-asan mkdir -p build-asan cd build-asan CC=$CC CXX=$CXX CFLAGS="$CFLAGS" CXXFLAGS="$CXXFLAGS" LDFLAGS="$LDFLAGS" ../configure make -j - name: Stage install (pkg-config + runtime) if: ${{ github.event_name == 'pull_request' }} run: | make -C build-asan install DESTDIR="$PWD/build-asan/stage" echo "PKG_CONFIG_PATH=$PWD/build-asan/stage/usr/local/lib/pkgconfig" >> $GITHUB_ENV echo "LD_LIBRARY_PATH=$PWD/build-asan/stage/usr/local/lib" >> $GITHUB_ENV - name: Build & smoke BOS descriptor fuzzer (C, sanitized, bounded) if: ${{ github.event_name == 'pull_request' }} env: ASAN_OPTIONS: "detect_leaks=0:allocator_may_return_null=1" UBSAN_OPTIONS: "print_stacktrace=1:halt_on_error=1" run: | # Compile against the STAGED headers/libs (DESTDIR), not /usr/local clang -std=c99 tests/fuzz/fuzz_bos_descriptor.c \ -I"$PWD/build-asan/stage/usr/local/include/libusb-1.0" \ -fsanitize=fuzzer,address,undefined -fno-omit-frame-pointer \ -fstack-protector-all -ftrivial-auto-var-init=pattern -Wwrite-strings \ -L"$PWD/build-asan/stage/usr/local/lib" -lusb-1.0 \ -o fuzz_bos_descriptor ./fuzz_bos_descriptor tests/fuzz/corpus/bos \ -seed=1 -runs=200 -max_total_time=15 -timeout=5 -rss_limit_mb=1536 -print_final_stats=1 # --- end sanitizers + fuzzer smoke --- # The autotools test driver buffers each test's output into its own # tests/<test>.log; keep them (and config.log) when something goes wrong. - name: Upload test logs uses: actions/upload-artifact@v7 if: failure() || cancelled() with: name: test-logs-linux path: | build*/config.log build*/tests/*.log if-no-files-found: ignore