Исходный код СУБД RuDB — свободной СУБД с открытым исходным кодом на базе PostgreSQL
rudb
3 days ago bd039d1e92813358c5c5a1e346b49074baf513f2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# Checks that do not fit into any of the per-platform workflows, i.e. the unity build and code formatting. These all run on a stock
# x86_64 Linux runner.
name: misc
 
on: workflow_call
 
# Limit permissions on the repository
permissions:
  contents: read
 
jobs:
  # Run meson builds to check for errors, unused functions, unused parameters, and externed functions
  lint:
    runs-on: ubuntu-24.04
 
    steps:
      - name: Checkout Code
        uses: actions/checkout@v6
        with:
          path: pgbackrest
 
      - name: Update Apt
        uses: ./pgbackrest/.github/action/apt
 
      - name: Install
        run: |
          DEBCONF_NONINTERACTIVE_SEEN=true DEBIAN_FRONTEND=noninteractive sudo apt-get install -y zlib1g-dev libssl-dev \
            libxml2-dev libpq-dev pkg-config meson liblz4-dev libzstd-dev libbz2-dev libssh2-1-dev
 
      - name: Build
        run: |
          meson setup --unity=on -Dwerror=true build ${GITHUB_WORKSPACE?}/pgbackrest
          ninja -vC build
 
      # Check that a unity build leaves main as the only symbol. FN_EXTERN and friends are defined as static for the unity
      # build, so any other symbol is a function or variable that escaped that treatment. The object is checked rather than the
      # linked binary because the binary also has whatever the C runtime, the static libbacktrace archive, and the copy
      # relocations for shared library variables put there, none of which is what is being tested and all of which vary by
      # architecture and distribution.
      - name: Check
        run: |
          diff - <(nm -gj --defined-only build/src/pgbackrest.p/*.o) <<'EOF'
          main
          EOF
 
      # Check for unused parameters. The FUNCTION_LOG_PARAM*() macros reference each parameter they log, which counts as a use and
      # hides parameters the function never touches, so append overrides to debug.h that compile the macros out. Nothing is lost
      # by that here since this build is never run. Asserts are compiled out of a release build as well, so a parameter that
      # only an assert reads is reported too and must be marked with a void cast to show that ignoring it is intended. Unused
      # function warnings are disabled because the *ToLog() functions have nothing left to call them once the macros are gone.
      - name: Check Unused Parameter
        run: |
          cat >> ${GITHUB_WORKSPACE?}/pgbackrest/src/common/debug.h <<'EOF'
 
          #undef FUNCTION_LOG_PARAM
          #define FUNCTION_LOG_PARAM(typeMacroPrefix, param)
 
          #undef FUNCTION_LOG_PARAM_P
          #define FUNCTION_LOG_PARAM_P(typeMacroPrefix, param)
 
          #undef FUNCTION_LOG_PARAM_PP
          #define FUNCTION_LOG_PARAM_PP(typeMacroPrefix, param)
          EOF
 
          meson setup --unity=on -Dwerror=true -Dc_args=-Wno-unused-function build-unused-param \
            ${GITHUB_WORKSPACE?}/pgbackrest
          ninja -vC build-unused-param
 
  # Check that code is correctly formatted
  code-format:
    runs-on: ubuntu-24.04
 
    steps:
      - name: Checkout Code
        uses: actions/checkout@v6
        with:
          path: pgbackrest
 
      - name: Update Apt
        uses: ./pgbackrest/.github/action/apt
 
      # The formatters and the PyYAML the harness needs to load. Nothing else is required since the check only reads the source.
      - name: Install
        run: |
          DEBCONF_NONINTERACTIVE_SEEN=true DEBIAN_FRONTEND=noninteractive sudo apt-get install -y uncrustify black \
            python3-yaml
 
      # On failure the check says how to fix what it found so it can be run locally
      - name: Check
        run: ${GITHUB_WORKSPACE?}/pgbackrest/test/test.py code-format --check