File tree Expand file tree Collapse file tree 9 files changed +256
-0
lines changed
Expand file tree Collapse file tree 9 files changed +256
-0
lines changed Original file line number Diff line number Diff line change 1+ name : SQLite FDW test
2+
3+ on :
4+ workflow_dispatch :
5+ pull_request :
6+ push :
7+ branches :
8+ - master
9+ - main
10+ jobs :
11+ detect-pgversion :
12+ runs-on : ubuntu-22.04
13+ outputs :
14+ pgversion : ${{ steps.detect-pgversion.outputs.targets }}
15+ steps :
16+ - uses : actions/checkout@v4
17+
18+ - name : detect-pgversion
19+ id : detect-pgversion
20+ run : |
21+ targets=`bash GitHubActions/detect_targets.sh`
22+ echo "targets=$targets" >> $GITHUB_OUTPUT
23+
24+ test :
25+ needs : detect-pgversion
26+ env :
27+ SQLITE_VERSION : " 3420000"
28+ SQLITE_YEAR : " 2023"
29+ HTTP_PROXY : " "
30+ HTTPS_PROXY : " "
31+ strategy :
32+ fail-fast : false
33+ matrix :
34+ pg : ${{ fromJSON(needs.detect-pgversion.outputs.pgversion) }}
35+
36+ name : Test on PostgreSQL ${{ matrix.pg }}
37+ runs-on : ubuntu-22.04
38+ steps :
39+ - uses : actions/checkout@v4
40+
41+ - name : tar
42+ run : tar zcvf sqlite_fdw.tar.gz ./*
43+
44+ - name : set_proxy
45+ run : bash GitHubActions/env.sh
46+
47+ - name : install locales
48+ run : bash GitHubActions/install_locales.sh
49+
50+ - name : build PostgreSQL ${{ matrix.pg }}
51+ run : bash GitHubActions/build_postgres.sh ${{ matrix.pg }}
52+
53+ - name : install SQLite
54+ run : bash GitHubActions/install_sqlite.sh ${{ env.SQLITE_VERSION }} ${{ env.SQLITE_YEAR }}
55+
56+ - name : build sqlite_fdw
57+ run : bash GitHubActions/build_sqlite_fdw.sh ${{ matrix.pg }}
58+
59+ - name : execute sqlite_fdw test
60+ run : bash GitHubActions/execute_test.sh ${{ matrix.pg }}
Original file line number Diff line number Diff line change 1+ # CI environment of sqlite_fdw.
2+
3+ Tests will be executed automatically when commited to main/master branch and when a pull request was opened/updated.
4+ It is realized by using GitHub actions.
5+
6+ The CI process is defined in .github/workflows/CI.yml file.
7+ Scripts in this directory (GitHubActions/* .sh) are referred by CI.yml.
8+
9+ The regression test will be executed for multi-versions of PostgreSQL.
10+ Target versions are determined automatically based on directory names in "sql" directory.
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ # ###############################################################################
4+ #
5+ # This script downloads PostgreSQL from the official web site into ./workdir
6+ # then builds it.
7+ #
8+ # Usage: ./build_postgres.sh pg_version
9+ # pg_version is a PostgreSQL version to be installed like 16.0.
10+ #
11+ # Requirements
12+ # - be able to connect to the PostgreSQL official web site by curl.
13+ #
14+ # ###############################################################################
15+
16+ VERSION=$1
17+ mkdir -p ./workdir
18+ cd ./workdir
19+ curl -O https://ftp.postgresql.org/pub/source/v${VERSION} /postgresql-${VERSION} .tar.bz2
20+ tar xjf postgresql-${VERSION} .tar.bz2
21+ cd postgresql-${VERSION}
22+ ./configure
23+ make
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ # ###############################################################################
4+ #
5+ # This script builds sqlite_fdw in PostgreSQL source tree.
6+ #
7+ # Usage: ./build_sqlite_fdw.sh pg_version
8+ # pg_version is a PostgreSQL version like 16.0 to be built in.
9+ #
10+ # Requirements
11+ # - the source code of sqlite_fdw is available by git clone.
12+ # - the source code of PostgreSQL is located in ~/workdir/postgresql-{pg_version}.
13+ # - SQLite development package is installed in a system.
14+ # ###############################################################################
15+
16+ VERSION=$1
17+ mkdir -p ./workdir/postgresql-${VERSION} /contrib/sqlite_fdw
18+ tar zxvf ./sqlite_fdw.tar.gz -C ./workdir/postgresql-${VERSION} /contrib/sqlite_fdw/
19+ cd ./workdir/postgresql-${VERSION} /contrib/sqlite_fdw
20+ export LD_LIBRARY_PATH=/usr/local/lib/:$LD_LIBRARY_PATH
21+ make
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ # ###############################################################################
4+ #
5+ # This script detects target PostgreSQL versions for sqlite_fdw testing from
6+ # directory names in ./sql directory. Detected versions will be outputed to
7+ # the standard output as an array of string like ["15.4","16.0"].
8+ #
9+ # Usage: ./detect_targets.sh
10+ #
11+ # Requirements
12+ # - there is a directory named "sql" in a curent directory.
13+ #
14+ # ###############################################################################
15+
16+ dirs=" ./sql/*"
17+ pattern=" [0-9]+\.[0-9]+"
18+ targets=" ["
19+ for pathname in $dirs ; do
20+ if [[ " $pathname " =~ $pattern ]]; then
21+ target=` basename $pathname `
22+ if [ " $targets " != " [" ]; then
23+ targets+=" ,"
24+ fi
25+ targets+=" \" $target \" "
26+ fi
27+ done
28+ targets+=" ]"
29+
30+ echo " $targets "
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ # ###############################################################################
4+ #
5+ # This script configures apt.conf to set a proxy if an environment variable
6+ # HTTP_PROXY or HTTPS_PROXY is set.
7+ #
8+ # Usage: ./env.sh
9+ #
10+ # Requirements
11+ # - having superuser privileges
12+ #
13+ # ###############################################################################
14+
15+ if [ -z $HTTP_PROXY ] && [ " $HTTP_PROXY " != " " ]; then
16+ echo ' Acquire::http::proxy "$HTTP_PROXY";' | sudo tee /etc/apt/apt.conf
17+ fi
18+ if [ -z $HTTPS_PROXY ] && [ " $HTTPS_PROXY " != " " ]; then
19+ echo ' Acquire::https::proxy "$HTTPS_PROXY";' | sudo tee -a /etc/apt/apt.conf
20+ fi
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ # ###############################################################################
4+ #
5+ # This script executes a regression test pf sqlite_fdw by calling test.sh in
6+ # sqlite_fdw. If all tests are passed, this script will exit successfully.
7+ # Otherwise, it will exit with failure.
8+
9+ # Usage: ./execute_test.sh pg_version
10+ # pg_version is a PostgreSQL version to be tested like 16.0.
11+ #
12+ # Requiremets
13+ # - the source code of PostgreSQL is located in ./workdir/postgresql-{pg_version}.
14+ # - the source code of sqlite_fdw is loacted in ./workdir/postgresql-{pg_version}/contrib/sqlite_fdw.
15+ # - PostgreSQL and sqlite_fdw were built.
16+ # - this script assumes that tests are passed if this file (created by executing
17+ # the test) contains " ALL {number} tests passed" at the last or the 3rd line
18+ # from the end.
19+ #
20+ # ###############################################################################
21+
22+ VERSION=$1
23+ cd ./workdir/postgresql-${VERSION} /contrib/sqlite_fdw
24+ chmod +x ./test.sh
25+ ./test.sh
26+
27+ last_line=$( tail -n 1 make_check.out)
28+ third_line_from_the_last=$( tail -n 3 make_check.out | head -n 1)
29+
30+ pattern=" All [0-9]+ tests passed.+"
31+
32+ if [[ " $last_line " =~ $pattern ]]; then
33+ echo " last_line"
34+
35+ elif [[ " $third_line_from_the_last " =~ $pattern ]]; then
36+ echo " $third_line_from_the_last "
37+ else
38+ echo " Error : not All the tests passed"
39+ echo " last line : '$last_line '"
40+ echo " thierd_line_from_the_last : '$third_line_from_the_last '"
41+ exit 1
42+ fi
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ # ###############################################################################
4+ #
5+ # This script installs some locales and language packs used by sqlite_fdw
6+ # tests in Ubuntu.
7+ #
8+ # Usage: ./install_locales.sh
9+ #
10+ # Requirements:
11+ # - having superuser privileges
12+ #
13+ # ###############################################################################
14+
15+ sudo apt-get update
16+ sudo apt-get install locales language-pack-ja
17+ sudo locale-gen ja_JP.EUC-JP
18+ sudo apt-get install language-pack-ko-base language-pack-ko
19+ sudo locale-gen ko_KR.EUC-KR
20+ sudo apt -get install language-pack-bg-base language-pack-bg
21+ sudo locale-gen bg_BG
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ # ###############################################################################
4+ #
5+ # This sript downloads SQLite source code from the official web site into
6+ # ./workdir then builds and installs it.
7+ #
8+ # Usage: ./install_sqlite.sh version year
9+ # version: SQLite version to be installed
10+ # year: A year of SQLite released. It is used for determining a download URL.
11+ #
12+ # Ex) ./install_sqlite.sh 3420000 2023
13+ #
14+ # Requirements
15+ # - be able to connect to the SQLite official web site by curl.
16+ # - having superuser privileges
17+ #
18+ # ###############################################################################
19+
20+ VERSION=$1
21+ YEAR=$2
22+ mkdir -p ./workdir
23+ cd ./workdir
24+ curl -O https://www.sqlite.org/${YEAR} /sqlite-src-${VERSION} .zip
25+ unzip sqlite-src-${VERSION} .zip
26+ cd sqlite-src-${VERSION}
27+ ./configure --enable-fts5
28+ make
29+ sudo make install
You can’t perform that action at this time.
0 commit comments