From e6b3b4bef061f188de19021fa552d6d8e8516883 Mon Sep 17 00:00:00 2001 From: Roger Carhuatocto Date: Mon, 13 Feb 2023 15:53:26 +0100 Subject: [PATCH] DOPS-445 Updated the GitHub workflows related to WebApp (#700) * `webapp-deploy.yml` updated * `webapp-push.yml` renamed to `webapp-test.yml` and updated * added `aragon/apps/.github/fleek/production.json` --- .github/fleek/{prod.json => production.json} | 0 .../workflows/pull_request_webapp_preview.yml | 16 +++++++++------ .github/workflows/webapp-deploy.yml | 20 +++++++++++-------- .../{webapp-push.yml => webapp-test.yml} | 12 +++++++---- 4 files changed, 30 insertions(+), 18 deletions(-) rename .github/fleek/{prod.json => production.json} (100%) rename .github/workflows/{webapp-push.yml => webapp-test.yml} (87%) diff --git a/.github/fleek/prod.json b/.github/fleek/production.json similarity index 100% rename from .github/fleek/prod.json rename to .github/fleek/production.json diff --git a/.github/workflows/pull_request_webapp_preview.yml b/.github/workflows/pull_request_webapp_preview.yml index c6c34d304..ede149e9a 100644 --- a/.github/workflows/pull_request_webapp_preview.yml +++ b/.github/workflows/pull_request_webapp_preview.yml @@ -14,7 +14,7 @@ jobs: run: working-directory: packages/web-app steps: - - name: Find Previous Deployment + - name: Find a PR comment uses: peter-evans/find-comment@v2 id: fc with: @@ -31,8 +31,9 @@ jobs: owner: context.repo.owner, repo: context.repo.repo, }) - - uses: actions/checkout@v3 - - name: Install node + - name: Checkout code + uses: actions/checkout@v3 + - name: Install NodeJS uses: actions/setup-node@v3 with: node-version: 16 @@ -47,6 +48,8 @@ jobs: run: yarn install --pure-lockfile - name: Link ui-components run: yarn link @aragon/ui-components + # - name: Lint + # run: yarn lint - name: Build run: yarn build env: @@ -56,11 +59,12 @@ jobs: VITE_IPFS_API_KEY: ${{secrets.VITE_IPFS_API_KEY}} VITE_ETHERSCAN_API_KEY: ${{secrets.VITE_ETHERSCAN_API_KEY}} NODE_OPTIONS: '--max-old-space-size=6656' - - uses: actions/setup-python@v4 + - name: Setup Python + uses: actions/setup-python@v4 with: python-version: '3.x' architecture: 'x64' - - name: install pyyaml + - name: Install Python modules run: | pip install --user pyyaml packaging - name: Install ipfs-cluster-ctl @@ -81,7 +85,7 @@ jobs: ipfsResult="$(./ipfs-cluster-ctl/ipfs-cluster-ctl --basic-auth '${{ secrets.IPFS_BASIC_AUTH }}' --host '${{ secrets.IPFS_HOST }}' add -r './dist/' | tail -1)" IFS=" " read -ra array <<< "$ipfsResult" echo "ipfsHash=${array[1]}" >> $GITHUB_OUTPUT - - name: Echo url + - name: Update the PR comment uses: peter-evans/create-or-update-comment@v2 with: issue-number: ${{ github.event.pull_request.number }} diff --git a/.github/workflows/webapp-deploy.yml b/.github/workflows/webapp-deploy.yml index 25fa7e186..b33723c71 100644 --- a/.github/workflows/webapp-deploy.yml +++ b/.github/workflows/webapp-deploy.yml @@ -25,7 +25,8 @@ jobs: if: endsWith(github.ref, '/main') id: envprod run: echo "environment=production" >> $GITHUB_OUTPUT - build-deploy: + + build-and-deploy: runs-on: ubuntu-latest container: fleek/create-react-app:node-16 needs: [set-environment] @@ -35,8 +36,9 @@ jobs: run: working-directory: ${{env.working-directory}} steps: - - uses: actions/checkout@v3 - - name: Install node + - name: Checkout code + uses: actions/checkout@v3 + - name: Install NodeJS uses: actions/setup-node@v3 with: node-version: 16 @@ -51,6 +53,8 @@ jobs: run: yarn install --pure-lockfile - name: Link ui-components run: yarn link @aragon/ui-components + # - name: Lint + # run: yarn lint - name: Test run: yarn test - name: Build @@ -62,19 +66,19 @@ jobs: VITE_IPFS_API_KEY: ${{secrets.VITE_IPFS_API_KEY}} VITE_ETHERSCAN_API_KEY: ${{secrets.VITE_ETHERSCAN_API_KEY}} NODE_OPTIONS: '--max-old-space-size=6656' - - name: Activate fleek + - name: Activate Fleek env: FLEEK_FILE: ${{ needs.set-environment.outputs.environment }} run: mv ../../.github/fleek/$FLEEK_FILE.json .fleek.json - - name: Deploy fleek + - name: Deploy through Fleek id: deploy uses: fleekhq/action-deploy@v1 with: apiKey: ${{ secrets.FLEEK_API_KEY }} workDir: ${{ env.working-directory }} - - name: Get the output url - run: echo "Deploy url is ${{ steps.deploy.outputs.deployUrl }}" - - name: upload sourcemap to apm + - name: Get the Fleek output url + run: echo "The Fleek deploy url is ${{ steps.deploy.outputs.deployUrl }}" + - name: Upload sourcemap to Kibana sourcemap endpoint (APM) env: COMMIT_SHA: ${{ github.sha }} run: | diff --git a/.github/workflows/webapp-push.yml b/.github/workflows/webapp-test.yml similarity index 87% rename from .github/workflows/webapp-push.yml rename to .github/workflows/webapp-test.yml index 05a7900c8..af72c283d 100644 --- a/.github/workflows/webapp-push.yml +++ b/.github/workflows/webapp-test.yml @@ -1,23 +1,27 @@ -name: WebApp Push +name: WebApp Test on: workflow_dispatch: push: paths: - 'packages/web-app/**' + branches-ignore: ## Ignore develop and main branches to avoid an unneeded 2nd build. + - 'develop' + - 'main' env: working-directory: packages/web-app jobs: - test: + build-and-test: runs-on: ubuntu-latest container: fleek/create-react-app:node-16 defaults: run: working-directory: ${{env.working-directory}} steps: - - uses: actions/checkout@v3 - - name: Install node + - name: Checkout code + uses: actions/checkout@v3 + - name: Install NodeJS uses: actions/setup-node@v3 with: node-version: 16