|
| 1 | +name: Linux Build |
| 2 | +run-name: psql ODBC Linux CI - ${{ github.event.head_commit.message }} |
| 3 | + |
| 4 | +on: |
| 5 | + push: |
| 6 | + branches: [ "main" ] |
| 7 | + pull_request: |
| 8 | + branches: [ "main" ] |
| 9 | + workflow_dispatch: |
| 10 | + |
| 11 | +permissions: |
| 12 | + contents: read |
| 13 | + |
| 14 | +jobs: |
| 15 | + build-and-test: |
| 16 | + strategy: |
| 17 | + fail-fast: false |
| 18 | + matrix: |
| 19 | + include: |
| 20 | + - os: ubuntu-latest |
| 21 | + name: Debian (Ubuntu) |
| 22 | + - os: ubuntu-latest |
| 23 | + name: Red Hat (Fedora) |
| 24 | + container: fedora:latest |
| 25 | + |
| 26 | + name: ${{ matrix.name }} |
| 27 | + runs-on: ${{ matrix.os }} |
| 28 | + container: ${{ matrix.container || '' }} |
| 29 | + |
| 30 | + steps: |
| 31 | + - name: Install dependencies (Debian) |
| 32 | + if: matrix.container == '' |
| 33 | + run: | |
| 34 | + sudo apt-get update |
| 35 | + sudo apt-get install -y \ |
| 36 | + build-essential autoconf automake libtool \ |
| 37 | + libpq-dev unixodbc-dev unixodbc \ |
| 38 | + postgresql postgresql-client |
| 39 | + if ! command -v odbc_config >/dev/null 2>&1; then |
| 40 | + sudo tee /usr/local/bin/odbc_config > /dev/null <<'EOF' |
| 41 | + #!/bin/sh |
| 42 | + case $1 in |
| 43 | + --include-prefix) echo "/usr/include" ;; |
| 44 | + --lib-prefix) echo "/usr/lib" ;; |
| 45 | + --libs) echo "-lodbc" ;; |
| 46 | + *) echo "$0: unknown argument '$1'"; exit 1 ;; |
| 47 | + esac |
| 48 | + EOF |
| 49 | + sudo chmod +x /usr/local/bin/odbc_config |
| 50 | + fi |
| 51 | +
|
| 52 | + - name: Install dependencies (Fedora) |
| 53 | + if: matrix.container == 'fedora:latest' |
| 54 | + run: | |
| 55 | + dnf install -y \ |
| 56 | + gcc make autoconf automake libtool \ |
| 57 | + libpq-devel unixODBC-devel postgresql-server postgresql \ |
| 58 | + diffutils git |
| 59 | +
|
| 60 | + - name: Checkout |
| 61 | + uses: actions/checkout@v4 |
| 62 | + |
| 63 | + - name: Bootstrap |
| 64 | + run: autoreconf -fi |
| 65 | + |
| 66 | + - name: Configure |
| 67 | + run: | |
| 68 | + PG_CONFIG=$(find /usr -name pg_config -type f 2>/dev/null | head -1) |
| 69 | + if [ -n "$PG_CONFIG" ]; then |
| 70 | + export PATH="$(dirname $PG_CONFIG):$PATH" |
| 71 | + fi |
| 72 | + ./configure |
| 73 | +
|
| 74 | + - name: Build |
| 75 | + run: make -j$(nproc) |
| 76 | + |
| 77 | + - name: Start PostgreSQL (Debian) |
| 78 | + if: matrix.container == '' |
| 79 | + run: | |
| 80 | + sudo mkdir -p /var/run/postgresql |
| 81 | + sudo chown postgres:postgres /var/run/postgresql |
| 82 | + sudo pg_ctlcluster $(pg_lsclusters -h | head -1 | awk '{print $1, $2}') start |
| 83 | + sudo -u postgres createuser -s runner |
| 84 | + sudo -u postgres createdb contrib_regression |
| 85 | +
|
| 86 | + - name: Start PostgreSQL (Fedora) |
| 87 | + if: matrix.container == 'fedora:latest' |
| 88 | + run: | |
| 89 | + mkdir -p /var/lib/pgsql/data /var/run/postgresql |
| 90 | + chown postgres:postgres /var/lib/pgsql/data /var/run/postgresql |
| 91 | + su postgres -c 'initdb -D /var/lib/pgsql/data' || { echo "initdb failed"; exit 1; } |
| 92 | + su postgres -c "sed -i 's/^logging_collector = on/logging_collector = off/' /var/lib/pgsql/data/postgresql.conf" |
| 93 | + su postgres -c 'pg_ctl -D /var/lib/pgsql/data -l /tmp/pg.log -t 30 start' || { cat /tmp/pg.log; exit 1; } |
| 94 | + su postgres -c 'createuser -s root' |
| 95 | + createdb contrib_regression |
| 96 | +
|
| 97 | + - name: Test |
| 98 | + run: | |
| 99 | + cd test |
| 100 | + make installcheck |
0 commit comments