Skip to content

Commit d53d691

Browse files
authored
test: Add parallel workflow (#74)
1 parent 79223f6 commit d53d691

File tree

6 files changed

+85
-13
lines changed

6 files changed

+85
-13
lines changed

.github/workflows/example.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ jobs:
5454
with:
5555
version: ${{matrix.cloudquery-version}}
5656
- name: Sync with CloudQuery
57-
run: cloudquery sync example_configs
57+
run: cloudquery sync example_configs/serial.yml --log-console
5858
- uses: actions/upload-artifact@v3
5959
if: always()
6060
with:
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: CloudQuery Parallel
2+
on:
3+
push:
4+
branches:
5+
- main
6+
pull_request:
7+
types: [opened, synchronize, reopened]
8+
jobs:
9+
cloudquery:
10+
permissions:
11+
id-token: write
12+
contents: read
13+
runs-on: ubuntu-latest
14+
strategy:
15+
matrix:
16+
region: [us-east-1, us-east-2, us-west-1, us-west-2, eu-west-1, eu-west-2] # List of regions to sync in parallel
17+
services:
18+
postgres:
19+
image: postgres:latest
20+
env:
21+
POSTGRES_USER: postgres
22+
POSTGRES_PASSWORD: pass
23+
POSTGRES_DB: postgres
24+
ports:
25+
- 5432:5432
26+
# Set health checks to wait until postgres has started
27+
options: >-
28+
--health-cmd pg_isready
29+
--health-interval 10s
30+
--health-timeout 5s
31+
--health-retries 5
32+
steps:
33+
- uses: actions/checkout@v3 # Checkout the code so we have access to the config file
34+
- name: Set region in config file
35+
uses: jacobtomlinson/gha-find-replace@657b0d1fe020da9943d1702b576f5d37d43b9c03
36+
with:
37+
include: example_configs/parallel.yml
38+
find: REGION_PLACEHOLDER
39+
replace: ${{ matrix.region }}
40+
- name: Configure AWS credentials
41+
uses: aws-actions/configure-aws-credentials@v1
42+
with:
43+
role-to-assume: arn:aws:iam::615713231484:role/cq-playground-aws-github-action
44+
aws-region: us-east-1
45+
- uses: cloudquery/setup-cloudquery@v2
46+
name: Setup CloudQuery
47+
- name: Sync with CloudQuery
48+
run: cloudquery sync example_configs/parallel.yml --log-console
49+
env:
50+
CQ_DSN: postgresql://postgres:pass@localhost:5432/postgres?sslmode=disable
51+
- uses: actions/upload-artifact@v3 # Upload logs as a GitHub actions artifact
52+
if: always()
53+
with:
54+
name: 'cloudquery.log'
55+
path: 'cloudquery-${{ matrix.region }}.log'

example_configs/aws.yml

Lines changed: 0 additions & 5 deletions
This file was deleted.

example_configs/dest.yml

Lines changed: 0 additions & 7 deletions
This file was deleted.

example_configs/parallel.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
kind: source
2+
spec:
3+
name: 'aws'
4+
path: cloudquery/aws
5+
version: 'v3.4.2' # latest version of aws plugin
6+
destinations: ['postgresql']
7+
spec:
8+
regions:
9+
- REGION_PLACEHOLDER # This will be replaced by the GitHub Action matrix value
10+
---
11+
kind: destination
12+
spec:
13+
name: 'postgresql'
14+
path: cloudquery/postgresql
15+
version: 'v1.3.3' # latest version of postgresql plugin
16+
spec:
17+
connection_string: ${CQ_DSN} # The CQ_DSN environment variable will be set by GitHub Action workflow

example_configs/serial.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
kind: source
2+
spec:
3+
name: 'aws'
4+
version: 'v3.4.2' # latest version of aws plugin
5+
destinations: ['postgresql']
6+
---
7+
kind: destination
8+
spec:
9+
name: 'postgresql'
10+
version: 'v1.3.3' # latest version of postgresql plugin
11+
spec:
12+
connection_string: 'postgresql://postgres:pass@localhost:5432/postgres?sslmode=disable'

0 commit comments

Comments
 (0)