|
| 1 | +default: |
| 2 | + image: $GCP_REGISTRY_URL/werf/ci-nodejs:latest |
| 3 | + tags: [lint] |
| 4 | + |
| 5 | +stages: |
| 6 | + - compile |
| 7 | + - lint |
| 8 | + - unittest |
| 9 | + - reports |
| 10 | + - integration-test |
| 11 | + - cd |
| 12 | + |
| 13 | +.hardhat-job-template: &hardhat-job-template |
| 14 | + before_script: |
| 15 | + - pnpm install --frozen-lockfile --prefer-offline |
| 16 | + artifacts: |
| 17 | + paths: |
| 18 | + - typechain-types/ |
| 19 | + - artifacts/ |
| 20 | + - cache/ |
| 21 | + |
| 22 | +.general-dependencies-template: &general-dependencies-template |
| 23 | + only: |
| 24 | + - merge_requests |
| 25 | + - dev |
| 26 | + - tags |
| 27 | + |
| 28 | +# Compile Contracts & Store Artifacts |
| 29 | +compile: |
| 30 | + <<: *hardhat-job-template |
| 31 | + <<: *general-dependencies-template |
| 32 | + stage: compile |
| 33 | + script: |
| 34 | + - pnpm compile |
| 35 | + - pnpm typechain |
| 36 | + |
| 37 | +# Lint Check |
| 38 | +lint: |
| 39 | + <<: *hardhat-job-template |
| 40 | + <<: *general-dependencies-template |
| 41 | + stage: lint |
| 42 | + needs: [compile] |
| 43 | + script: |
| 44 | + - pnpm lint |
| 45 | + |
| 46 | +# Run Unittest |
| 47 | +unittest: |
| 48 | + <<: *hardhat-job-template |
| 49 | + <<: *general-dependencies-template |
| 50 | + stage: unittest |
| 51 | + needs: [lint] |
| 52 | + script: |
| 53 | + - pnpm test |
| 54 | + |
| 55 | +# Form coverage report for visualization |
| 56 | +reports: |
| 57 | + <<: *hardhat-job-template |
| 58 | + stage: reports |
| 59 | + needs: [unittest] |
| 60 | + coverage: '/Statements.*?(\d+(?:\.\d+)?)%/' |
| 61 | + script: |
| 62 | + - pnpm coverage |
| 63 | + artifacts: |
| 64 | + reports: |
| 65 | + coverage_report: |
| 66 | + coverage_format: cobertura |
| 67 | + path: coverage/cobertura-coverage.xml |
| 68 | + |
| 69 | + only: |
| 70 | + - merge_requests |
| 71 | + - dev |
| 72 | + |
| 73 | +# On fork deploy impls, update them in update manager and checks upgradability finally |
| 74 | +# On failure it generates files in /modules/tasks/reports/error*.json |
| 75 | +upgradability-test: |
| 76 | + <<: *hardhat-job-template |
| 77 | + stage: integration-test |
| 78 | + needs: [unittest] |
| 79 | + variables: |
| 80 | + MAINNET_RPC: $MAINNET_RPC_INTEGRATION_TEST |
| 81 | + FORKING_MODE: "STAGE" |
| 82 | + FORKING_MODE_USE_SOURCE_DEPLOYMENTS: "true" |
| 83 | + MAINNET_UPDATE_MANAGERS_JSON: '[{"contractAddress" : "0xDeB6b06E22A5BdFB2d42000074B46F9C2c3861FE"},{"contractAddress" : "0x41c98A711273800f4275d7eA03161B1810Cf2D03"},{"contractAddress" : "0x0b99dbF8F3d81476BDeE982219a260d01E4E94f0"},{"contractAddress" : "0x2164e9Fa6004896986d2bCc7AC6Ee10A8ad07E00"},{"contractAddress" : "0x99e29A22F56c954Ac51261B69130A88d4ceFf145"},{"contractAddress" : "0xde11959E53ed7bA2B7Ed295c4CE00BDcAd42F587"},{"contractAddress" : "0xe087653B76e2382f55312E43fB0cBD8527527537"},{"contractAddress" : "0x6Eb2F80717F30B2D178443F1Bc919171490d7b97"}]' |
| 84 | + MAINNET_PROTOCOL_FILE_JSON: '[{"contractAddress":"0xDeB6b06E22A5BdFB2d42000074B46F9C2c3861FE","app":"UPDATE_MANAGER"},{"contractAddress":"0x41c98A711273800f4275d7eA03161B1810Cf2D03","app":"UPDATE_MANAGER"},{"contractAddress":"0x0b99dbF8F3d81476BDeE982219a260d01E4E94f0","app":"UPDATE_MANAGER"},{"contractAddress":"0x2164e9Fa6004896986d2bCc7AC6Ee10A8ad07E00","app":"UPDATE_MANAGER"},{"contractAddress":"0x99e29A22F56c954Ac51261B69130A88d4ceFf145","app":"UPDATE_MANAGER"},{"contractAddress":"0xde11959E53ed7bA2B7Ed295c4CE00BDcAd42F587","app":"UPDATE_MANAGER"},{"contractAddress":"0xe087653B76e2382f55312E43fB0cBD8527527537","app":"UPDATE_MANAGER"},{"contractAddress":"0x6Eb2F80717F30B2D178443F1Bc919171490d7b97","app":"UPDATE_MANAGER"},{"contractAddress":"0xC7c3c83B9e89645A2616ea94236FD052667fa4a1","app":"DAO_CONSTRUCTOR"},{"contractAddress":"0x08205A2a16963b00e29F67208820BC53fB31Df55","app":"DAO_CONSTRUCTOR"}]' |
| 85 | + STAGE_UPDATE_MANAGERS_JSON: '[{"contractAddress":"0x39048a9a1803beF19e65B32f3f1136C370145F92"}]' |
| 86 | + STAGE_PROTOCOL_FILE_JSON: '[{"contractAddress":"0x39048a9a1803beF19e65B32f3f1136C370145F92","app":"UPDATE_MANAGER"},{"contractAddress":"0x61DedCcE3a184Fb6b528dbeC9026cf1fa3B14907","app":"DAO_CONSTRUCTOR"}]' |
| 87 | + script: |
| 88 | + - echo $STAGE_UPDATE_MANAGERS_JSON > modules/tasks/inputs/updateManagersToUpd.json |
| 89 | + - echo $STAGE_PROTOCOL_FILE_JSON > modules/tasks/inputs/protocolContracts.json |
| 90 | + - pnpm hardhat upgradability-test --remote-fetch --update-managers-file modules/tasks/inputs/updateManagersToUpd.json --protocol-file modules/tasks/inputs/protocolContracts.json --batch-size 50 --network hardhat |
| 91 | + - git reset --hard |
| 92 | + artifacts: |
| 93 | + paths: |
| 94 | + - modules/tasks/reports/ |
| 95 | + only: |
| 96 | + - dev |
| 97 | + |
| 98 | +notify-of-errors: |
| 99 | + stage: cd |
| 100 | + needs: [upgradability-test] |
| 101 | + script: |
| 102 | + - if [ -f "/modules/tasks/reports/errors.integration-test.kernelsUpgradeError.json" ]; then exit 1; fi |
| 103 | + - if [ -f "/modules/tasks/reports/errors.integration-test.kernelsUpgradeGetterMethod.json" ]; then exit 1; fi |
| 104 | + - if [ -f "/modules/tasks/reports/errors.integration-test.kernelsUpgradeDifferentReturns.json" ]; then exit 1; fi |
| 105 | + - if [ -f "/modules/tasks/reports/errors.integration-test.protocolUpgradeError.json" ]; then exit 1; fi |
| 106 | + - if [ -f "/modules/tasks/reports/errors.integration-test.protocolGetterMethodError.json" ]; then exit 1; fi |
| 107 | + - if [ -f "/modules/tasks/reports/errors.integration-test.protocolDifferentReturnsError.json" ]; then exit 1; fi |
| 108 | + only: |
| 109 | + - dev |
| 110 | + |
| 111 | +# update-contracts-on-mainnet: |
| 112 | +# <<: *hardhat-job-template |
| 113 | +# stage: cd |
| 114 | +# needs: [notify-if-errors-happendduring-integration-test-mainnet-fork] |
| 115 | +# variables: |
| 116 | +# MAINNET_RPC: $MAINNET_RPC_INTEGRATION_TEST |
| 117 | +# FORKING_MODE: STAGE |
| 118 | +# # env for the task are below |
| 119 | +# MAINNET_UPDATE_MANAGERS_JSON: '[{"contractAddress" : "0xDeB6b06E22A5BdFB2d42000074B46F9C2c3861FE"},{"contractAddress" : "0x41c98A711273800f4275d7eA03161B1810Cf2D03"},{"contractAddress" : "0x0b99dbF8F3d81476BDeE982219a260d01E4E94f0"},{"contractAddress" : "0x2164e9Fa6004896986d2bCc7AC6Ee10A8ad07E00"},{"contractAddress" : "0x99e29A22F56c954Ac51261B69130A88d4ceFf145"},{"contractAddress" : "0xde11959E53ed7bA2B7Ed295c4CE00BDcAd42F587"},{"contractAddress" : "0xe087653B76e2382f55312E43fB0cBD8527527537"},{"contractAddress" : "0x6Eb2F80717F30B2D178443F1Bc919171490d7b97"}]' |
| 120 | +# MAINNET_PROTOCOL_FILE_JSON: '[{"contractAddress":"0xDeB6b06E22A5BdFB2d42000074B46F9C2c3861FE","app":"UPDATE_MANAGER"},{"contractAddress":"0x41c98A711273800f4275d7eA03161B1810Cf2D03","app":"UPDATE_MANAGER"},{"contractAddress":"0x0b99dbF8F3d81476BDeE982219a260d01E4E94f0","app":"UPDATE_MANAGER"},{"contractAddress":"0x2164e9Fa6004896986d2bCc7AC6Ee10A8ad07E00","app":"UPDATE_MANAGER"},{"contractAddress":"0x99e29A22F56c954Ac51261B69130A88d4ceFf145","app":"UPDATE_MANAGER"},{"contractAddress":"0xde11959E53ed7bA2B7Ed295c4CE00BDcAd42F587","app":"UPDATE_MANAGER"},{"contractAddress":"0xe087653B76e2382f55312E43fB0cBD8527527537","app":"UPDATE_MANAGER"},{"contractAddress":"0x6Eb2F80717F30B2D178443F1Bc919171490d7b97","app":"UPDATE_MANAGER"},{"contractAddress":"0xC7c3c83B9e89645A2616ea94236FD052667fa4a1","app":"DAO_CONSTRUCTOR"},{"contractAddress":"0x08205A2a16963b00e29F67208820BC53fB31Df55","app":"DAO_CONSTRUCTOR"}]' |
| 121 | +# STAGE_UPDATE_MANAGERS_JSON: '[{"contractAddress":"0x39048a9a1803beF19e65B32f3f1136C370145F92"}]' |
| 122 | +# STAGE_PROTOCOL_FILE_JSON: '[{"contractAddress":"0x39048a9a1803beF19e65B32f3f1136C370145F92","app":"UPDATE_MANAGER"},{"contractAddress":"0x61DedCcE3a184Fb6b528dbeC9026cf1fa3B14907","app":"DAO_CONSTRUCTOR"}]' |
| 123 | +# script: |
| 124 | +# - echo $STAGE_UPDATE_MANAGERS_JSON > modules/tasks/inputs/updateManagersToUpd.json |
| 125 | +# - echo $STAGE_PROTOCOL_FILE_JSON > modules/tasks/inputs/protocolContracts.json |
| 126 | +# - pnpm hardhat auto-upgrade --remote-fetch --update-managers-file modules/tasks/inputs/updateManagersToUpd.json --protocol-contracts-file modules/tasks/inputs/protocolContracts.json --failed-kernels-to-file --update-protocol-apps --network hardhat --batch-size 50 |
| 127 | +# only: |
| 128 | +# - dev |
| 129 | + |
| 130 | +# Publish Artifacts & Typechain-types To Npm on Released Tag (e.g. 1.1.1) |
| 131 | +publish-package-artifacts: |
| 132 | + stage: cd |
| 133 | + needs: [unittest] |
| 134 | + variables: |
| 135 | + NPM_PUBLISH_TOKEN: $NPM_SUPERDAO_ACCESS_TOKEN |
| 136 | + script: |
| 137 | + - pnpm run --filter=@superdao/os npm:publish |
| 138 | + rules: |
| 139 | + - if: '$CI_COMMIT_BRANCH == "dev"' |
| 140 | + variables: |
| 141 | + PACKAGE_VERSION: "0.0.0-beta.${CI_COMMIT_SHORT_SHA}" |
| 142 | + - if: '$CI_COMMIT_TAG =~ /^\d+\.\d+\.\d+$/' |
| 143 | + variables: |
| 144 | + PACKAGE_VERSION: ${CI_COMMIT_TAG} |
0 commit comments