Skip to content

Commit 93900af

Browse files
committed
Branch from shared EdgeDB instance to reduce startup time
1 parent 22ba014 commit 93900af

File tree

6 files changed

+56
-5
lines changed

6 files changed

+56
-5
lines changed

.github/actions/edgedb-setup/action.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,25 @@
11
name: Setup EdgeDB
22
description: 'Setup EdgeDB server, migrate schema, generate TS files'
3+
4+
inputs:
5+
dsn:
6+
description: EdgeDB DSN
7+
38
runs:
49
using: composite
510
steps:
611
- name: Setup EdgeDB
712
uses: edgedb/setup-edgedb@v1
13+
with:
14+
cli-version: nightly
15+
server-dsn: ${{ inputs.dsn }}
16+
17+
- name: Branch & Migrate
18+
shell: bash
19+
run: |
20+
edgedb branch create github_$GITHUB_RUN_ID_$GITHUB_JOB
21+
edgedb branch switch github_$GITHUB_RUN_ID_$GITHUB_JOB
22+
edgedb migrate
823
924
- name: Generate EdgeDB TS files
1025
shell: bash
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
name: Teardown EdgeDB
2+
runs:
3+
using: composite
4+
steps:
5+
- name: Delete Branch
6+
shell: bash
7+
run: |
8+
edgedb branch switch main
9+
edgedb branch drop github_$GITHUB_RUN_ID_$GITHUB_JOB --non-interactive

.github/workflows/api-schema.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ jobs:
2424

2525
- name: EdgeDB Setup
2626
uses: ./.github/actions/edgedb-setup
27+
with:
28+
dsn: ${{ secrets.EDGEDB_DSN }}
2729

2830
- name: Generate GraphQL Schema
2931
run: yarn start -- --gen-schema
@@ -34,6 +36,10 @@ jobs:
3436
name: ${{ matrix.ref }}-gql-schema
3537
path: schema.graphql
3638

39+
- name: EdgeDB Teardown
40+
uses: ./.github/actions/edgedb-teardown
41+
if: always()
42+
3743
graphql-diff:
3844
name: GraphQL Diff
3945
needs: [generate]

.github/workflows/edgedb.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,10 @@ jobs:
1010
- name: Node Setup & Yarn Install
1111
uses: ./.github/actions/setup
1212

13-
- uses: edgedb/setup-edgedb@v1
14-
15-
- name: Generate EdgeDB TS files
16-
shell: bash
17-
run: yarn edgedb:gen
13+
- name: EdgeDB Setup
14+
uses: ./.github/actions/edgedb-setup
15+
with:
16+
dsn: ${{ secrets.EDGEDB_DSN }}
1817

1918
- name: Inject Access Policies
2019
run: yarn console edgedb ap inject
@@ -26,3 +25,7 @@ jobs:
2625
- name: Validate seed scripts are error free
2726
run: yarn edgedb:seed
2827
shell: bash
28+
29+
- name: EdgeDB Teardown
30+
uses: ./.github/actions/edgedb-teardown
31+
if: always()

.github/workflows/lint.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ jobs:
1717

1818
- name: EdgeDB Setup
1919
uses: ./.github/actions/edgedb-setup
20+
with:
21+
dsn: ${{ secrets.EDGEDB_DSN }}
2022

2123
- name: Check for no duplicate dependencies
2224
run: yarn dedupe --check
@@ -34,3 +36,7 @@ jobs:
3436

3537
- name: Lint
3638
run: yarn eslint --ext .ts,.tsx --max-warnings 0 .
39+
40+
- name: EdgeDB Teardown
41+
uses: ./.github/actions/edgedb-teardown
42+
if: always()

.github/workflows/test.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,16 @@ jobs:
1717

1818
- name: EdgeDB Setup
1919
uses: ./.github/actions/edgedb-setup
20+
with:
21+
dsn: ${{ secrets.EDGEDB_DSN }}
2022

2123
- name: Tests
2224
run: yarn test --reporters=github-actions
2325

26+
- name: EdgeDB Teardown
27+
uses: ./.github/actions/edgedb-teardown
28+
if: always()
29+
2430
E2E:
2531
name: E2E Tests (${{ matrix.database }} ${{ matrix.shard }}/6)
2632
runs-on: ubuntu-latest
@@ -58,10 +64,16 @@ jobs:
5864

5965
- name: EdgeDB Setup
6066
uses: ./.github/actions/edgedb-setup
67+
with:
68+
dsn: ${{ secrets.EDGEDB_DSN }}
6169

6270
- name: E2E Tests
6371
run: yarn test:e2e --shard=${{ matrix.shard }}/6 --reporters=github-actions
6472
env:
6573
NEO4J_VERSION: ${{ matrix.neo4j-version }}
6674
DATABASE: ${{ matrix.database }}
6775
continue-on-error: ${{ matrix.database == 'edgedb' }}
76+
77+
- name: EdgeDB Teardown
78+
uses: ./.github/actions/edgedb-teardown
79+
if: always()

0 commit comments

Comments
 (0)