-
Notifications
You must be signed in to change notification settings - Fork 0
90 lines (75 loc) · 2.87 KB
/
Copy pathbuild-test.yml
File metadata and controls
90 lines (75 loc) · 2.87 KB
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
name: MyEnergy Build and Test
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
jobs:
test:
runs-on: ubuntu-latest
services:
timescaledb:
image: timescale/timescaledb-ha:pg17
env:
POSTGRES_PASSWORD: postgres
POSTGRES_DB: tsdb
ports:
- 25432:5432
options: >-
--health-cmd "pg_isready -U postgres"
--health-interval 10s
--health-timeout 5s
--health-retries 10
steps:
- uses: actions/checkout@v6
- name: Sqitch install
run: docker pull sqitch/sqitch && curl -L https://git.io/JJKCn -o /usr/local/bin/sqitch && chmod +x /usr/local/bin/sqitch && sqitch --help
- name: Setup DB
run: |
docker run --rm --network host postgres:17-alpine psql \
"postgresql://postgres:postgres@localhost:25432/postgres" \
-c "DO \$\$ BEGIN IF NOT EXISTS (SELECT FROM pg_roles WHERE rolname='tsdbadmin') THEN CREATE ROLE tsdbadmin LOGIN SUPERUSER PASSWORD 'tsdbadmin'; ELSE ALTER USER tsdbadmin WITH PASSWORD 'tsdbadmin'; END IF; END \$\$;"
docker run --rm --network host \
-v "$(pwd)/sqitch:/sqitch" postgres:17-alpine \
psql "postgresql://tsdbadmin:tsdbadmin@localhost:25432/tsdb" \
-f /sqitch/ci-bootstrap.sql
- name: Checkout flows-db
uses: actions/checkout@v6
with:
repository: cepro/simt-flows-db
path: flows-db
- name: Flows migrations
run: |
cd flows-db/sqitch && sqitch deploy "db:pg://tsdbadmin:tsdbadmin@localhost:25432/tsdb" \
--set flows_password=flows \
--set grafanareader_password=grafanareader \
--set tableau_password=tableau \
--set env=local \
--verbose && cd -
- name: Flows seed
run: |
docker run --rm --network host \
-v "$(pwd)/flows-db/sqitch/seed:/seed" postgres:17-alpine \
psql "postgresql://tsdbadmin:tsdbadmin@localhost:25432/tsdb" \
-f /seed/seed.sql
- name: Migrations
run: |
cd sqitch && sqitch deploy --target timescale-ci \
--set postgraphile_password=postgraphile \
--verbose && cd -
# uncomment the following to be able to ssh in and investigate an issue:
#
# - name: Setup tmate session
# if: success() || failure()
# uses: mxschmitt/action-tmate@v3
- name: create .pgpass for seed script
run: mkdir -p /tmp/psql-script/ && echo "*:*:*:tsdbadmin:tsdbadmin" > /tmp/psql-script/.pgpass && chmod 0600 /tmp/psql-script/.pgpass
- name: Seed
run: bin/seed
- name: Test
env:
PGPASSWORD: tsdbadmin
run: bin/test
# TODO: Was using supabase lint - replace with something else
# - name: Lint
# run: bin/supa-lint