Skip to content

Commit

Permalink
Try callable workflows.
Browse files Browse the repository at this point in the history
  • Loading branch information
jplodge-pro committed Jul 8, 2024
1 parent 2b8c87d commit 778a116
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 57 deletions.
64 changes: 7 additions & 57 deletions .github/workflows/ci-dev-ops.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,59 +18,14 @@ on:
- ".github/workflows/ci-dev-ops.yml"

jobs:
ops-int-test-setup:
uses: ./.github/workflows/ci-local-setup.yml

ops-int-test:
runs-on: ubuntu-latest
environment: local

needs: [ops-int-test-setup]
steps:
- name: Checkout credbull-defi
uses: actions/checkout@v4

- name: Install yarn
run: |
corepack prepare yarn@stable --activate
npm install -g yarn
- name: Install Node
uses: actions/setup-node@v4
with:
node-version: 20
cache: "yarn"

- name: Install foundry-toolchain
uses: foundry-rs/[email protected]
with:
version: nightly

- name: Install Project Dependencies
run: yarn install

- name: Setup Local Environment
run: find . -type f -name ".env*.sample" -exec sh -c 'F={}; cp -nv $F $(dirname $F)/$(basename $F .sample)' \;

- name: Build Project
run: yarn build

- name: Setup Supabase CLI
uses: supabase/[email protected]
with:
version: latest

- name: Start Supabase
run: supabase start
working-directory: packages/api

- name: Run Docker Compose with Background Services
run: docker compose --env-file packages/api/.env up --detach --build --wait

- name: Deploy Credbull Contracts
run: yarn deploy
working-directory: packages/contracts

- name: Create Default Users
run: yarn op --create-default-users
working-directory: packages/ops

- name: Run Ops Integration Tests
run: yarn int-test
working-directory: packages/ops
Expand All @@ -79,11 +34,6 @@ jobs:
run: docker logs api
if: ${{ failure() }}

- name: Shutdown Docker Compose detached
run: docker compose --env-file packages/api/.env down
if: ${{ always() }}

- name: Stop Supabase
run: supabase stop --no-backup
working-directory: packages/api
if: ${{ always() }}
ops-int-test-teardown:
uses: ./.github/workflows/ci-local-teardown.yml
needs: [ops-int-test]
61 changes: 61 additions & 0 deletions .github/workflows/ci-local-setup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: ci-as-if-local-setup

defaults:
run:
working-directory: .

on:
workflow_call:

jobs:
setup-ci-as-if-local:
runs-on: ubuntu-latest
environment: local
steps:
- name: Checkout credbull-defi
uses: actions/checkout@v4

- name: Install yarn
run: |
corepack prepare yarn@stable --activate
npm install -g yarn
- name: Install Node
uses: actions/setup-node@v4
with:
node-version: 20
cache: "yarn"

- name: Install foundry-toolchain
uses: foundry-rs/[email protected]
with:
version: nightly

- name: Install Project Dependencies
run: yarn install

- name: Setup Local Environment
run: find . -type f -name ".env*.sample" -exec sh -c 'F={}; cp -nv $F $(dirname $F)/$(basename $F .sample)' \;

- name: Build Project
run: yarn build

- name: Setup Supabase CLI
uses: supabase/[email protected]
with:
version: latest

- name: Start Supabase
run: supabase start
working-directory: packages/api

- name: Run Docker Compose with Background Services
run: docker compose --env-file packages/api/.env up --detach --build --wait

- name: Deploy Credbull Contracts
run: yarn deploy
working-directory: packages/contracts

- name: Create Default Users
run: yarn op --create-default-users
working-directory: packages/ops
22 changes: 22 additions & 0 deletions .github/workflows/ci-local-teardown.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: ci-as-if-local-teardown

defaults:
run:
working-directory: .

on:
workflow_call:

jobs:
teardown-ci-as-if-local:
runs-on: ubuntu-latest
environment: local
steps:
- name: Shutdown Docker Compose Services
run: docker compose --env-file packages/api/.env down
if: ${{ always() }}

- name: Stop Supabase
run: supabase stop --no-backup
working-directory: packages/api
if: ${{ always() }}

0 comments on commit 778a116

Please sign in to comment.