Source gem #1227
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: Source gem | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| - cron: "0 5 * * 3" # At 05:00 on Wednesday # https://crontab.guru/#0_5_*_*_3 | |
| push: | |
| branches: | |
| - master | |
| tags: | |
| - "*.*.*" | |
| pull_request: | |
| types: [opened, synchronize] | |
| branches: | |
| - "*" | |
| permissions: | |
| contents: read | |
| jobs: | |
| job_build_gem: | |
| name: Build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - name: Set up Ruby | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: "3.2" | |
| - name: Build source gem | |
| run: gem build pg.gemspec | |
| - name: Upload source gem | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: source-gem | |
| path: "*.gem" | |
| job_test_gem: | |
| name: Test | |
| needs: job_build_gem | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: windows | |
| ruby: "head" | |
| PGVERSION: 18.0-1-windows-x64 | |
| PGVER: "18" | |
| - os: windows | |
| ruby: "3.2" | |
| PGVERSION: 10.20-1-windows-x64 | |
| PGVER: "10" | |
| - os: windows | |
| ruby: "mswin" | |
| PGVERSION: 18.0-1-windows-x64 | |
| PGVER: "18" | |
| - os: ubuntu | |
| ruby: "head" | |
| PGVER: "18" | |
| - os: ubuntu | |
| ruby: "3.2" | |
| PGVER: "12" | |
| - os: ubuntu | |
| os_ver: "22.04" | |
| ruby: "2.7" | |
| PGVER: "10" | |
| - os: ubuntu | |
| ruby: "truffleruby" | |
| PGVER: "14" | |
| - os: ubuntu | |
| ruby: "truffleruby-head" | |
| PGVER: "18" | |
| - os: macos | |
| ruby: "head" | |
| PGVERSION: 18.0-2-osx | |
| PGVER: "18" | |
| runs-on: ${{ matrix.os }}-${{ matrix.os_ver || 'latest' }} | |
| env: | |
| PGVERSION: ${{ matrix.PGVERSION }} | |
| PGVER: ${{ matrix.PGVER }} | |
| MAKE: make -j2 V=1 | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - name: Set up Ruby | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: ${{ matrix.ruby }} | |
| - name: Print tool versions | |
| run: | | |
| ruby -v | |
| gem env | |
| gcc -v | |
| - name: Download gem from build job | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: source-gem | |
| - name: Install required packages Windows | |
| if: matrix.os == 'windows' && matrix.ruby != 'mswin' | |
| shell: cmd | |
| run: ridk exec sh -c "pacman --sync --needed --noconfirm ${MINGW_PACKAGE_PREFIX}-gcc" | |
| - run: bundle install | |
| - name: Download PostgreSQL Windows | |
| if: matrix.os == 'windows' | |
| run: | | |
| Add-Type -AssemblyName System.IO.Compression.FileSystem | |
| function Unzip { | |
| param([string]$zipfile, [string]$outpath) | |
| [System.IO.Compression.ZipFile]::ExtractToDirectory($zipfile, $outpath) | |
| } | |
| $(new-object net.webclient).DownloadFile("http://get.enterprisedb.com/postgresql/postgresql-$env:PGVERSION-binaries.zip", "postgresql-binaries.zip") | |
| Unzip "postgresql-binaries.zip" "." | |
| echo "$env:RI_DEVKIT$env:MINGW_PREFIX/bin;$env:RI_DEVKIT/usr/bin;$pwd/pgsql/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append | |
| echo "PGUSER=$env:USERNAME" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
| echo "PGPASSWORD=" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
| - name: Download PostgreSQL Ubuntu | |
| if: matrix.os == 'ubuntu' | |
| run: | | |
| sudo curl -o /usr/share/postgresql-common/pgdg/apt.postgresql.org.asc --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc | |
| echo "deb [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.asc] http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main $PGVER" | sudo tee /etc/apt/sources.list.d/pgdg.list | |
| sudo apt-get -y update | |
| sudo apt-get -y --allow-downgrades install postgresql-$PGVER libpq5=$PGVER* libpq-dev=$PGVER* | |
| echo /usr/lib/postgresql/$PGVER/bin >> $GITHUB_PATH | |
| - name: Download PostgreSQL Macos | |
| if: matrix.os == 'macos' | |
| run: | | |
| wget https://get.enterprisedb.com/postgresql/postgresql-$PGVERSION-binaries.zip && \ | |
| sudo mkdir -p /Library/PostgreSQL && \ | |
| sudo unzip postgresql-$PGVERSION-binaries.zip -d /Library/PostgreSQL/$PGVER && \ | |
| sudo mv /Library/PostgreSQL/$PGVER/pgsql/* /Library/PostgreSQL/$PGVER/ && \ | |
| echo /Library/PostgreSQL/$PGVER/bin >> $GITHUB_PATH | |
| - run: echo $env:PATH | |
| - run: gem install --local *.gem --verbose | |
| - name: Run specs | |
| env: | |
| PG_DEBUG: 0 | |
| # Temprary fix only for Truffleruby-24.0.0: | |
| TRUFFLERUBYOPT: --experimental-options --keep-handles-alive | |
| run: ruby -rpg -S rspec spec/*_spec.rb spec/**/*_spec.rb -cfdoc | |
| - name: Print db logs if job failed | |
| if: ${{ failure() && matrix.os == 'windows' }} | |
| run: ridk exec cat tmp_test_*/*.log | |
| - name: Print db logs if job failed | |
| if: ${{ failure() && matrix.os != 'windows' }} | |
| run: cat tmp_test_*/*.log | |
| - name: Print mkmf logs if job failed on Windows-head | |
| if: ${{ failure() && matrix.os == 'windows' && matrix.ruby == 'head' }} | |
| run: | | |
| ridk exec cat c:/rubyinstaller-head-*/lib/ruby/gems/*/extensions/*/*/*/mkmf.log || ridk exec cat d:/rubyinstaller-head-*/lib/ruby/gems/*/extensions/*/*/*/mkmf.log | |
| ridk exec gcc -v | |
| - name: Print mkmf logs if job failed on Macos-head | |
| if: ${{ failure() && matrix.os == 'macos' && matrix.ruby == 'head' }} | |
| run: | | |
| cat /Users/runner/.rubies/ruby-head/lib/ruby/gems/*/extensions/*/*/*/mkmf.log |