From 062d082df49460021040af95c34d9ff70f8cf269 Mon Sep 17 00:00:00 2001 From: Dimitrije Dragasevic Date: Thu, 28 Nov 2024 13:24:51 +0100 Subject: [PATCH 1/6] test new workflow --- .github/workflows/deploy.yml | 47 +++++++++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 95c1823dd..a83da703c 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -129,6 +129,14 @@ jobs: echo "Error: Kernel not found in known configurations" exit 1 fi + - name: Download version-map + uses: actions/download-artifact@v4 + with: + name: contracts + path: "artifacts" + + - run: | + echo "version-map.json" - name: Checkout Schema Parser uses: actions/checkout@v4 @@ -176,4 +184,41 @@ jobs: git push else echo "No changes to commit" - fi \ No newline at end of file + fi + + - name: Trigger Armor Workflow + uses: actions/github-script@v7 + with: + github-token: ${{ secrets.CI_PAT }} + script: | + const kernelAddress = '${{ inputs.kernel_address }}'; + const testnetKernels = '${{ vars.TESTNET_KERNELS }}'; + const testnetStagingKernels = '${{ vars.TESTNET_STAGING_KERNELS }}'; + + // Read the version map + const fs = require('fs'); + const versionMap = fs.readFileSync('artifacts/version-map.json', 'utf8'); + + let workflowFile; + if (kernelAddress === testnetKernels) { + workflowFile = 'develop.yml'; + } else if (kernelAddress === testnetStagingKernels) { + workflowFile = 'staging.yml'; + } else { + core.setFailed('Error: Kernel not found in known configurations'); + return; + } + + try { + await github.rest.actions.createWorkflowDispatch({ + owner: 'andromedaprotocol', + repo: 'andromeda-armor', + workflow_id: workflowFile, + ref: 'main', + inputs: { + version_map: versionMap + } + }); + } catch (error) { + core.setFailed(`Failed to trigger Armor workflow: ${error.message}`); + } \ No newline at end of file From 2175cca3cf75af1256bbdfd4a3d36b2bcca64ce6 Mon Sep 17 00:00:00 2001 From: Dimitrije Dragasevic Date: Thu, 28 Nov 2024 13:57:29 +0100 Subject: [PATCH 2/6] Try this way --- .github/workflows/deploy.yml | 60 +++++++++++++++++++++++++++++++----- 1 file changed, 52 insertions(+), 8 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index a83da703c..4ababd4a9 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -129,14 +129,6 @@ jobs: echo "Error: Kernel not found in known configurations" exit 1 fi - - name: Download version-map - uses: actions/download-artifact@v4 - with: - name: contracts - path: "artifacts" - - - run: | - echo "version-map.json" - name: Checkout Schema Parser uses: actions/checkout@v4 @@ -209,6 +201,58 @@ jobs: return; } + try { + await github.rest.actions.createWorkflowDispatch({ + owner: 'andromedaprotocol', + repo: 'andromeda-armor', + workflow_id: workflowFile, + ref: 'main', + inputs: { + version_map: versionMap + } + }); + } catch (error) { + core.setFailed(`Failed to trigger Armor workflow: ${error.message}`); + } + + - name: Download version-map + uses: actions/download-artifact@v4 + with: + name: contracts + path: "artifacts" + + - name: Extract version map + run: | + cd artifacts + ls -a + unzip -o contracts.zip + ls -a + cat version-map.json + cp version-map.json ../version-map.json + + - name: Trigger Armor Workflow + uses: actions/github-script@v7 + with: + github-token: ${{ secrets.CI_PAT }} + script: | + const kernelAddress = '${{ inputs.kernel_address }}'; + const testnetKernels = '${{ vars.TESTNET_KERNELS }}'; + const testnetStagingKernels = '${{ vars.TESTNET_STAGING_KERNELS }}'; + + // Read the version map + const fs = require('fs'); + const versionMap = fs.readFileSync('version-map.json', 'utf8'); + + let workflowFile; + if (kernelAddress === testnetKernels) { + workflowFile = 'develop.yml'; + } else if (kernelAddress === testnetStagingKernels) { + workflowFile = 'staging.yml'; + } else { + core.setFailed('Error: Kernel not found in known configurations'); + return; + } + try { await github.rest.actions.createWorkflowDispatch({ owner: 'andromedaprotocol', From 4284571ff064c9f58813b72b3dd7bc9e832dee01 Mon Sep 17 00:00:00 2001 From: Dimitrije Dragasevic Date: Thu, 28 Nov 2024 14:21:34 +0100 Subject: [PATCH 3/6] changed andromeda-armour to have a seperate trigger job --- .github/workflows/deploy.yml | 139 +++++++++++++---------------------- 1 file changed, 53 insertions(+), 86 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 4ababd4a9..d85065722 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -178,91 +178,58 @@ jobs: echo "No changes to commit" fi - - name: Trigger Armor Workflow - uses: actions/github-script@v7 - with: - github-token: ${{ secrets.CI_PAT }} - script: | - const kernelAddress = '${{ inputs.kernel_address }}'; - const testnetKernels = '${{ vars.TESTNET_KERNELS }}'; - const testnetStagingKernels = '${{ vars.TESTNET_STAGING_KERNELS }}'; - - // Read the version map - const fs = require('fs'); - const versionMap = fs.readFileSync('artifacts/version-map.json', 'utf8'); - - let workflowFile; - if (kernelAddress === testnetKernels) { - workflowFile = 'develop.yml'; - } else if (kernelAddress === testnetStagingKernels) { - workflowFile = 'staging.yml'; - } else { - core.setFailed('Error: Kernel not found in known configurations'); - return; - } - - try { - await github.rest.actions.createWorkflowDispatch({ - owner: 'andromedaprotocol', - repo: 'andromeda-armor', - workflow_id: workflowFile, - ref: 'main', - inputs: { - version_map: versionMap - } - }); - } catch (error) { - core.setFailed(`Failed to trigger Armor workflow: ${error.message}`); - } + trigger-armour-workflow: + needs: [build_contracts, build_schemas, build_deploy_script, deploy, trigger-schema-parser] + runs-on: ubuntu-latest + steps: + - name: Download version-map + uses: actions/download-artifact@v4 + with: + name: contracts + path: "artifacts" + + - name: Extract version map + run: | + cd artifacts + ls -a + unzip -o contracts.zip + ls -a + cat version-map.json + cp version-map.json ../version-map.json - - name: Download version-map - uses: actions/download-artifact@v4 - with: - name: contracts - path: "artifacts" + - name: Trigger Armor Workflow + uses: actions/github-script@v7 + with: + github-token: ${{ secrets.CI_PAT }} + script: | + const kernelAddress = '${{ inputs.kernel_address }}'; + const testnetKernels = '${{ vars.TESTNET_KERNELS }}'; + const testnetStagingKernels = '${{ vars.TESTNET_STAGING_KERNELS }}'; - - name: Extract version map - run: | - cd artifacts - ls -a - unzip -o contracts.zip - ls -a - cat version-map.json - cp version-map.json ../version-map.json - - - name: Trigger Armor Workflow - uses: actions/github-script@v7 - with: - github-token: ${{ secrets.CI_PAT }} - script: | - const kernelAddress = '${{ inputs.kernel_address }}'; - const testnetKernels = '${{ vars.TESTNET_KERNELS }}'; - const testnetStagingKernels = '${{ vars.TESTNET_STAGING_KERNELS }}'; - - // Read the version map - const fs = require('fs'); - const versionMap = fs.readFileSync('version-map.json', 'utf8'); - - let workflowFile; - if (kernelAddress === testnetKernels) { - workflowFile = 'develop.yml'; - } else if (kernelAddress === testnetStagingKernels) { - workflowFile = 'staging.yml'; - } else { - core.setFailed('Error: Kernel not found in known configurations'); - return; - } - - try { - await github.rest.actions.createWorkflowDispatch({ - owner: 'andromedaprotocol', - repo: 'andromeda-armor', - workflow_id: workflowFile, - ref: 'main', - inputs: { - version_map: versionMap - } - }); - } catch (error) { - core.setFailed(`Failed to trigger Armor workflow: ${error.message}`); - } \ No newline at end of file + // Read the version map + const fs = require('fs'); + const versionMap = fs.readFileSync('version-map.json', 'utf8'); + + let workflowFile; + if (kernelAddress === testnetKernels) { + workflowFile = 'develop.yml'; + } else if (kernelAddress === testnetStagingKernels) { + workflowFile = 'staging.yml'; + } else { + core.setFailed('Error: Kernel not found in known configurations'); + return; + } + + try { + await github.rest.actions.createWorkflowDispatch({ + owner: 'andromedaprotocol', + repo: 'andromeda-armor', + workflow_id: workflowFile, + ref: 'main', + inputs: { + version_map: versionMap + } + }); + } catch (error) { + core.setFailed(`Failed to trigger Armor workflow: ${error.message}`); + } \ No newline at end of file From 1332ae164ed44974d5224ea94f6a02036e4818ee Mon Sep 17 00:00:00 2001 From: Dimitrije Dragasevic Date: Thu, 28 Nov 2024 14:48:22 +0100 Subject: [PATCH 4/6] removed unziping, since file is already unziped --- .github/workflows/deploy.yml | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index d85065722..2a388e504 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -111,7 +111,7 @@ jobs: ./andromeda-deploy trigger-schema-parser: - needs: [deploy, build_schemas] + needs: [deploy] runs-on: ubuntu-latest steps: - name: Set Branch Based on Kernel @@ -179,7 +179,7 @@ jobs: fi trigger-armour-workflow: - needs: [build_contracts, build_schemas, build_deploy_script, deploy, trigger-schema-parser] + needs: [trigger-schema-parser] runs-on: ubuntu-latest steps: - name: Download version-map @@ -191,11 +191,8 @@ jobs: - name: Extract version map run: | cd artifacts - ls -a - unzip -o contracts.zip - ls -a - cat version-map.json - cp version-map.json ../version-map.json + cat version_map.json + cp version_map.json ../version_map.json - name: Trigger Armor Workflow uses: actions/github-script@v7 @@ -208,7 +205,7 @@ jobs: // Read the version map const fs = require('fs'); - const versionMap = fs.readFileSync('version-map.json', 'utf8'); + const versionMap = fs.readFileSync('version_map.json', 'utf8'); let workflowFile; if (kernelAddress === testnetKernels) { From ff395fa2a9fee83c5a68902e2b9ea7a60c86d0c6 Mon Sep 17 00:00:00 2001 From: Dimitrije Dragasevic Date: Thu, 28 Nov 2024 15:17:15 +0100 Subject: [PATCH 5/6] rename repo --- .github/workflows/deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 2a388e504..9308ac4dd 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -220,7 +220,7 @@ jobs: try { await github.rest.actions.createWorkflowDispatch({ owner: 'andromedaprotocol', - repo: 'andromeda-armor', + repo: 'andromeda-armour', workflow_id: workflowFile, ref: 'main', inputs: { From b5ce223c8450bc2f155cb51b74109267e0a97b56 Mon Sep 17 00:00:00 2001 From: Dimitrije Dragasevic Date: Thu, 28 Nov 2024 15:56:09 +0100 Subject: [PATCH 6/6] Added wait time for schemas to update before running tests --- .github/workflows/deploy.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 9308ac4dd..f0d2dd63b 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -181,7 +181,13 @@ jobs: trigger-armour-workflow: needs: [trigger-schema-parser] runs-on: ubuntu-latest - steps: + steps: + - name: Wait for schema updates + run: | + echo "Waiting 6 minutes for schema updates to propagate..." + sleep 360 + echo "Wait complete, proceeding with Armor workflow trigger" + - name: Download version-map uses: actions/download-artifact@v4 with: