From 124f442d36bfe08a8cf06cedb125a83fe708c1a8 Mon Sep 17 00:00:00 2001 From: Skylar Simoncelli Date: Tue, 17 Sep 2024 18:04:29 +0300 Subject: [PATCH] feat: local-environment module --- .github/workflows/cicd.yml | 34 ++-------- .../modules/local-environment-tests.yml | 65 +++++++++++++++++++ 2 files changed, 71 insertions(+), 28 deletions(-) create mode 100644 .github/workflows/modules/local-environment-tests.yml diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml index 1d934cd43..78f16c511 100644 --- a/.github/workflows/cicd.yml +++ b/.github/workflows/cicd.yml @@ -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 diff --git a/.github/workflows/modules/local-environment-tests.yml b/.github/workflows/modules/local-environment-tests.yml new file mode 100644 index 000000000..6d9f1d54b --- /dev/null +++ b/.github/workflows/modules/local-environment-tests.yml @@ -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 \ No newline at end of file