OSDN Git Service

Switch CI from Travis CI to GitHub Actions (#12) master
authorFujii Masao <masao.fujii@gmail.com>
Tue, 10 Oct 2023 16:04:05 +0000 (01:04 +0900)
committerGitHub <noreply@github.com>
Tue, 10 Oct 2023 16:04:05 +0000 (01:04 +0900)
Enable GitHub Actions and remove Travis CI for regression tests.

This commit enables GitHub Actions to run regression tests for pg_bigm.
GitHub Actions now tests on PostgreSQL 9.2 or later. Note that pg_bigm
supports PostgreSQL 9.1, but it can't be compiled on the latest Ubuntu
used in GitHub Actions, so tests are omitted for v9.1.

Also this commit discontinues the use of Travis CI as our CI service for
running regression tests due to issues that prevented successful
test execution.

Back-patch to pg_bigm 1.2.

.github/workflows/test.yml [new file with mode: 0644]
.travis.yml [deleted file]
README.md

diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
new file mode 100644 (file)
index 0000000..ddf067a
--- /dev/null
@@ -0,0 +1,70 @@
+name: test
+
+on:
+  push:
+    branches:
+      - "*"
+
+jobs:
+  test:
+    name: regression test
+    runs-on: ubuntu-latest
+    strategy:
+      fail-fast: true
+      matrix:
+        pgbranch:
+          - master
+          - REL_16_STABLE
+          - REL_15_STABLE
+          - REL_14_STABLE
+          - REL_13_STABLE
+          - REL_12_STABLE
+          - REL_11_STABLE
+          - REL_10_STABLE
+          - REL9_6_STABLE
+          - REL9_5_STABLE
+          - REL9_4_STABLE
+          - REL9_3_STABLE
+          - REL9_2_STABLE
+    env:
+      PGBRANCH: ${{ matrix.pgbranch }}
+    steps:
+    - uses: actions/checkout@v4
+    - name: set_env
+      run: |
+        echo "PGHOME=${HOME}/${PGBRANCH}" >> $GITHUB_ENV
+        echo "PGDATA=${HOME}/pgdata" >> $GITHUB_ENV
+    - name: add_path
+      run: |
+        echo "${PGHOME}/bin" >> $GITHUB_PATH
+    - name: before_install
+      run: |
+        git clone -b ${PGBRANCH} --depth 1 https://github.com/postgres/postgres.git
+        cd postgres
+        ./configure --prefix=${PGHOME} --enable-debug --enable-cassert
+        make -j 2 -s
+        make -s install
+        cd contrib/pg_trgm
+        make -j 2 -s
+        make -s install
+        cd ../..
+        initdb -D ${PGDATA} --locale=C --encoding=UTF8
+        pg_ctl -D ${PGDATA} -w start
+    - name: before_script
+      run: |
+        cd ${GITHUB_WORKSPACE}
+        make USE_PGXS=1 PG_CONFIG=${PGHOME}/bin/pg_config
+        make USE_PGXS=1 PG_CONFIG=${PGHOME}/bin/pg_config install
+    - name: script
+      run: |
+        make USE_PGXS=1 PG_CONFIG=${PGHOME}/bin/pg_config installcheck
+        make USE_PGXS=1 PG_CONFIG=${PGHOME}/bin/pg_config installcheck-trgm
+    - name: after_script_failure
+      if: failure()
+      run: |
+        if [ -f regression.diffs ]; then cat regression.diffs; fi
+        exit 1
+    - name: after_script_success
+      if: success()
+      run: |
+        echo "SUCCESS"
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644 (file)
index 6e6e817..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-language: c
-
-compiler: gcc
-
-env:
-   matrix:
-      - PGBRANCH=master
-      - PGBRANCH=REL_15_STABLE
-      - PGBRANCH=REL_14_STABLE
-      - PGBRANCH=REL_13_STABLE
-      - PGBRANCH=REL_12_STABLE
-      - PGBRANCH=REL_11_STABLE
-      - PGBRANCH=REL_10_STABLE
-      - PGBRANCH=REL9_6_STABLE
-      - PGBRANCH=REL9_5_STABLE
-      - PGBRANCH=REL9_4_STABLE
-      - PGBRANCH=REL9_3_STABLE
-      - PGBRANCH=REL9_2_STABLE
-      - PGBRANCH=REL9_1_STABLE
-
-before_install:
-   - sudo service postgresql stop
-   - CURDIR=$(pwd)
-   - PGHOME=${CURDIR}/${PGBRANCH}
-   - PGDATA=${PGHOME}/data
-   - PGSRC=${CURDIR}/postgres
-   - TRGMSRC=${PGSRC}/contrib/pg_trgm
-   - git clone https://github.com/postgres/postgres.git
-   - cd ${PGSRC}
-   - git checkout ${PGBRANCH}
-   - ./configure --prefix=${PGHOME} --enable-debug --enable-cassert
-   - make -j 2
-   - make install
-   - cd ${TRGMSRC}
-   - make install
-   - export PATH=${PATH}:${PGHOME}/bin
-   - initdb -D ${PGDATA} --locale=C --encoding=UTF8
-   - pg_ctl -D ${PGDATA} -w start
-
-before_script:
-   - cd ${CURDIR}
-   - make USE_PGXS=1 PG_CONFIG=${PGHOME}/bin/pg_config
-   - make USE_PGXS=1 PG_CONFIG=${PGHOME}/bin/pg_config install
-
-script:
-   - make USE_PGXS=1 PG_CONFIG=${PGHOME}/bin/pg_config installcheck
-   - make USE_PGXS=1 PG_CONFIG=${PGHOME}/bin/pg_config installcheck-trgm
-
-after_script:
-   - if [ -f regression.diffs ]; then cat regression.diffs; fi
-   - pg_ctl -D ${PGDATA} stop
-
-notifications:
-   email:
-      on_success: change
-      on_failure: always
index 5a9628b..a816324 100644 (file)
--- a/README.md
+++ b/README.md
@@ -5,7 +5,7 @@ This module allows a user to create **2-gram** (bigram) index for faster full te
 pg_bigm is released under the [PostgreSQL License](https://opensource.org/licenses/postgresql), a liberal Open Source license, similar to the BSD or MIT licenses.
 
 ## Test Status
-[![Build Status](https://travis-ci.com/pgbigm/pg_bigm.svg?branch=master)](https://travis-ci.com/github/pgbigm/pg_bigm)
+[![Build Status](https://github.com/pgbigm/pg_bigm/actions/workflows/test.yml/badge.svg)](https://github.com/pgbigm/pg_bigm/actions/workflows/test.yml)
 
 ## Documentation
 ### English