-
Notifications
You must be signed in to change notification settings - Fork 16
135 lines (109 loc) · 3.97 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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
name: FDW Acceptance Tests
on:
pull_request:
jobs:
golangci_lint:
name: golangci-lint
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.21
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
continue-on-error: true # we dont want to enforce just yet
with:
version: v1.52.2
args: --timeout=15m --config=.golangci.yml
build_and_test:
name: Build and run tests
needs: golangci_lint
runs-on: ubuntu-20.04
steps:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.21
- name: Checkout Steampipe
uses: actions/checkout@v4
with:
submodules: true
repository: turbot/steampipe
path: steampipe
- name: Build Steampipe
run: |
echo "PATH=$PATH:$HOME/build:/home/runner" >> $GITHUB_ENV
ls /home/runner/work/steampipe-postgres-fdw/steampipe-postgres-fdw
cd /home/runner/work/steampipe-postgres-fdw/steampipe-postgres-fdw/steampipe
go get
go build -o /home/runner/steampipe
- name: Run steampipe
run: |
steampipe query "select 1 as col"
- name: Checkout FDW
uses: actions/checkout@v4
with:
repository: turbot/steampipe-postgres-fdw
path: steampipe-postgres-fdw
- name: Fetching Go Cache Paths
id: go-cache-paths
run: |
echo "go-build=$(go env GOCACHE)" >> $GITHUB_OUTPUT
echo "go-mod=$(go env GOMODCACHE)" >> $GITHUB_OUTPUT
- name: Go Build Cache
id: build-cache
uses: actions/cache@v3
with:
path: ${{ steps.go-cache-paths.outputs.go-build }}
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}
- name: Go Mod Cache
id: mod-cache
uses: actions/cache@v3
with:
path: ${{ steps.go-cache-paths.outputs.go-mod }}
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}
- name: Setup apt-get
run: |-
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo env ACCEPT_EULA=Y apt-get update
sudo env ACCEPT_EULA=Y apt-get upgrade
- name: Install PostgreSQL14 Dev
run: |-
sudo apt-get -y install postgresql-server-dev-14
- name: Find stuff and set env
run: |-
which pg_config
pg_config --version
export PATH=$(pg_config --bindir):$PATH
export PGXS=$(pg_config --pgxs)
export SERVER_LIB=$(pg_config --includedir)/14/server
export INTERNAL_LIB=$(pg_config --includedir)/internal
export CFLAGS="$(pg_config --cflags) -I${SERVER_LIB} -I${INTERNAL_LIB} -g"
export PG_CFLAGS="$(pg_config --cflags) -I${SERVER_LIB} -I${INTERNAL_LIB} -g"
export LDFLAGS=$(pg_config --ldflags)
export PG_LDFLAGS=$(pg_config --ldflags)
ls -la $SERVER_LIB
ls -la $INTERNAL_LIB
- name: Build FDW
run: |
cd ~/work/steampipe-postgres-fdw/steampipe-postgres-fdw/steampipe-postgres-fdw/
make install
- name: Setup BATS
uses: mig4/setup-bats@v1
with:
bats-version: 1.2.1
- name: Install Chaos plugin from registry
run: steampipe plugin install chaos
- name: Go install jd
run: |
go install github.com/josephburnett/jd@latest
- name: Run tests
timeout-minutes: 6
run: |
cd /home/runner/work/steampipe-postgres-fdw/steampipe-postgres-fdw/steampipe
chmod +x tests/acceptance/run.sh
./tests/acceptance/run.sh chaos_and_query.bats