#1069 fix: S3 restore and upload atomicity with metadata safeguards #25
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - 0.20.x | |
| pull_request: | |
| branches: | |
| - main | |
| - 0.20.x | |
| workflow_dispatch: | |
| jobs: | |
| format-check: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Install clang-format | |
| run: | | |
| sudo apt update -y | |
| sudo apt install -y lsb-release wget software-properties-common gnupg | |
| wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo gpg --dearmor -o /usr/share/keyrings/llvm-snapshot.gpg | |
| echo "deb [signed-by=/usr/share/keyrings/llvm-snapshot.gpg] http://apt.llvm.org/$(lsb_release -cs)/ llvm-toolchain-$(lsb_release -cs)-21 main" | sudo tee /etc/apt/sources.list.d/llvm.list | |
| sudo apt update -y | |
| sudo apt remove -y clang-format 2>/dev/null || true | |
| sudo apt install -y clang-format-21 | |
| sudo ln -sf /usr/bin/clang-format-21 /usr/bin/clang-format | |
| - name: Check code formatting | |
| run: | | |
| ./clang-format.sh | |
| if ! git diff --quiet; then | |
| git diff | |
| echo "" | |
| echo "Please run './clang-format.sh' and commit the changes." | |
| exit 1 | |
| fi | |
| build-linux: | |
| needs: [format-check] | |
| runs-on: ubuntu-latest | |
| container: | |
| image: rockylinux/rockylinux:10 | |
| strategy: | |
| matrix: | |
| compiler: [gcc, clang] | |
| build_type: [Debug, Release] | |
| pg_version: [14, 15, 17] | |
| exclude: | |
| - pg_version: 14 | |
| compiler: gcc | |
| build_type: Debug | |
| - pg_version: 14 | |
| compiler: gcc | |
| build_type: Release | |
| - pg_version: 14 | |
| compiler: clang | |
| build_type: Release | |
| - pg_version: 15 | |
| compiler: gcc | |
| build_type: Debug | |
| - pg_version: 15 | |
| compiler: gcc | |
| build_type: Release | |
| - pg_version: 15 | |
| compiler: clang | |
| build_type: Release | |
| fail-fast: false | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Install Dependencies | |
| run: | | |
| dnf -y install dnf-plugins-core | |
| dnf config-manager --set-enabled crb | |
| dnf -y install epel-release | |
| dnf -y install \ | |
| git gcc clang clang-tools-extra cmake make \ | |
| libev libev-devel openssl openssl-devel \ | |
| systemd systemd-devel zlib zlib-devel \ | |
| libzstd libzstd-devel lz4 lz4-devel \ | |
| libssh libssh-devel libatomic \ | |
| python3-docutils bzip2 bzip2-devel \ | |
| libarchive libarchive-devel libyaml-devel \ | |
| check check-devel llvm \ | |
| libasan libubsan \ | |
| net-tools procps-ng ncurses-devel \ | |
| util-linux sudo which zstd | |
| - name: Mark workspace as safe for git | |
| run: git config --global --add safe.directory "$GITHUB_WORKSPACE" | |
| - name: Install PostgreSQL v${{ matrix.pg_version }} | |
| run: | | |
| dnf install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-10-x86_64/pgdg-redhat-repo-latest.noarch.rpm | |
| dnf -qy module disable postgresql 2>/dev/null || true | |
| dnf install -y postgresql${{ matrix.pg_version }} postgresql${{ matrix.pg_version }}-server postgresql${{ matrix.pg_version }}-contrib postgresql${{ matrix.pg_version }}-libs postgresql${{ matrix.pg_version }}-devel | |
| - name: Set Env Path Variable | |
| run: | | |
| echo "PATH=/usr/pgsql-${{ matrix.pg_version }}/bin:$PATH" >> $GITHUB_ENV | |
| echo $PATH | |
| - name: Install pgmoneta_ext | |
| run: | | |
| git_repo="https://github.com/pgmoneta/pgmoneta_ext.git" | |
| cd /tmp/ | |
| git clone --branch "main" --single-branch --depth 1 "$git_repo" | |
| cd /tmp/pgmoneta_ext/ | |
| mkdir build | |
| cd /tmp/pgmoneta_ext/build/ | |
| cmake -DDOCS=false .. | |
| make | |
| make install | |
| - name: Build Project | |
| run: | | |
| mkdir build | |
| cd build | |
| if [ "${{ matrix.compiler }}" = "gcc" ]; then | |
| export CC=/usr/bin/gcc | |
| else | |
| export CC=/usr/bin/clang | |
| fi | |
| cmake -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DDOCS=FALSE .. | |
| make -j$(nproc) | |
| - name: Create test user | |
| run: | | |
| useradd -m -s /bin/bash runner | |
| echo "runner ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers | |
| chown -R runner:runner $GITHUB_WORKSPACE | |
| - name: Run Tests | |
| run: | | |
| export TEST_PG_VERSION=${{ matrix.pg_version }} | |
| if [ "${{ matrix.compiler }}" = "clang" ] && [ "${{ matrix.build_type }}" = "Debug" ]; then | |
| su - runner -c "cd $GITHUB_WORKSPACE && export TEST_PG_VERSION=${{ matrix.pg_version }} && export PATH=/usr/pgsql-${{ matrix.pg_version }}/bin:\$PATH && bash ./test/check.sh ci" | |
| fi | |
| - name: Report coverage summary | |
| if: matrix.compiler == 'clang' && matrix.build_type == 'Debug' | |
| run: | | |
| echo "## Coverage Summary" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo '```' >> $GITHUB_STEP_SUMMARY | |
| cat /tmp/pgmoneta-test/coverage/coverage-report-*.txt >> $GITHUB_STEP_SUMMARY | |
| echo '```' >> $GITHUB_STEP_SUMMARY | |
| - name: Upload All Coverage Reports as Artifact | |
| if: always() | |
| uses: actions/upload-artifact@v5 | |
| with: | |
| name: coverage-reports-${{ matrix.compiler }}-${{ matrix.build_type }}-${{ matrix.pg_version }} | |
| path: /tmp/pgmoneta-test/coverage | |
| retention-days: 90 | |
| - name: Upload Run Log as Artifacts | |
| if: always() | |
| uses: actions/upload-artifact@v5 | |
| with: | |
| name: logs-${{ matrix.compiler }}-${{ matrix.build_type }}-${{ matrix.pg_version }} | |
| path: /tmp/pgmoneta-test/log | |
| retention-days: 90 |