diff --git a/.github/workflows/ci-expanded.yml b/.github/workflows/ci-expanded.yml index 6f13fb307..3d3bbad21 100644 --- a/.github/workflows/ci-expanded.yml +++ b/.github/workflows/ci-expanded.yml @@ -567,6 +567,14 @@ jobs: ./emulation fi + - name: Register warning matcher + shell: bash + run: | + cat > "$RUNNER_TEMP/warning-matcher.json" << 'EOF' + {"problemMatcher":[{"owner":"gcc-warning","severity":"warning","pattern":[{"regexp":"^([^\\s:(][^:(]*):(\\d+):(\\d+):\\s+warning:\\s+(.*?)(?:\\s+\\[(-W[^\\]]+)\\])?$","file":1,"line":2,"column":3,"message":4,"code":5}]},{"owner":"msvc-warning","severity":"warning","pattern":[{"regexp":"^\\s*(?:\\d+>)?([^\\s(][^(]*)\\((\\d+)(?:,(\\d+))?\\)\\s*:\\s+warning\\s+(C\\d+)\\s*:\\s*(.*?)(?:\\s+\\[[^\\]]+\\])?$","file":1,"line":2,"column":3,"code":4,"message":5}]},{"owner":"clang-cl-warning","severity":"warning","pattern":[{"regexp":"^\\s*(?:\\d+>)?([^\\s(][^(]*)\\((\\d+)(?:,(\\d+))?\\)\\s*:\\s+warning:\\s+(.*?)(?:\\s+\\[(-W[^\\]]+)\\])?$","file":1,"line":2,"column":3,"message":4,"code":5}]}]} + EOF + echo "::add-matcher::$RUNNER_TEMP/warning-matcher.json" + - name: Execute installation shell: bash working-directory: 'libbitcoin-database' @@ -729,6 +737,14 @@ jobs: echo "LDFLAGS=-Wl,-rpath,${{ github.workspace }}/prefix/lib" >> $GITHUB_ENV fi + - name: Register warning matcher + shell: bash + run: | + cat > "$RUNNER_TEMP/warning-matcher.json" << 'EOF' + {"problemMatcher":[{"owner":"gcc-warning","severity":"warning","pattern":[{"regexp":"^([^\\s:(][^:(]*):(\\d+):(\\d+):\\s+warning:\\s+(.*?)(?:\\s+\\[(-W[^\\]]+)\\])?$","file":1,"line":2,"column":3,"message":4,"code":5}]},{"owner":"msvc-warning","severity":"warning","pattern":[{"regexp":"^\\s*(?:\\d+>)?([^\\s(][^(]*)\\((\\d+)(?:,(\\d+))?\\)\\s*:\\s+warning\\s+(C\\d+)\\s*:\\s*(.*?)(?:\\s+\\[[^\\]]+\\])?$","file":1,"line":2,"column":3,"code":4,"message":5}]},{"owner":"clang-cl-warning","severity":"warning","pattern":[{"regexp":"^\\s*(?:\\d+>)?([^\\s(][^(]*)\\((\\d+)(?:,(\\d+))?\\)\\s*:\\s+warning:\\s+(.*?)(?:\\s+\\[(-W[^\\]]+)\\])?$","file":1,"line":2,"column":3,"message":4,"code":5}]}]} + EOF + echo "::add-matcher::$RUNNER_TEMP/warning-matcher.json" + - name: Execute installation shell: bash working-directory: 'libbitcoin-database' @@ -1228,6 +1244,14 @@ jobs: chmod -R u+rwX /tmp/sysroot find /tmp/sysroot -name '*.la' -delete + - name: Register warning matcher + shell: bash + run: | + cat > "$RUNNER_TEMP/warning-matcher.json" << 'EOF' + {"problemMatcher":[{"owner":"gcc-warning","severity":"warning","pattern":[{"regexp":"^([^\\s:(][^:(]*):(\\d+):(\\d+):\\s+warning:\\s+(.*?)(?:\\s+\\[(-W[^\\]]+)\\])?$","file":1,"line":2,"column":3,"message":4,"code":5}]},{"owner":"msvc-warning","severity":"warning","pattern":[{"regexp":"^\\s*(?:\\d+>)?([^\\s(][^(]*)\\((\\d+)(?:,(\\d+))?\\)\\s*:\\s+warning\\s+(C\\d+)\\s*:\\s*(.*?)(?:\\s+\\[[^\\]]+\\])?$","file":1,"line":2,"column":3,"code":4,"message":5}]},{"owner":"clang-cl-warning","severity":"warning","pattern":[{"regexp":"^\\s*(?:\\d+>)?([^\\s(][^(]*)\\((\\d+)(?:,(\\d+))?\\)\\s*:\\s+warning:\\s+(.*?)(?:\\s+\\[(-W[^\\]]+)\\])?$","file":1,"line":2,"column":3,"message":4,"code":5}]}]} + EOF + echo "::add-matcher::$RUNNER_TEMP/warning-matcher.json" + - name: Execute installation shell: bash working-directory: 'libbitcoin-database' @@ -1650,6 +1674,14 @@ jobs: echo "LDFLAGS=-Wl,-rpath,${{ github.workspace }}/prefix/lib" >> $GITHUB_ENV fi + - name: Register warning matcher + shell: bash + run: | + cat > "$RUNNER_TEMP/warning-matcher.json" << 'EOF' + {"problemMatcher":[{"owner":"gcc-warning","severity":"warning","pattern":[{"regexp":"^([^\\s:(][^:(]*):(\\d+):(\\d+):\\s+warning:\\s+(.*?)(?:\\s+\\[(-W[^\\]]+)\\])?$","file":1,"line":2,"column":3,"message":4,"code":5}]},{"owner":"msvc-warning","severity":"warning","pattern":[{"regexp":"^\\s*(?:\\d+>)?([^\\s(][^(]*)\\((\\d+)(?:,(\\d+))?\\)\\s*:\\s+warning\\s+(C\\d+)\\s*:\\s*(.*?)(?:\\s+\\[[^\\]]+\\])?$","file":1,"line":2,"column":3,"code":4,"message":5}]},{"owner":"clang-cl-warning","severity":"warning","pattern":[{"regexp":"^\\s*(?:\\d+>)?([^\\s(][^(]*)\\((\\d+)(?:,(\\d+))?\\)\\s*:\\s+warning:\\s+(.*?)(?:\\s+\\[(-W[^\\]]+)\\])?$","file":1,"line":2,"column":3,"message":4,"code":5}]}]} + EOF + echo "::add-matcher::$RUNNER_TEMP/warning-matcher.json" + - name: Execute installation shell: bash working-directory: 'libbitcoin-database' @@ -1851,6 +1883,14 @@ jobs: persist-credentials: false repository: ${{ github.repository }} + - name: Register warning matcher + shell: bash + run: | + cat > "$RUNNER_TEMP/warning-matcher.json" << 'EOF' + {"problemMatcher":[{"owner":"gcc-warning","severity":"warning","pattern":[{"regexp":"^([^\\s:(][^:(]*):(\\d+):(\\d+):\\s+warning:\\s+(.*?)(?:\\s+\\[(-W[^\\]]+)\\])?$","file":1,"line":2,"column":3,"message":4,"code":5}]},{"owner":"msvc-warning","severity":"warning","pattern":[{"regexp":"^\\s*(?:\\d+>)?([^\\s(][^(]*)\\((\\d+)(?:,(\\d+))?\\)\\s*:\\s+warning\\s+(C\\d+)\\s*:\\s*(.*?)(?:\\s+\\[[^\\]]+\\])?$","file":1,"line":2,"column":3,"code":4,"message":5}]},{"owner":"clang-cl-warning","severity":"warning","pattern":[{"regexp":"^\\s*(?:\\d+>)?([^\\s(][^(]*)\\((\\d+)(?:,(\\d+))?\\)\\s*:\\s+warning:\\s+(.*?)(?:\\s+\\[(-W[^\\]]+)\\])?$","file":1,"line":2,"column":3,"message":4,"code":5}]}]} + EOF + echo "::add-matcher::$RUNNER_TEMP/warning-matcher.json" + - name: Force clean nuget package repository shell: cmd working-directory: 'libbitcoin-database' @@ -1891,3 +1931,40 @@ jobs: exit $ERR; } Write-Host "Test execution complete." -ForegroundColor Green; + + warnings: + needs: [ gnu, musl, cmake, presets, msvc ] + if: ${{ !cancelled() && (github.event_name != 'pull_request' || github.event.action != 'closed') }} + continue-on-error: true + runs-on: ubuntu-latest + + permissions: + actions: read + checks: read + + steps: + - name: Count compiler warnings + id: count + shell: bash + env: + GH_TOKEN: ${{ github.token }} + run: | + SUITE=$(gh api "repos/${{ github.repository }}/actions/runs/${{ github.run_id }}" --jq .check_suite_id) + RUNS=$(gh api --paginate "repos/${{ github.repository }}/check-suites/${SUITE}/check-runs?per_page=100" --jq '.check_runs[] | select(.output.annotations_count > 0) | .id') + COUNT=0 + for RUN in ${RUNS}; do + FOUND=$(gh api --paginate "repos/${{ github.repository }}/check-runs/${RUN}/annotations?per_page=100" --jq '[.[] | select(.annotation_level == "warning" and .path != ".github")] | length' | awk '{ sum += $1 } END { print sum + 0 }') + COUNT=$((COUNT + FOUND)) + done + echo "Compiler warnings: ${COUNT}" | tee -a "$GITHUB_STEP_SUMMARY" + mkdir -p warnings + echo "${COUNT}" > warnings/count + echo "count=${COUNT}" >> "$GITHUB_OUTPUT" + + - name: Upload warning count + if: steps.count.outputs.count != '0' + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: warnings-${{ steps.count.outputs.count }} + path: warnings/count + retention-days: 90 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f75c1f348..762c86dbe 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -299,6 +299,14 @@ jobs: ./emulation fi + - name: Register warning matcher + shell: bash + run: | + cat > "$RUNNER_TEMP/warning-matcher.json" << 'EOF' + {"problemMatcher":[{"owner":"gcc-warning","severity":"warning","pattern":[{"regexp":"^([^\\s:(][^:(]*):(\\d+):(\\d+):\\s+warning:\\s+(.*?)(?:\\s+\\[(-W[^\\]]+)\\])?$","file":1,"line":2,"column":3,"message":4,"code":5}]},{"owner":"msvc-warning","severity":"warning","pattern":[{"regexp":"^\\s*(?:\\d+>)?([^\\s(][^(]*)\\((\\d+)(?:,(\\d+))?\\)\\s*:\\s+warning\\s+(C\\d+)\\s*:\\s*(.*?)(?:\\s+\\[[^\\]]+\\])?$","file":1,"line":2,"column":3,"code":4,"message":5}]},{"owner":"clang-cl-warning","severity":"warning","pattern":[{"regexp":"^\\s*(?:\\d+>)?([^\\s(][^(]*)\\((\\d+)(?:,(\\d+))?\\)\\s*:\\s+warning:\\s+(.*?)(?:\\s+\\[(-W[^\\]]+)\\])?$","file":1,"line":2,"column":3,"message":4,"code":5}]}]} + EOF + echo "::add-matcher::$RUNNER_TEMP/warning-matcher.json" + - name: Execute installation shell: bash working-directory: 'libbitcoin-database' @@ -505,6 +513,14 @@ jobs: echo "LDFLAGS=-Wl,-rpath,${{ github.workspace }}/prefix/lib" >> $GITHUB_ENV fi + - name: Register warning matcher + shell: bash + run: | + cat > "$RUNNER_TEMP/warning-matcher.json" << 'EOF' + {"problemMatcher":[{"owner":"gcc-warning","severity":"warning","pattern":[{"regexp":"^([^\\s:(][^:(]*):(\\d+):(\\d+):\\s+warning:\\s+(.*?)(?:\\s+\\[(-W[^\\]]+)\\])?$","file":1,"line":2,"column":3,"message":4,"code":5}]},{"owner":"msvc-warning","severity":"warning","pattern":[{"regexp":"^\\s*(?:\\d+>)?([^\\s(][^(]*)\\((\\d+)(?:,(\\d+))?\\)\\s*:\\s+warning\\s+(C\\d+)\\s*:\\s*(.*?)(?:\\s+\\[[^\\]]+\\])?$","file":1,"line":2,"column":3,"code":4,"message":5}]},{"owner":"clang-cl-warning","severity":"warning","pattern":[{"regexp":"^\\s*(?:\\d+>)?([^\\s(][^(]*)\\((\\d+)(?:,(\\d+))?\\)\\s*:\\s+warning:\\s+(.*?)(?:\\s+\\[(-W[^\\]]+)\\])?$","file":1,"line":2,"column":3,"message":4,"code":5}]}]} + EOF + echo "::add-matcher::$RUNNER_TEMP/warning-matcher.json" + - name: Execute installation shell: bash working-directory: 'libbitcoin-database' @@ -715,6 +731,14 @@ jobs: echo "LDFLAGS=-Wl,-rpath,${{ github.workspace }}/prefix/lib" >> $GITHUB_ENV fi + - name: Register warning matcher + shell: bash + run: | + cat > "$RUNNER_TEMP/warning-matcher.json" << 'EOF' + {"problemMatcher":[{"owner":"gcc-warning","severity":"warning","pattern":[{"regexp":"^([^\\s:(][^:(]*):(\\d+):(\\d+):\\s+warning:\\s+(.*?)(?:\\s+\\[(-W[^\\]]+)\\])?$","file":1,"line":2,"column":3,"message":4,"code":5}]},{"owner":"msvc-warning","severity":"warning","pattern":[{"regexp":"^\\s*(?:\\d+>)?([^\\s(][^(]*)\\((\\d+)(?:,(\\d+))?\\)\\s*:\\s+warning\\s+(C\\d+)\\s*:\\s*(.*?)(?:\\s+\\[[^\\]]+\\])?$","file":1,"line":2,"column":3,"code":4,"message":5}]},{"owner":"clang-cl-warning","severity":"warning","pattern":[{"regexp":"^\\s*(?:\\d+>)?([^\\s(][^(]*)\\((\\d+)(?:,(\\d+))?\\)\\s*:\\s+warning:\\s+(.*?)(?:\\s+\\[(-W[^\\]]+)\\])?$","file":1,"line":2,"column":3,"message":4,"code":5}]}]} + EOF + echo "::add-matcher::$RUNNER_TEMP/warning-matcher.json" + - name: Execute installation shell: bash working-directory: 'libbitcoin-database' @@ -867,6 +891,14 @@ jobs: persist-credentials: false repository: ${{ github.repository }} + - name: Register warning matcher + shell: bash + run: | + cat > "$RUNNER_TEMP/warning-matcher.json" << 'EOF' + {"problemMatcher":[{"owner":"gcc-warning","severity":"warning","pattern":[{"regexp":"^([^\\s:(][^:(]*):(\\d+):(\\d+):\\s+warning:\\s+(.*?)(?:\\s+\\[(-W[^\\]]+)\\])?$","file":1,"line":2,"column":3,"message":4,"code":5}]},{"owner":"msvc-warning","severity":"warning","pattern":[{"regexp":"^\\s*(?:\\d+>)?([^\\s(][^(]*)\\((\\d+)(?:,(\\d+))?\\)\\s*:\\s+warning\\s+(C\\d+)\\s*:\\s*(.*?)(?:\\s+\\[[^\\]]+\\])?$","file":1,"line":2,"column":3,"code":4,"message":5}]},{"owner":"clang-cl-warning","severity":"warning","pattern":[{"regexp":"^\\s*(?:\\d+>)?([^\\s(][^(]*)\\((\\d+)(?:,(\\d+))?\\)\\s*:\\s+warning:\\s+(.*?)(?:\\s+\\[(-W[^\\]]+)\\])?$","file":1,"line":2,"column":3,"message":4,"code":5}]}]} + EOF + echo "::add-matcher::$RUNNER_TEMP/warning-matcher.json" + - name: Force clean nuget package repository shell: cmd working-directory: 'libbitcoin-database' @@ -907,3 +939,40 @@ jobs: exit $ERR; } Write-Host "Test execution complete." -ForegroundColor Green; + + warnings: + needs: [ gnu, cmake, presets, msvc ] + if: ${{ !cancelled() && (github.event_name != 'pull_request' || github.event.action != 'closed') }} + continue-on-error: true + runs-on: ubuntu-latest + + permissions: + actions: read + checks: read + + steps: + - name: Count compiler warnings + id: count + shell: bash + env: + GH_TOKEN: ${{ github.token }} + run: | + SUITE=$(gh api "repos/${{ github.repository }}/actions/runs/${{ github.run_id }}" --jq .check_suite_id) + RUNS=$(gh api --paginate "repos/${{ github.repository }}/check-suites/${SUITE}/check-runs?per_page=100" --jq '.check_runs[] | select(.output.annotations_count > 0) | .id') + COUNT=0 + for RUN in ${RUNS}; do + FOUND=$(gh api --paginate "repos/${{ github.repository }}/check-runs/${RUN}/annotations?per_page=100" --jq '[.[] | select(.annotation_level == "warning" and .path != ".github")] | length' | awk '{ sum += $1 } END { print sum + 0 }') + COUNT=$((COUNT + FOUND)) + done + echo "Compiler warnings: ${COUNT}" | tee -a "$GITHUB_STEP_SUMMARY" + mkdir -p warnings + echo "${COUNT}" > warnings/count + echo "count=${COUNT}" >> "$GITHUB_OUTPUT" + + - name: Upload warning count + if: steps.count.outputs.count != '0' + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: warnings-${{ steps.count.outputs.count }} + path: warnings/count + retention-days: 90 diff --git a/builds/gnu/install-gnu.sh b/builds/gnu/install-gnu.sh index 6577f70ce..ac730435c 100755 --- a/builds/gnu/install-gnu.sh +++ b/builds/gnu/install-gnu.sh @@ -30,6 +30,8 @@ # --build-skip-tests Skip test compilation and execution. # --build-skip-test-run Compile tests without executing them. # --build-valgrind= Also run the tests matching the filter under valgrind. +# --build-web Also test, regenerate and compare the embedded web pages. +# --build-smoke Also sync each network and smoke test the nodes. # --build-parallel= Number of jobs to run simultaneously. # Default: supported platforms use nproc/sysctl # --build-use-local-src Use existing sources in relevant paths. @@ -148,6 +150,8 @@ main() (--build-skip-tests) BUILD_SKIP_TESTS="yes";; (--build-skip-test-run) BUILD_SKIP_TEST_RUN="yes";; (--build-valgrind=*) BUILD_VALGRIND="${OPTION#*=}";; + (--build-web) BUILD_WEB="yes";; + (--build-smoke) BUILD_SMOKE="yes";; (--build-parallel=*) PARALLEL="${OPTION#*=}";; (--build-use-local-src) BUILD_USE_LOCAL_SRC="yes";; (--prefix=*) PREFIX="${OPTION#*=}";; @@ -172,6 +176,8 @@ main() remove_configure_option "--build-skip-tests" remove_configure_option "--build-skip-test-run" remove_configure_option "--build-valgrind=*" + remove_configure_option "--build-web" + remove_configure_option "--build-smoke" remove_configure_option "--build-parallel=*" remove_configure_option "--build-use-local-src" remove_configure_option "--prefix=*" @@ -999,6 +1005,33 @@ test_gnu() fi fi + if [[ "${BUILD_WEB}" == "yes" && "${BUILD_SKIP_TEST_RUN}" != "yes" && "${PROJECT}" == "libbitcoin-database" ]]; then + msg "Testing ${PROJECT} embedded web pages" + push_directory "${BUILD_SRC_DIR}/${PROJECT}" + python3 tools/generate_embedded_pages.py && git diff --exit-code -- console/embedded + + RESULT=$? + pop_directory + if [[ ${RESULT} -ne 0 ]]; then + msg_error "Embedded web pages failed tests or differ from those committed." + exit ${RESULT} + fi + fi + + if [[ "${BUILD_SMOKE}" == "yes" && "${BUILD_SKIP_TEST_RUN}" != "yes" && "${PROJECT}" == "libbitcoin-database" ]]; then + msg "Smoke testing ${PROJECT} nodes" + local BS="$(pwd)/console/bs" + push_directory "${BUILD_SRC_DIR}/${PROJECT}" + python3 tools/sync_networks.py "${BS}" + + RESULT=$? + pop_directory + if [[ ${RESULT} -ne 0 ]]; then + msg_error "Encountered node smoke test failure, please see report above." + exit ${RESULT} + fi + fi + enable_exit_on_error pop_directory # BUILD_OBJ_DIR @@ -1025,6 +1058,8 @@ display_build_variables() msg "BUILD_SKIP_TESTS : ${BUILD_SKIP_TESTS}" msg "BUILD_SKIP_TEST_RUN : ${BUILD_SKIP_TEST_RUN}" msg "BUILD_VALGRIND : ${BUILD_VALGRIND}" + msg "BUILD_WEB : ${BUILD_WEB}" + msg "BUILD_SMOKE : ${BUILD_SMOKE}" msg "PARALLEL : ${PARALLEL}" msg "PREFIX : ${PREFIX}" msg "DISPLAY_VERBOSE : ${DISPLAY_VERBOSE}" @@ -1093,6 +1128,8 @@ help() msg "--build-skip-tests Skip test compilation and execution." msg "--build-skip-test-run Compile tests without executing them." msg "--build-valgrind= Also run the tests matching the filter under valgrind." + msg "--build-web Also test, regenerate and compare the embedded web pages." + msg "--build-smoke Also sync each network and smoke test the nodes." msg "--build-parallel= Number of jobs to run simultaneously." msg " Default: supported platforms use nproc/sysctl" msg "--build-use-local-src Use existing sources in relevant paths."