This repository has been archived by the owner on Aug 16, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 40
70 lines (64 loc) · 1.89 KB
/
test_policy_sql.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
# DONT EDIT. This file is synced from https://github.com/cloudquery/.github/.github
name: SQL Policy Validation Test
on:
push:
branches:
- main
pull_request:
branches:
- main
env:
CGO_ENABLED: 0
CQ_NO_TELEMETRY: 1
PGPASSWORD: pass
jobs:
SQLPolicyTest:
strategy:
matrix:
dbversion: [ "postgres:10" ]
go: [ "1.18" ]
platform: [ ubuntu-latest ] # can not run in macOS and widnowsOS
runs-on: ${{ matrix.platform }}
services:
postgres:
image: ${{ matrix.dbversion }}
env:
POSTGRES_PASSWORD: pass
POSTGRES_USER: postgres
POSTGRES_DB: postgres
ports:
- 5432:5432
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Check out code into the policy directory
uses: actions/checkout@v3
- name: Set up Go 1.x
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go }}
- uses: actions/cache@v3
with:
# In order:
# * Module download cache
# * Build cache (Linux)
# * Build cache (Mac)
# * Build cache (Windows)
path: |
~/go/pkg/mod
~/.cache/go-build
~/Library/Caches/go-build
~\AppData\Local\go-build
key: ${{ runner.os }}-go-${{ matrix.go }}-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-${{ matrix.go }}-
- name: Prepare for test - Create tables
run: |
go run ./test/gen-tables.go | psql -h localhost -p 5432 -U postgres -d postgres -w
- name: Run all policies
run: |
cd policies && psql -h localhost -p 5432 -U postgres -d postgres -w -f ./policy.sql