Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch CI to use shared instance to try to reduce startup time #3191

Draft
wants to merge 8 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .github/actions/edgedb-setup/action.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,26 @@
name: Setup EdgeDB
description: 'Setup EdgeDB server, migrate schema, generate TS files'

runs:
using: composite
steps:
- name: Setup EdgeDB
uses: edgedb/setup-edgedb@v1
with:
cli-version: nightly
server-version: none

- name: Branch & Migrate
shell: bash
run: |
echo "Creating branch $BRANCH"
edgedb branch create $BRANCH
echo "Switching to branch $BRANCH"
edgedb branch switch $BRANCH
echo "Applying new migrations to branch $BRANCH"
edgedb migrate
env:
BRANCH: github_${{ github.event.number }}_${{ env.GITHUB_RUN_ID }}_${{ env.GITHUB_RUN_ATTEMPT }}_${{ env.GITHUB_JOB }}

- name: Generate EdgeDB TS files
shell: bash
Expand Down
13 changes: 13 additions & 0 deletions .github/actions/edgedb-teardown/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Teardown EdgeDB
runs:
using: composite
steps:
- name: Delete Branch
shell: bash
run: |
echo "Switching to main"
edgedb branch switch main
echo "Dropping branch $BRANCH"
edgedb branch drop $BRANCH --non-interactive
env:
BRANCH: github_${{ github.event.number }}_${{ env.GITHUB_RUN_ID }}_${{ env.GITHUB_RUN_ATTEMPT }}_${{ env.GITHUB_JOB }}
8 changes: 8 additions & 0 deletions .github/workflows/api-schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ on:
- synchronize
- labeled

env:
EDGEDB_INSTANCE: ${{ secrets.EDGEDB_INSTANCE }}
EDGEDB_SECRET_KEY: ${{ secrets.EDGEDB_SECRET_KEY }}

jobs:
generate:
name: Generate
Expand Down Expand Up @@ -34,6 +38,10 @@ jobs:
name: ${{ matrix.ref }}-gql-schema
path: schema.graphql

- name: EdgeDB Teardown
uses: ./.github/actions/edgedb-teardown
if: always()

graphql-diff:
name: GraphQL Diff
needs: [generate]
Expand Down
15 changes: 10 additions & 5 deletions .github/workflows/edgedb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ name: EdgeDB
on:
pull_request:

env:
EDGEDB_INSTANCE: ${{ secrets.EDGEDB_INSTANCE }}
EDGEDB_SECRET_KEY: ${{ secrets.EDGEDB_SECRET_KEY }}

jobs:
Clean:
runs-on: ubuntu-latest
Expand All @@ -10,11 +14,8 @@ jobs:
- name: Node Setup & Yarn Install
uses: ./.github/actions/setup

- uses: edgedb/setup-edgedb@v1

- name: Generate EdgeDB TS files
shell: bash
run: yarn edgedb:gen
- name: EdgeDB Setup
uses: ./.github/actions/edgedb-setup

- name: Inject Access Policies
run: yarn console edgedb ap inject
Expand All @@ -26,3 +27,7 @@ jobs:
- name: Validate seed scripts are error free
run: yarn edgedb:seed
shell: bash

- name: EdgeDB Teardown
uses: ./.github/actions/edgedb-teardown
if: always()
8 changes: 8 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ on:
- master
- develop

env:
EDGEDB_INSTANCE: ${{ secrets.EDGEDB_INSTANCE }}
EDGEDB_SECRET_KEY: ${{ secrets.EDGEDB_SECRET_KEY }}

jobs:
lint:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -34,3 +38,7 @@ jobs:

- name: Lint
run: yarn eslint --ext .ts,.tsx --max-warnings 0 .

- name: EdgeDB Teardown
uses: ./.github/actions/edgedb-teardown
if: always()
12 changes: 12 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ on:
- master
- develop

env:
EDGEDB_INSTANCE: ${{ secrets.EDGEDB_INSTANCE }}
EDGEDB_SECRET_KEY: ${{ secrets.EDGEDB_SECRET_KEY }}

jobs:
Unit:
runs-on: ubuntu-latest
Expand All @@ -21,6 +25,10 @@ jobs:
- name: Tests
run: yarn test --reporters=github-actions

- name: EdgeDB Teardown
uses: ./.github/actions/edgedb-teardown
if: always()

E2E:
name: E2E Tests (${{ matrix.database }} ${{ matrix.shard }}/6)
runs-on: ubuntu-latest
Expand Down Expand Up @@ -65,3 +73,7 @@ jobs:
NEO4J_VERSION: ${{ matrix.neo4j-version }}
DATABASE: ${{ matrix.database }}
continue-on-error: ${{ matrix.database == 'edgedb' }}

- name: EdgeDB Teardown
uses: ./.github/actions/edgedb-teardown
if: always()
Loading