diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml index bd2280348..5021f5e77 100644 --- a/.github/actions/setup/action.yml +++ b/.github/actions/setup/action.yml @@ -33,16 +33,8 @@ runs: - name: Install dependencies shell: bash - run: PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 pnpm i + run: pnpm i - - name: Cache playwright binaries - uses: actions/cache@v3 - id: playwright-cache - with: - path: ~/.cache/ms-playwright - key: ${{ runner.os }}-playwright-${{ hashFiles('**/pnpm-lock.yaml') }} - - - name: Install Playwright browsers - run: pnpm --filter "@custom-tests/e2e" download-browsers + - name: Check formatting shell: bash - if: steps.playwright-cache.outputs.cache-hit != 'true' + run: pnpm test:format diff --git a/.github/workflows/estimate.yml b/.github/workflows/estimate.yml new file mode 100644 index 000000000..d492e2c0c --- /dev/null +++ b/.github/workflows/estimate.yml @@ -0,0 +1,77 @@ +name: Estimate +on: + pull_request: + +jobs: + estimate: + name: Estimate + if: vars.JIRA_PROJECT_ID != '' + runs-on: ubuntu-20.04 + steps: + - name: Start Check Run + id: check + env: + GH_TOKEN: ${{ github.token }} + run: | + CHECK_ID=$(gh api -X POST -H "Accept: application/vnd.github+json" \ + -H "X-GitHub-Api-Version: 2022-11-28" \ + -f 'name=Estimator' \ + -f 'head_sha=${{ github.event.pull_request.head.sha }}' \ + -f 'status=in_progress' \ + -f 'output[title]=🎲 Estimation in progress' \ + -f 'output[summary]=🎲 Estimation in progress' \ + /repos/${{ github.repository }}/check-runs --jq '.id') + echo "check_id=$CHECK_ID" >> $GITHUB_OUTPUT + + - name: Install estimator + run: npm install -g @amazeelabs/estimator + + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Find common ancestor + id: ancestor + env: + BASE_BRANCH: ${{ github.base_ref }} + run: + echo "hash=$(git merge-base --fork-point origin/$BASE_BRANCH)" >> + $GITHUB_OUTPUT + + - name: Estimate + id: estimate + env: + JIRA_PROJECT_ID: ${{ vars.JIRA_PROJECT_ID }} + PARENT_COMMIT: ${{ steps.ancestor.outputs.hash }} + DASHBOARD_ACCESS_TOKEN: ${{ secrets.DASHBOARD_ACCESS_TOKEN }} + run: echo "result=$(amazeelabs-estimator estimate)" >> $GITHUB_OUTPUT + continue-on-error: true + + - name: Report success + env: + GH_TOKEN: ${{ github.token }} + run: | + gh api -X PATCH -H "Accept: application/vnd.github+json" \ + -H "X-GitHub-Api-Version: 2022-11-28" \ + -f 'name=Estimator' \ + -f 'head_sha=${{ github.event.pull_request.head.sha }}' \ + -f 'conclusion=success' \ + -f 'output[title]=🎲 ${{ steps.estimate.outputs.result }}' \ + -f 'output[summary]=🎲 ${{ steps.estimate.outputs.result }}' \ + /repos/${{ github.repository }}/check-runs/${{ steps.check.outputs.check_id }} + if: steps.estimate.outputs.result != '' + + - name: Report error + env: + GH_TOKEN: ${{ github.token }} + run: | + gh api -X PATCH -H "Accept: application/vnd.github+json" \ + -H "X-GitHub-Api-Version: 2022-11-28" \ + -f 'name=Estimator' \ + -f 'head_sha=${{ github.event.pull_request.head.sha }}' \ + -f 'conclusion=failure' \ + -f 'output[title]=💥 Estimation failed' \ + -f 'output[summary]=💥 Estimation failed' \ + /repos/${{ github.repository }}/check-runs/${{ steps.check.outputs.check_id }} + if: steps.estimate.outputs.result == '' diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9c1f520d6..d23873f19 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -91,6 +91,25 @@ jobs: target_branch: prod github_token: ${{ secrets.GITHUB_TOKEN }} + update_dashboard: + name: Update dashboard + if: github.ref == 'refs/heads/release' && vars.JIRA_PROJECT_ID != '' + runs-on: ubuntu-20.04 + steps: + - name: Install estimator + run: npm install -g @amazeelabs/estimator + + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Update dashboard + env: + JIRA_PROJECT_ID: ${{ vars.JIRA_PROJECT_ID }} + DASHBOARD_ACCESS_TOKEN: ${{ secrets.DASHBOARD_ACCESS_TOKEN }} + run: amazeelabs-estimator update + docker_build: name: Docker Build if: diff --git a/.github/workflows/write-dashboard.yml b/.github/workflows/write-dashboard.yml new file mode 100644 index 000000000..418c9c555 --- /dev/null +++ b/.github/workflows/write-dashboard.yml @@ -0,0 +1,23 @@ +name: Write dashboard history +on: + workflow_dispatch: + +jobs: + write_dashboard: + name: Write dashboard history + if: github.ref == 'refs/heads/release' && vars.JIRA_PROJECT_ID != '' + runs-on: ubuntu-20.04 + steps: + - name: Install estimator + run: npm install -g @amazeelabs/estimator + + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Update dashboard + env: + JIRA_PROJECT_ID: ${{ vars.JIRA_PROJECT_ID }} + DASHBOARD_ACCESS_TOKEN: ${{ secrets.DASHBOARD_ACCESS_TOKEN }} + run: amazeelabs-estimator write-history diff --git a/.gitignore b/.gitignore index f709950ec..345dc127c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ node_modules .idea/inspectionProfiles +.idea/git_toolbox_prj.xml build-storybook.log storybook-static coverage diff --git a/.idea/prettier.xml b/.idea/prettier.xml index 50edf175d..0d96645cd 100644 --- a/.idea/prettier.xml +++ b/.idea/prettier.xml @@ -5,4 +5,4 @@