From deedc47ded50ced9618cae4e40128b3ddefb7951 Mon Sep 17 00:00:00 2001 From: Facu Spagnuolo Date: Mon, 19 Jun 2023 11:08:39 -0300 Subject: [PATCH] chore: implement GH CI workflows --- .github/actions/setup/action.yml | 20 ++++++++ .github/scripts/setup-hardhat-config.sh | 28 +++++++++++ .github/workflows/build.yml | 35 ++++++++++++++ .github/workflows/ci-authorizer.yml | 63 +++++++++++++++++++++++++ .github/workflows/ci-deployer.yml | 63 +++++++++++++++++++++++++ .github/workflows/ci-fee-controller.yml | 63 +++++++++++++++++++++++++ .github/workflows/ci-helpers.yml | 63 +++++++++++++++++++++++++ .github/workflows/ci-price-oracle.yml | 63 +++++++++++++++++++++++++ .github/workflows/ci-registry.yml | 63 +++++++++++++++++++++++++ .github/workflows/ci-smart-vault.yml | 63 +++++++++++++++++++++++++ .github/workflows/ci-tasks.yml | 63 +++++++++++++++++++++++++ 11 files changed, 587 insertions(+) create mode 100644 .github/actions/setup/action.yml create mode 100755 .github/scripts/setup-hardhat-config.sh create mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/ci-authorizer.yml create mode 100644 .github/workflows/ci-deployer.yml create mode 100644 .github/workflows/ci-fee-controller.yml create mode 100644 .github/workflows/ci-helpers.yml create mode 100644 .github/workflows/ci-price-oracle.yml create mode 100644 .github/workflows/ci-registry.yml create mode 100644 .github/workflows/ci-smart-vault.yml create mode 100644 .github/workflows/ci-tasks.yml diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml new file mode 100644 index 00000000..74d64e44 --- /dev/null +++ b/.github/actions/setup/action.yml @@ -0,0 +1,20 @@ +name: Setup + +runs: + using: composite + steps: + - name: Install node + uses: actions/setup-node@v3 + with: + node-version: 16 + cache: yarn + - name: Cache + uses: actions/cache@v2 + id: cache + with: + path: '**/node_modules' + key: yarn-v1-${{ hashFiles('**/yarn.lock') }} + - name: Install + if: steps.cache.outputs.cache-hit != 'true' + shell: bash + run: yarn --prefer-offline \ No newline at end of file diff --git a/.github/scripts/setup-hardhat-config.sh b/.github/scripts/setup-hardhat-config.sh new file mode 100755 index 00000000..2ad588e4 --- /dev/null +++ b/.github/scripts/setup-hardhat-config.sh @@ -0,0 +1,28 @@ +#!/bin/sh +MAINNET_URL="$1" +POLYGON_URL="$2" +OPTIMISM_URL="$3" +ARBITRUM_URL="$4" +GNOSIS_URL="$5" +BSC_URL="$6" +FANTOM_URL="$7" +AVALANCHE_URL="$8" + +set -o errexit + +mkdir -p $HOME/.hardhat + +echo " +{ + \"networks\": { + \"mainnet\": { \"url\": \"${MAINNET_URL}\" }, + \"polygon\": { \"url\": \"${POLYGON_URL}\" }, + \"optimism\": { \"url\": \"${OPTIMISM_URL}\" }, + \"arbitrum\": { \"url\": \"${ARBITRUM_URL}\" }, + \"gnosis\": { \"url\": \"${GNOSIS_URL}\" }, + \"bsc\": { \"url\": \"${BSC_URL}\" }, + \"fantom\": { \"url\": \"${FANTOM_URL}\" }, + \"avalanche\": { \"url\": \"${AVALANCHE_URL}\" } + } +} +" > $HOME/.hardhat/networks.mimic.json diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..15d77c09 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,35 @@ +name: Build + +env: + CI: true + +on: + push: + branches: "*" + pull_request: + branches: "*" + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Set up environment + uses: ./.github/actions/setup + - name: Build + run: yarn build + - name: Job failed + if: failure() + uses: rjstone/discord-webhook-notify@v1 + with: + severity: error + details: Job failed! + webhookUrl: ${{ secrets.DISCORD_WEBHOOK }} + - name: Job cancelled + if: cancelled() + uses: rjstone/discord-webhook-notify@v1 + with: + severity: warn + details: Job cancelled! + webhookUrl: ${{ secrets.DISCORD_WEBHOOK }} diff --git a/.github/workflows/ci-authorizer.yml b/.github/workflows/ci-authorizer.yml new file mode 100644 index 00000000..2f7a45c4 --- /dev/null +++ b/.github/workflows/ci-authorizer.yml @@ -0,0 +1,63 @@ +name: Authorizer CI + +env: + CI: true + +on: + push: + branches: "*" + paths: + - packages/authorizer/** + pull_request: + branches: "*" + paths: + - packages/authorizer/** + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Set up environment + uses: ./.github/actions/setup + - name: Lint + run: yarn workspace @mimic-fi/v3-authorizer lint + - name: Job failed + if: failure() + uses: rjstone/discord-webhook-notify@v1 + with: + severity: error + details: Job failed! + webhookUrl: ${{ secrets.DISCORD_WEBHOOK }} + - name: Job cancelled + if: cancelled() + uses: rjstone/discord-webhook-notify@v1 + with: + severity: warn + details: Job cancelled! + webhookUrl: ${{ secrets.DISCORD_WEBHOOK }} + + test: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Set up environment + uses: ./.github/actions/setup + - name: Test + run: yarn workspace @mimic-fi/v3-authorizer test + - name: Job failed + if: failure() + uses: rjstone/discord-webhook-notify@v1 + with: + severity: error + details: Job failed! + webhookUrl: ${{ secrets.DISCORD_WEBHOOK }} + - name: Job cancelled + if: cancelled() + uses: rjstone/discord-webhook-notify@v1 + with: + severity: warn + details: Job cancelled! + webhookUrl: ${{ secrets.DISCORD_WEBHOOK }} diff --git a/.github/workflows/ci-deployer.yml b/.github/workflows/ci-deployer.yml new file mode 100644 index 00000000..5cf37e49 --- /dev/null +++ b/.github/workflows/ci-deployer.yml @@ -0,0 +1,63 @@ +name: Deployer CI + +env: + CI: true + +on: + push: + branches: "*" + paths: + - packages/deployer/** + pull_request: + branches: "*" + paths: + - packages/deployer/** + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Set up environment + uses: ./.github/actions/setup + - name: Lint + run: yarn workspace @mimic-fi/v3-deployer lint + - name: Job failed + if: failure() + uses: rjstone/discord-webhook-notify@v1 + with: + severity: error + details: Job failed! + webhookUrl: ${{ secrets.DISCORD_WEBHOOK }} + - name: Job cancelled + if: cancelled() + uses: rjstone/discord-webhook-notify@v1 + with: + severity: warn + details: Job cancelled! + webhookUrl: ${{ secrets.DISCORD_WEBHOOK }} + + test: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Set up environment + uses: ./.github/actions/setup + - name: Test + run: yarn workspace @mimic-fi/v3-deployer test + - name: Job failed + if: failure() + uses: rjstone/discord-webhook-notify@v1 + with: + severity: error + details: Job failed! + webhookUrl: ${{ secrets.DISCORD_WEBHOOK }} + - name: Job cancelled + if: cancelled() + uses: rjstone/discord-webhook-notify@v1 + with: + severity: warn + details: Job cancelled! + webhookUrl: ${{ secrets.DISCORD_WEBHOOK }} diff --git a/.github/workflows/ci-fee-controller.yml b/.github/workflows/ci-fee-controller.yml new file mode 100644 index 00000000..0e2acf7e --- /dev/null +++ b/.github/workflows/ci-fee-controller.yml @@ -0,0 +1,63 @@ +name: Fee Controller CI + +env: + CI: true + +on: + push: + branches: "*" + paths: + - packages/fee-controller/** + pull_request: + branches: "*" + paths: + - packages/fee-controller/** + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Set up environment + uses: ./.github/actions/setup + - name: Lint + run: yarn workspace @mimic-fi/v3-fee-controller lint + - name: Job failed + if: failure() + uses: rjstone/discord-webhook-notify@v1 + with: + severity: error + details: Job failed! + webhookUrl: ${{ secrets.DISCORD_WEBHOOK }} + - name: Job cancelled + if: cancelled() + uses: rjstone/discord-webhook-notify@v1 + with: + severity: warn + details: Job cancelled! + webhookUrl: ${{ secrets.DISCORD_WEBHOOK }} + + test: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Set up environment + uses: ./.github/actions/setup + - name: Test + run: yarn workspace @mimic-fi/v3-fee-controller test + - name: Job failed + if: failure() + uses: rjstone/discord-webhook-notify@v1 + with: + severity: error + details: Job failed! + webhookUrl: ${{ secrets.DISCORD_WEBHOOK }} + - name: Job cancelled + if: cancelled() + uses: rjstone/discord-webhook-notify@v1 + with: + severity: warn + details: Job cancelled! + webhookUrl: ${{ secrets.DISCORD_WEBHOOK }} diff --git a/.github/workflows/ci-helpers.yml b/.github/workflows/ci-helpers.yml new file mode 100644 index 00000000..79595c40 --- /dev/null +++ b/.github/workflows/ci-helpers.yml @@ -0,0 +1,63 @@ +name: Helpers CI + +env: + CI: true + +on: + push: + branches: "*" + paths: + - packages/helpers/** + pull_request: + branches: "*" + paths: + - packages/helpers/** + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Set up environment + uses: ./.github/actions/setup + - name: Lint + run: yarn workspace @mimic-fi/v3-helpers lint + - name: Job failed + if: failure() + uses: rjstone/discord-webhook-notify@v1 + with: + severity: error + details: Job failed! + webhookUrl: ${{ secrets.DISCORD_WEBHOOK }} + - name: Job cancelled + if: cancelled() + uses: rjstone/discord-webhook-notify@v1 + with: + severity: warn + details: Job cancelled! + webhookUrl: ${{ secrets.DISCORD_WEBHOOK }} + + test: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Set up environment + uses: ./.github/actions/setup + - name: Test + run: yarn workspace @mimic-fi/v3-helpers test + - name: Job failed + if: failure() + uses: rjstone/discord-webhook-notify@v1 + with: + severity: error + details: Job failed! + webhookUrl: ${{ secrets.DISCORD_WEBHOOK }} + - name: Job cancelled + if: cancelled() + uses: rjstone/discord-webhook-notify@v1 + with: + severity: warn + details: Job cancelled! + webhookUrl: ${{ secrets.DISCORD_WEBHOOK }} diff --git a/.github/workflows/ci-price-oracle.yml b/.github/workflows/ci-price-oracle.yml new file mode 100644 index 00000000..f4e13158 --- /dev/null +++ b/.github/workflows/ci-price-oracle.yml @@ -0,0 +1,63 @@ +name: Price Oracle CI + +env: + CI: true + +on: + push: + branches: "*" + paths: + - packages/price-oracle/** + pull_request: + branches: "*" + paths: + - packages/price-oracle/** + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Set up environment + uses: ./.github/actions/setup + - name: Lint + run: yarn workspace @mimic-fi/v3-price-oracle lint + - name: Job failed + if: failure() + uses: rjstone/discord-webhook-notify@v1 + with: + severity: error + details: Job failed! + webhookUrl: ${{ secrets.DISCORD_WEBHOOK }} + - name: Job cancelled + if: cancelled() + uses: rjstone/discord-webhook-notify@v1 + with: + severity: warn + details: Job cancelled! + webhookUrl: ${{ secrets.DISCORD_WEBHOOK }} + + test: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Set up environment + uses: ./.github/actions/setup + - name: Test + run: yarn workspace @mimic-fi/v3-price-oracle test + - name: Job failed + if: failure() + uses: rjstone/discord-webhook-notify@v1 + with: + severity: error + details: Job failed! + webhookUrl: ${{ secrets.DISCORD_WEBHOOK }} + - name: Job cancelled + if: cancelled() + uses: rjstone/discord-webhook-notify@v1 + with: + severity: warn + details: Job cancelled! + webhookUrl: ${{ secrets.DISCORD_WEBHOOK }} diff --git a/.github/workflows/ci-registry.yml b/.github/workflows/ci-registry.yml new file mode 100644 index 00000000..3a0ed64c --- /dev/null +++ b/.github/workflows/ci-registry.yml @@ -0,0 +1,63 @@ +name: Registry CI + +env: + CI: true + +on: + push: + branches: "*" + paths: + - packages/registry/** + pull_request: + branches: "*" + paths: + - packages/registry/** + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Set up environment + uses: ./.github/actions/setup + - name: Lint + run: yarn workspace @mimic-fi/v3-registry lint + - name: Job failed + if: failure() + uses: rjstone/discord-webhook-notify@v1 + with: + severity: error + details: Job failed! + webhookUrl: ${{ secrets.DISCORD_WEBHOOK }} + - name: Job cancelled + if: cancelled() + uses: rjstone/discord-webhook-notify@v1 + with: + severity: warn + details: Job cancelled! + webhookUrl: ${{ secrets.DISCORD_WEBHOOK }} + + test: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Set up environment + uses: ./.github/actions/setup + - name: Test + run: yarn workspace @mimic-fi/v3-registry test + - name: Job failed + if: failure() + uses: rjstone/discord-webhook-notify@v1 + with: + severity: error + details: Job failed! + webhookUrl: ${{ secrets.DISCORD_WEBHOOK }} + - name: Job cancelled + if: cancelled() + uses: rjstone/discord-webhook-notify@v1 + with: + severity: warn + details: Job cancelled! + webhookUrl: ${{ secrets.DISCORD_WEBHOOK }} diff --git a/.github/workflows/ci-smart-vault.yml b/.github/workflows/ci-smart-vault.yml new file mode 100644 index 00000000..47f16658 --- /dev/null +++ b/.github/workflows/ci-smart-vault.yml @@ -0,0 +1,63 @@ +name: Smart Vault CI + +env: + CI: true + +on: + push: + branches: "*" + paths: + - packages/smart-vault/** + pull_request: + branches: "*" + paths: + - packages/smart-vault/** + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Set up environment + uses: ./.github/actions/setup + - name: Lint + run: yarn workspace @mimic-fi/v3-smart-vault lint + - name: Job failed + if: failure() + uses: rjstone/discord-webhook-notify@v1 + with: + severity: error + details: Job failed! + webhookUrl: ${{ secrets.DISCORD_WEBHOOK }} + - name: Job cancelled + if: cancelled() + uses: rjstone/discord-webhook-notify@v1 + with: + severity: warn + details: Job cancelled! + webhookUrl: ${{ secrets.DISCORD_WEBHOOK }} + + test: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Set up environment + uses: ./.github/actions/setup + - name: Test + run: yarn workspace @mimic-fi/v3-smart-vault test + - name: Job failed + if: failure() + uses: rjstone/discord-webhook-notify@v1 + with: + severity: error + details: Job failed! + webhookUrl: ${{ secrets.DISCORD_WEBHOOK }} + - name: Job cancelled + if: cancelled() + uses: rjstone/discord-webhook-notify@v1 + with: + severity: warn + details: Job cancelled! + webhookUrl: ${{ secrets.DISCORD_WEBHOOK }} diff --git a/.github/workflows/ci-tasks.yml b/.github/workflows/ci-tasks.yml new file mode 100644 index 00000000..0957d5f2 --- /dev/null +++ b/.github/workflows/ci-tasks.yml @@ -0,0 +1,63 @@ +name: Tasks CI + +env: + CI: true + +on: + push: + branches: "*" + paths: + - packages/tasks/** + pull_request: + branches: "*" + paths: + - packages/tasks/** + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Set up environment + uses: ./.github/actions/setup + - name: Lint + run: yarn workspace @mimic-fi/v3-tasks lint + - name: Job failed + if: failure() + uses: rjstone/discord-webhook-notify@v1 + with: + severity: error + details: Job failed! + webhookUrl: ${{ secrets.DISCORD_WEBHOOK }} + - name: Job cancelled + if: cancelled() + uses: rjstone/discord-webhook-notify@v1 + with: + severity: warn + details: Job cancelled! + webhookUrl: ${{ secrets.DISCORD_WEBHOOK }} + + test: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Set up environment + uses: ./.github/actions/setup + - name: Test + run: yarn workspace @mimic-fi/v3-tasks test + - name: Job failed + if: failure() + uses: rjstone/discord-webhook-notify@v1 + with: + severity: error + details: Job failed! + webhookUrl: ${{ secrets.DISCORD_WEBHOOK }} + - name: Job cancelled + if: cancelled() + uses: rjstone/discord-webhook-notify@v1 + with: + severity: warn + details: Job cancelled! + webhookUrl: ${{ secrets.DISCORD_WEBHOOK }}