diff --git a/.github/workflows/tests-rs-package.yml b/.github/workflows/tests-rs-package.yml index d644f2a40a..6126df012b 100644 --- a/.github/workflows/tests-rs-package.yml +++ b/.github/workflows/tests-rs-package.yml @@ -198,8 +198,17 @@ jobs: - name: Install librocksdb uses: ./.github/actions/librocksdb + - name: Configure core dumps + run: | + sudo mkdir /cores + sudo chmod 777 /cores + # Core filenames will be of the form executable.pid.timestamp: + sudo bash -c 'echo "/cores/%e.%p.%t" > /proc/sys/kernel/core_pattern' + - name: Run tests - run: RUST_MIN_STACK=16777216 cargo test --package=${{ inputs.package }} --all-features --locked + run: | + ulimit -c unlimited + RUST_MIN_STACK=16777216 cargo test --package=${{ inputs.package }} --all-features --locked env: SCCACHE_S3_KEY_PREFIX: ${{ runner.os }}/sccache/${{ runner.arch }}/linux-gnu ROCKSDB_STATIC: "/opt/rocksdb/usr/local/lib/librocksdb.a" @@ -207,6 +216,53 @@ jobs: SNAPPY_STATIC: "/usr/lib/x86_64-linux-gnu/libsnappy.a" SNAPPY_LIB_DIR: "/usr/lib/x86_64-linux-gnu" + # Zip crash artifacts (core files + binaries) so filenames stay safe + - name: Collect crash artifacts + if: failure() + env: + PACKAGE_NAME: ${{ inputs.package }} + run: | + set -euo pipefail + shopt -s nullglob + + if ! compgen -G "/cores/*" > /dev/null; then + echo "No core dumps were produced; skipping artifact archive." + exit 0 + fi + + ARTIFACT_DIR=crash-artifacts + rm -rf "${ARTIFACT_DIR}" + mkdir -p "${ARTIFACT_DIR}/cores" "${ARTIFACT_DIR}/binaries" + + cp -a /cores/. "${ARTIFACT_DIR}/cores/" + + BIN_PREFIX=$(echo "${PACKAGE_NAME}" | tr '-' '_') + for path in target/debug/deps/${BIN_PREFIX}-* target/debug/${BIN_PREFIX}-*; do + if [[ -f "$path" && -x "$path" ]]; then + cp -a "$path" "${ARTIFACT_DIR}/binaries/" + fi + done + + for extra in target/debug/deps/${BIN_PREFIX}-*.dSYM target/debug/${BIN_PREFIX}.dSYM \ + target/debug/deps/${BIN_PREFIX}-*.dwp target/debug/${BIN_PREFIX}.dwp; do + if [[ -e "$extra" ]]; then + cp -a "$extra" "${ARTIFACT_DIR}/binaries/" + fi + done + + (cd "${ARTIFACT_DIR}" && zip -9 -r ../core-dumps.zip .) + + - name: Upload core dumps + if: failure() + uses: actions/upload-artifact@v4 + with: + name: core-dumps-${{ inputs.package }} + path: | + core-dumps.zip + if-no-files-found: ignore + retention-days: 3 + # Inspect locally with: gdb path/to/binary path/to/core + check_each_feature: name: Check each feature runs-on: ubuntu-24.04