-
Notifications
You must be signed in to change notification settings - Fork 27
89 lines (87 loc) · 4.02 KB
/
test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
name: q3c
# Run this workflow every time a new commit pushed to your repository
on:
push:
branches:
- '*'
tags:
- '*'
pull_request:
jobs:
tester:
name: Test the code
runs-on: ubuntu-22.04
strategy:
matrix:
container: ['ubuntu:22.04']
compiler: [gcc]
PGVERSION: [12, 13, 14, 15, 16, 17]
COVERAGE: ['0']
APT: ['1']
include:
- APT: '0'
COVERAGE: '1'
compiler: 'gcc'
- APT: '0'
COVERAGE: '0'
compiler: 'clang'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: PG cleanup
run: |
sudo apt-get -y --purge remove postgresql libpq-dev libpq5 postgresql-client-common postgresql-common
sudo apt-get -y install python3 python3-pip lcov
sudo pip install cpp-coveralls
sudo rm -rf /var/lib/postgresql
- if: ${{ matrix.APT == '1' }}
name: PG APT setup
run: |
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo sh -c "echo deb http://apt.postgresql.org/pub/repos/apt/ jammy-pgdg main ${{ matrix.PGVERSION }} >> /etc/apt/sources.list.d/postgresql.list"
sudo sh -c "echo deb http://apt.postgresql.org/pub/repos/apt/ jammy-pgdg-testing main ${{ matrix.PGVERSION }} >> /etc/apt/sources.list.d/postgresql.list"
sudo apt-get update -qq
sudo apt-get -y -o Dpkg::Options::=--force-confdef -o Dpkg::Options::="--force-confnew" install postgresql-${{ matrix.PGVERSION }} postgresql-server-dev-${{ matrix.PGVERSION }}
sudo chmod 777 /etc/postgresql/${{ matrix.PGVERSION}}/main/pg_hba.conf
sudo echo "local all postgres trust" > /etc/postgresql/${{ matrix.PGVERSION }}/main/pg_hba.conf
sudo echo "local all all trust" >> /etc/postgresql/${{ matrix.PGVERSION }}/main/pg_hba.conf
sudo echo "host all all 127.0.0.1/32 trust" >> /etc/postgresql/${{ matrix.PGVERSION }}/main/pg_hba.conf
sudo echo "host all all ::1/128 trust" >> /etc/postgresql/${{ matrix.PGVERSION }}/main/pg_hba.conf
sudo /etc/init.d/postgresql restart
createuser -U postgres -s runner
- if: ${{ matrix.APT == '0' }}
name: PG source setup
run: |
export CC=${{ matrix.compiler }}
wget https://ftp.postgresql.org/pub/source/v14.10/postgresql-14.10.tar.bz2
tar xfj postgresql-14.10.tar.bz2
mv postgresql-14.10 ../
cd ../postgresql-14.10/
if [[ ${{ matrix.COVERAGE }} == 1 ]] ; then ./configure --enable-coverage --prefix=$PWD/../pg_install/ ; else ./configure --prefix=$PWD/../pg_install/ ; fi
make install
../pg_install/bin/initdb -D ../pg_install/data
../pg_install/bin/postgres -D ../pg_install/data &
sleep 2
- name: Build q3c
run: |
if [[ ${{ matrix.APT }} == 0 ]] ; then export PATH=$PWD/../pg_install/bin/:$PATH ; fi
if [[ ${{ matrix.COVERAGE }} == 1 ]] ; then export Q3C_NOOPT=1 ; fi
make
sudo PATH=$PWD/../pg_install/bin/:$PATH make install
- name: Test
run: |
if [[ ${{ matrix.APT }} == 0 ]] ; then export PATH=$PWD/../pg_install/bin/:$PATH ; fi
make test
- name: UpdateExtension
run: |
if [[ ${{ matrix.APT }} == 0 ]] ; then export PATH=$PWD/../pg_install/bin/:$PATH ; fi
createdb exttest
psql -c "create extension q3c version '2.0.0'" exttest
psql -c "alter extension q3c update to '2.0.1'" exttest
- if: ${{ matrix.COVERAGE == '1' }}
name: Coverall
run: |
export TRAVIS_JOB_ID=$GITHUB_RUN_ID
cpp-coveralls --verbose --exclude postgres.h --exclude pg_list.h --exclude stdio2.h --exclude dump.c --gcov-options '\-lp'
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}