Skip to content

Commit

Permalink
feat: local-environment module
Browse files Browse the repository at this point in the history
  • Loading branch information
Skylar Simoncelli committed Sep 17, 2024
1 parent acf6fa2 commit 124f442
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 28 deletions.
34 changes: 6 additions & 28 deletions .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -223,35 +223,13 @@ jobs:
mkdir -p ./x86_64-linux/unzipped
unzip ./x86_64-linux/release.zip -d ./x86_64-linux/unzipped
local-environment:
runs-on: ubuntu-latest
local-environment-tests:
needs: [partner-chains-linux, partner-chains-smart-contracts-process]
steps:
- name: Checkout master
uses: actions/checkout@v4
with:
path: ./partner-chains-master

- name: Set filename variables
id: set-filenames
run: |
echo "PARTNER_CHAINS_CLI_X86_64_LINUX=partner-chains-cli-${{ inputs.tag }}-x86_64-linux" >> $GITHUB_ENV
echo "PARTNER_CHAINS_NODE_X86_64_LINUX=partner-chains-node-${{ inputs.tag }}-x86_64-linux" >> $GITHUB_ENV
- name: Deploy local environment with overrides
run: |
cp -r ./partner-chains-cli-* ./partner-chains-master/dev/local-environment/configurations/partner-chains-cli/overrides/partner-chains-cli
cp -r ./partner-chains-node-* ./partner-chains-master/dev/local-environment/configurations/partner-chains-cli/overrides/partner-chains-node
cp -r ./partner-chains-smart-contracts/* ./partner-chains-master/dev/local-environment/configurations/sidechain-release-bundle/overrides/
cd ./partner-chains-master/dev/local-environment
bash setup.sh --non-interactive --overrides --postgres-password=postgres
docker compose up -d
- name: Run tests
run: #TODO i.e. python ./tests.py

- name: Stop partner-chains-demo
run: docker compose down --volumes
uses: ./.github/workflows/modules/local-environment-tests.yml
with:
sha: ${{ inputs.sha }}
tag: ${{ inputs.tag }}
image: ${{ secrets.ECR_REGISTRY_SECRET }}/substrate-node:${{ inputs.sha }}

pre-release-candidate:
runs-on: ubuntu-latest
Expand Down
65 changes: 65 additions & 0 deletions .github/workflows/modules/local-environment-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Deploy and test aganst local-environment

on:
workflow_call:
inputs:
sha:
description: "Commit SHA to build from"
required: true
image:
description: "Node Image"
required: true
tag:
description: "Chain Spec Secret Name"
required: true

jobs:
local-environment-tests:
runs-on: ubuntu-latest
steps:
- name: Checkout master
uses: actions/checkout@v4
with:
path: ./partner-chains-master

- name: Set filename variables
id: set-filenames
run: |
echo "PARTNER_CHAINS_CLI_X86_64_LINUX=partner-chains-cli-${{ inputs.tag }}-x86_64-linux" >> $GITHUB_ENV
echo "PARTNER_CHAINS_NODE_X86_64_LINUX=partner-chains-node-${{ inputs.tag }}-x86_64-linux" >> $GITHUB_ENV
- name: Acquire AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.AWS_ROLE_ARN_SECRET }}
aws-region: ${{ env.AWS_REGION }}

- name: Login to ECR
uses: docker/login-action@v3
with:
registry: ${{ secrets.ECR_REGISTRY_SECRET }}

- name: Download partner-chains-node
uses: actions/download-artifact@v4
with:
name: ${{ env.PARTNER_CHAINS_NODE_X86_64_LINUX }}

- name: Download partner-chains-cli
uses: actions/download-artifact@v4
with:
name: ${{ env.PARTNER_CHAINS_CLI_X86_64_LINUX }}

- name: Deploy local environment with overrides
run: |
cp -r ./partner-chains-cli-* ./partner-chains-master/dev/local-environment/configurations/partner-chains-cli/overrides/partner-chains-cli
cp -r ./partner-chains-node-* ./partner-chains-master/dev/local-environment/configurations/partner-chains-cli/overrides/partner-chains-node
cp -r ./partner-chains-smart-contracts/* ./partner-chains-master/dev/local-environment/configurations/sidechain-release-bundle/overrides/
cd ./partner-chains-master/dev/local-environment
bash setup.sh --non-interactive --overrides --postgres-password=postgres
docker compose up -d
- name: Run tests
run: #TODO i.e. python ./tests.py

- name: Stop partner-chains-demo
run: docker compose down --volumes

0 comments on commit 124f442

Please sign in to comment.