From eb2f3a907c8fc2eb803d2f8f186479ee12342690 Mon Sep 17 00:00:00 2001 From: retroboy Date: Thu, 16 Nov 2023 20:54:14 +0100 Subject: [PATCH] added github actions --- .github/ISSUE_TEMPLATE/blank.yaml | 12 +++ .github/ISSUE_TEMPLATE/bug-report.yaml | 80 +++++++++++++++ .github/ISSUE_TEMPLATE/config.yml | 8 ++ .github/ISSUE_TEMPLATE/feature-request.yaml | 63 ++++++++++++ .github/dependabot.yml | 12 +++ .github/workflows/jediswap-mainnet.yml | 107 ++++++++++++++++++++ .github/workflows/jediswap-staging.yml | 45 ++++++++ .github/workflows/jediswap-testnet.yml | 45 ++++++++ package.json | 1 - 9 files changed, 372 insertions(+), 1 deletion(-) create mode 100644 .github/ISSUE_TEMPLATE/blank.yaml create mode 100644 .github/ISSUE_TEMPLATE/bug-report.yaml create mode 100644 .github/ISSUE_TEMPLATE/config.yml create mode 100644 .github/ISSUE_TEMPLATE/feature-request.yaml create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/jediswap-mainnet.yml create mode 100644 .github/workflows/jediswap-staging.yml create mode 100644 .github/workflows/jediswap-testnet.yml diff --git a/.github/ISSUE_TEMPLATE/blank.yaml b/.github/ISSUE_TEMPLATE/blank.yaml new file mode 100644 index 00000000..c8228275 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/blank.yaml @@ -0,0 +1,12 @@ +name: "Blank issue" +description: Create a new blank issue. +title: "Title" +body: + - type: textarea + id: description + attributes: + label: "Description" + description: Please enter an explicit description of your issue + placeholder: Short and explicit description of your incident... + validations: + required: true diff --git a/.github/ISSUE_TEMPLATE/bug-report.yaml b/.github/ISSUE_TEMPLATE/bug-report.yaml new file mode 100644 index 00000000..17ad80f1 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug-report.yaml @@ -0,0 +1,80 @@ +name: "🐛 Bug Report" +description: Create a new ticket for a bug. +title: "🐛 [BUG] - " +labels: [ + "bug" +] +body: + - type: textarea + id: description + attributes: + label: "Description" + description: Please enter an explicit description of your issue + placeholder: Short and explicit description of your incident... + validations: + required: true + - type: input + id: reprod-url + attributes: + label: "Reproduction URL" + description: Please enter your GitHub URL to provide a reproduction of the issue + placeholder: ex. https://github.com/USERNAME/REPO-NAME + validations: + required: true + - type: textarea + id: reprod + attributes: + label: "Reproduction steps" + description: Please enter an explicit description of your issue + value: | + 1. Go to '...' + 2. Click on '....' + 3. Scroll down to '....' + 4. See error + render: bash + validations: + required: true + - type: textarea + id: screenshot + attributes: + label: "Screenshots" + description: If applicable, add screenshots to help explain your problem. + value: | + ![DESCRIPTION](LINK.png) + render: bash + validations: + required: false + - type: textarea + id: logs + attributes: + label: "Logs" + description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks. + render: bash + validations: + required: false + - type: dropdown + id: browsers + attributes: + label: "Browsers" + description: What browsers are you seeing the problem on ? + multiple: true + options: + - Firefox + - Chrome + - Safari + - Microsoft Edge + - Opera + validations: + required: false + - type: dropdown + id: os + attributes: + label: "OS" + description: What is the impacted environment ? + multiple: true + options: + - Windows + - Linux + - Mac + validations: + required: false diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 00000000..5ffbb021 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,8 @@ +blank_issues_enabled: false +contact_links: + - name: Support + url: https://discord.com/invite/jediswap + about: Please ask and answer questions here + - name: List a token + url: https://github.com/jediswaplabs/default-token-list#adding-a-token + about: Any requests to add a token to Jediswap should go here diff --git a/.github/ISSUE_TEMPLATE/feature-request.yaml b/.github/ISSUE_TEMPLATE/feature-request.yaml new file mode 100644 index 00000000..70c82dd3 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature-request.yaml @@ -0,0 +1,63 @@ +name: "💡 Feature Request" +description: Create a new ticket for a new feature request +title: "💡 [REQUEST] - <title>" +labels: [ + "question" +] +body: + - type: input + id: start_date + attributes: + label: "Start Date" + description: Start of development + placeholder: "month/day/year" + validations: + required: false + - type: textarea + id: implementation_pr + attributes: + label: "Implementation PR" + description: Pull request used + placeholder: "#Pull Request ID" + validations: + required: false + - type: textarea + id: reference_issues + attributes: + label: "Reference Issues" + description: Common issues + placeholder: "#Issues IDs" + validations: + required: false + - type: textarea + id: summary + attributes: + label: "Summary" + description: Provide a brief explanation of the feature + placeholder: Describe in a few lines your feature request + validations: + required: true + - type: textarea + id: basic_example + attributes: + label: "Basic Example" + description: Indicate here some basic examples of your feature. + placeholder: A few specific words about your feature request. + validations: + required: true + - type: textarea + id: drawbacks + attributes: + label: "Drawbacks" + description: What are the drawbacks/impacts of your feature request ? + placeholder: Identify the drawbacks and impacts while being neutral on your feature request + validations: + required: true + - type: textarea + id: unresolved_question + attributes: + label: "Unresolved questions" + description: What questions still remain unresolved ? + placeholder: Identify any unresolved issues. + validations: + required: false diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..137b23d2 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,12 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for all configuration options: +# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates + +version: 2 +updates: + - package-ecosystem: "npm" + directory: "/" # Location of package manifests + schedule: + interval: "weekly" + day: "monday" diff --git a/.github/workflows/jediswap-mainnet.yml b/.github/workflows/jediswap-mainnet.yml new file mode 100644 index 00000000..f273d077 --- /dev/null +++ b/.github/workflows/jediswap-mainnet.yml @@ -0,0 +1,107 @@ +name: Release - Mainnet + +on: + workflow_dispatch: + inputs: + bumpType: + description: 'Bump version' + required: true + default: 'patch' + type: choice + options: + - 'patch' + - 'minor' + - 'major' +jobs: + bump: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + persist-credentials: false + + - uses: actions/setup-node@v3 + with: + node-version: 16 + cache: 'yarn' + + - name: Automated Version Bump + uses: phips28/gh-action-bump-version@v9.1.4 + env: + GITHUB_TOKEN: ${{ secrets.PAT }} + with: + version-type: ${{ inputs.bumpType }} + tag-prefix: 'v' + target-branch: 'main' + commit-message: 'CI: bumps version to {{version}}' + bump-policy: 'last-commit' + + cleanup: + runs-on: ubuntu-latest + needs: [bump] + steps: + - name: Check out code + uses: actions/checkout@v3 + + - name: Cleanup + run: | + gh extension install actions/gh-actions-cache + + REPO=${{ github.repository }} + BRANCH="refs/pull/${{ github.event.pull_request.number }}/merge" + + echo "Fetching list of cache key" + cacheKeysForPR=$(gh actions-cache list -R $REPO -B $BRANCH | cut -f 1 ) + + ## Setting this to not fail the workflow while deleting cache keys. + set +e + echo "Deleting caches..." + for cacheKey in $cacheKeysForPR + do + gh actions-cache delete $cacheKey -R $REPO -B $BRANCH --confirm + done + echo "Done" + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + build: + runs-on: ubuntu-latest + needs: [cleanup] + environment: + name: mainnet + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - uses: actions/setup-node@v3 + with: + node-version: 16 + cache: 'yarn' + + - name: Install dependencies + run: yarn install --immutable + + - name: Build Project + run: yarn production-build + env: + CI: false + RELEASE_TYPE: 'PRODUCTION' + + - name: Configure AWS + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{ secrets[format('AWS_ACCESS_KEY_ID_{0}', 'PRODUCTION')] }} + aws-secret-access-key: ${{ secrets[format('AWS_SECRET_ACCESS_KEY_{0}', 'PRODUCTION')] }} + aws-region: us-east-1 + + - name: Deploy app build to S3 bucket + run: aws s3 sync ./dist/ s3://$BUCKET_NAME + env: + BUCKET_NAME: ${{ secrets[format('AWS_S3_BUCKET_NAME_{0}', 'PRODUCTION')] }} + + - name: Run Cache Invalidation + run: aws cloudfront create-invalidation --distribution-id $CDN_DISTRIBUTION_ID --paths /\* + env: + CDN_DISTRIBUTION_ID: ${{ secrets[format('AWS_CDN_DISTRIBUTION_ID_{0}', 'PRODUCTION')] }} diff --git a/.github/workflows/jediswap-staging.yml b/.github/workflows/jediswap-staging.yml new file mode 100644 index 00000000..e7168665 --- /dev/null +++ b/.github/workflows/jediswap-staging.yml @@ -0,0 +1,45 @@ +name: Release - Staging + +on: + workflow_dispatch: + inputs: + +jobs: + build: + runs-on: ubuntu-latest + environment: + name: staging + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - uses: actions/setup-node@v3 + with: + node-version: 16 + cache: 'yarn' + + - name: Install dependencies + run: yarn install --immutable + + - name: Build Project + run: yarn staging-build + env: + CI: false + RELEASE_TYPE: 'STAGING' + + - name: Configure AWS + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{ secrets[format('AWS_ACCESS_KEY_ID_{0}', 'STAGING')] }} + aws-secret-access-key: ${{ secrets[format('AWS_SECRET_ACCESS_KEY_{0}', 'STAGING')] }} + aws-region: us-east-1 + - name: Deploy app build to S3 bucket + run: aws s3 sync ./dist/ s3://$BUCKET_NAME + env: + BUCKET_NAME: ${{ secrets[format('AWS_S3_BUCKET_NAME_{0}', 'STAGING')] }} + + - name: Run Cache Invalidation + run: aws cloudfront create-invalidation --distribution-id $CDN_DISTRIBUTION_ID --paths /\* + env: + CDN_DISTRIBUTION_ID: ${{ secrets[format('AWS_CDN_DISTRIBUTION_ID_{0}', 'STAGING')] }} diff --git a/.github/workflows/jediswap-testnet.yml b/.github/workflows/jediswap-testnet.yml new file mode 100644 index 00000000..bf631ab1 --- /dev/null +++ b/.github/workflows/jediswap-testnet.yml @@ -0,0 +1,45 @@ +name: Release - Testnet + +on: + workflow_dispatch: + inputs: + +jobs: + build: + runs-on: ubuntu-latest + environment: + name: testnet + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - uses: actions/setup-node@v3 + with: + node-version: 16 + cache: 'yarn' + + - name: Install dependencies + run: yarn install --immutable + + - name: Build Project + run: yarn testnet-build + env: + CI: false + RELEASE_TYPE: 'TESTNET' + + - name: Configure AWS + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{ secrets[format('AWS_ACCESS_KEY_ID_{0}', 'TESTNET')] }} + aws-secret-access-key: ${{ secrets[format('AWS_SECRET_ACCESS_KEY_{0}', 'TESTNET')] }} + aws-region: us-east-1 + - name: Deploy app build to S3 bucket + run: aws s3 sync ./dist/ s3://$BUCKET_NAME + env: + BUCKET_NAME: ${{ secrets[format('AWS_S3_BUCKET_NAME_{0}', 'TESTNET')] }} + + - name: Run Cache Invalidation + run: aws cloudfront create-invalidation --distribution-id $CDN_DISTRIBUTION_ID --paths /\* + env: + CDN_DISTRIBUTION_ID: ${{ secrets[format('AWS_CDN_DISTRIBUTION_ID_{0}', 'TESTNET')] }} diff --git a/package.json b/package.json index f958c839..0ec56657 100644 --- a/package.json +++ b/package.json @@ -296,7 +296,6 @@ }, "engines": { "npm": "please-use-yarn", - "node": "18.x", "yarn": ">=1.22" } }