Исходный код СУБД 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
# Build the distribution tarball and prove it builds and passes the smoke test on a variety of distributions using nothing but the
# packages a packager would install. The tarball ships the generated source and the rendered documentation, so unlike a git
# checkout it builds without the code generation or documentation tooling. This is both a test and living documentation of what a
# packager needs on each distribution.
#
# The dist job builds the tarball once, since it is distribution-independent by design, and uploads it. Each build job then consumes
# it in a fresh container that has only the required packages plus the distribution's native PostgreSQL. The containers are run
# directly rather than as job containers because the runner's glibc Node.js cannot execute the checkout and artifact actions inside
# a musl container (Alpine); running docker directly keeps one uniform path for every distribution.
name: dist
 
on: workflow_call
 
# Limit permissions on the repository
permissions:
  contents: read
 
jobs:
  # Build the distribution tarball. This is the only place the code generation and documentation tooling is needed, so it runs with
  # a full build environment; the tarball it produces needs none of that.
  dist:
    runs-on: ubuntu-24.04
 
    steps:
      # The release notes are checked against the full git history
      - name: Checkout Code
        uses: actions/checkout@v6
        with:
          path: pgbackrest
          fetch-depth: 0
 
      # The release notes are checked against the history of the integration branch in the project repository
      - name: Fetch Integration
        run: >-
          git -C pgbackrest fetch --quiet --no-tags https://github.com/pgbackrest/pgbackrest.git
          +refs/heads/integration:refs/remotes/upstream/integration
 
      - name: Update Apt
        uses: ./pgbackrest/.github/action/apt
 
      # The build environment for the binary the documentation runs. The runner already provides git and python3.
      - name: Install
        run: |
          DEBCONF_NONINTERACTIVE_SEEN=true DEBIAN_FRONTEND=noninteractive sudo apt-get install -y meson gcc pkg-config \
            libssl-dev libxml2-dev libpq-dev liblz4-dev libzstd-dev libbz2-dev zlib1g-dev
 
      - name: Build Tarball
        run: |
          cd ${GITHUB_WORKSPACE?}
 
          # Render the man page and HTML documentation into doc/output, which meson dist copies into the tarball. The output is
          # gitignored so the tree stays clean for meson dist. --no-exe skips executing the commands embedded in the documentation,
          # which would require containers and a great deal of time; it still produces all the files, which are shipped in the
          # tarball but not used by the build or the smoke test.
          pgbackrest/doc/release.py --dist --no-exe
 
          # Configure the build, which meson dist runs the code generator from to produce the shipped generated files
          meson setup build pgbackrest
 
          # Build the tarball. meson dist runs build/dist.sh to bake in the generated files, documentation, and dist marker.
          # --no-tests skips building and testing the extracted tarball here since that is exactly what the build jobs below do,
          # each on its own distribution.
          meson dist -C build --formats gztar --no-tests
 
      # Check that the tarball ships exactly what is needed to build and nothing else. build/dist.sh trims the distribution rather
      # than git archive, so a keep list that drifts is caught here instead of shipping a tarball full of tooling and test data.
      # Everything under src collapses to the directory since it changes too often to list, except the generated *.auto.c.inc code,
      # which is listed so a failed generation is caught. Only the path list is compared, not sizes or timestamps, so the zero-size
      # check below catches a file that exists but was generated or rendered empty. Update the list when the shipped file set
      # changes.
      - name: Check Tarball
        run: |
          diff - <(tar tzf build/meson-dist/pgbackrest-*.tar.gz \
              | sed 's#^pgbackrest-[^/]*/##' \
              | grep -v -e '/$' -e '^$' \
              | sed -E '\%^src/(command/help/help|postgres/interface)\.auto\.c\.inc$%!s#^src/.*#src/#' \
              | LC_ALL=C sort -u) <<'EOF'
          LICENSE
          README.md
          dist
          doc/html/command.html
          doc/html/configuration.html
          doc/html/default.css
          doc/html/default.js
          doc/html/faq.html
          doc/html/index.html
          doc/html/logo.svg
          doc/html/release.html
          doc/html/slogo.svg
          doc/html/user-guide-index.html
          doc/html/user-guide-rhel.html
          doc/html/user-guide.html
          doc/man/pgbackrest.1.txt
          meson.build
          meson_options.txt
          src/
          src/command/help/help.auto.c.inc
          src/postgres/interface.auto.c.inc
          test/meson.build
          test/smoke.py
          EOF
 
          # Confirm no file in the tarball is zero size, which would pass the path check above but indicate a broken generation or
          # render. Directory entries are also zero size so they are skipped.
          tar tzvf build/meson-dist/pgbackrest-*.tar.gz \
              | awk '$1 !~ /^d/ && $3 == 0 { print "ERROR: zero-size file: " $NF; rc = 1 } END { exit rc }'
 
      # The release process depends on the upload filename so do not modify it without also modifying the release process
      - name: Upload Tarball
        uses: actions/upload-artifact@v7
        with:
          name: dist-tarball
          path: build/meson-dist/pgbackrest-*.tar.gz
          if-no-files-found: error
 
  # Build and smoke test the tarball on each distribution in a fresh container that has only the required packages plus the
  # distribution's native PostgreSQL. The PostgreSQL version is the one native to the distribution, which is fixed for its life, so
  # it is not discovered here.
  build:
    needs: dist
    runs-on: ubuntu-24.04
 
    strategy:
      # Let all the jobs run to completion even if one fails
      fail-fast: false
 
      matrix:
        # The image is the whole matrix so the job name is just the image, which is unambiguous. Each image's native PostgreSQL,
        # fixed for the life of the distribution, is what the smoke test discovers and runs against.
        image:
          - debian:12
          - debian:13
          - ubuntu:22.04
          - ubuntu:26.04
          - rockylinux/rockylinux:8
          - rockylinux/rockylinux:9
          - rockylinux/rockylinux:10
          - fedora:44
          - alpine:3.21
          - alpine:3.24
 
    steps:
      - name: Download Tarball
        uses: actions/download-artifact@v7
        with:
          name: dist-tarball
          path: dist
 
      # Install the packages a packager would install, extract the tarball, build it, and run the smoke test, which finds the
      # native PostgreSQL and drives a full backup/restore/verify cycle against it. The package set is chosen by the package manager
      # present so a new version of a distribution needs only a new image in the matrix above. meson compile is used rather than
      # ninja because the ninja backend is invoked differently across distributions (e.g. ninja-build on RHEL); meson selects it.
      - name: Build and Smoke Test
        run: |
          docker run --rm -i -v ${GITHUB_WORKSPACE?}/dist:/dist:ro ${{ matrix.image }} /bin/sh -eux <<'SCRIPT'
          # Install the build environment and the native PostgreSQL, choosing the package set for the package manager present
          if command -v apt-get >/dev/null; then
              export DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true
              apt-get update
              apt-get install -y --no-install-recommends meson gcc pkg-config libpq-dev libssl-dev libxml2-dev \
                  liblz4-dev libzstd-dev libbz2-dev zlib1g-dev postgresql
          elif command -v dnf >/dev/null; then
              # Tune dnf to fail over from a slow mirror. By default a mirror is only abandoned when it delivers less than 1000
              # bytes per second for 30 seconds, so a mirror that has not failed but is crawling is retried rather than dropped.
              # Raise the rate floor well above that, shorten the timeout, sort mirrors by latency, and fetch in parallel.
              { echo minrate=50k; echo timeout=20; echo retries=5; echo max_parallel_downloads=10; \
                echo fastestmirror=True; } >> /etc/dnf/dnf.conf
 
              # RHEL-family (Rocky) needs EPEL and the CodeReady Builder repo for meson and the -devel packages; Fedora has them in
              # the main repo and has neither.
              case "${{ matrix.image }}" in
                  rockylinux/*)
                      dnf install -y epel-release dnf-plugins-core
 
                      # The CRB repo is named powertools on EL8; remove this branch when rockylinux/rockylinux:8 is dropped.
                      if [ "${{ matrix.image }}" = "rockylinux/rockylinux:8" ]; then
                          dnf config-manager --set-enabled powertools
                      else
                          dnf config-manager --set-enabled crb
                      fi
                      ;;
              esac
 
              dnf install -y meson gcc pkgconf-pkg-config libpq-devel openssl-devel libxml2-devel \
                  lz4-devel libzstd-devel bzip2-devel zlib-devel postgresql-server
          else
              # Alpine. postgresql-client provides psql, which the smoke test needs alongside the server.
              apk add meson gcc musl-dev pkgconf libpq-dev openssl-dev libxml2-dev \
                  lz4-dev zstd-dev bzip2-dev zlib-dev postgresql postgresql-client
          fi
 
          # Extract the tarball into a world-traversable path so the unprivileged postgres user the smoke test drops to can reach
          # the built binary
          mkdir -p /build
          tar -xzf /dist/pgbackrest-*.tar.gz -C /build --strip-components=1
          cd /build
 
          # Build with only the packages installed above -- no code generation or documentation tooling. -Dwerror turns any
          # compiler warning into an error so a warning on any distribution's compiler fails the job and gets fixed.
          meson setup -Dwerror=true build .
          meson compile -C build
 
          # Run the smoke test exactly as documented for packagers
          meson test -C build --suite smoke -v
          SCRIPT