Răsfoiți Sursa

[frontend] Create a separate upstream GitHub CI workflow for UI (#3248)

Nidhi Bhat G 2 ani în urmă
părinte
comite
6ed3d14633

+ 0 - 55
.circleci/config.yml

@@ -109,13 +109,6 @@ commands:
 
             cp -r ~/repo/docs .
 
-      - run:
-          name: run commit title format check
-          command: |
-            cd ~/repo
-
-            ./tools/ci/check_for_commit_message.sh
-
       # Run documentation lint
       - run:
           name: run documentation lints
@@ -146,44 +139,6 @@ commands:
             /usr/share/hue/build/env/bin/pip install pylint==1.7.5 pylint-django==0.7.2 configparser==4.0.2
             ./tools/ci/check_for_python_lint.sh /usr/share/hue
 
-      - run:
-          name: run js lint
-          command: |
-            cd /usr/share/hue
-            cp ~/repo/.prettierrc .
-            cp ~/repo/.eslint* .
-            cp ~/repo/tools . -r
-
-            npm run lint
-
-      - run:
-          name: run style lint
-          command: |
-            cd /usr/share/hue
-
-            npm run style-lint
-
-      - run:
-          name: run npm version checker
-          command: |
-            cd /usr/share/hue
-
-            npm run check-pinned-versions
-
-      - run:
-          name: run npm license checker
-          command: |
-            cd /usr/share/hue
-
-            npm run check-license
-
-      - run:
-          name: run npm absolute path detection
-          command: |
-            cd /usr/share/hue
-
-            npm run check-absolute-paths
-
       # Run tests
       - run:
           name: run python API tests
@@ -192,16 +147,6 @@ commands:
 
             PYTHONWARNINGS=always ./build/env/bin/hue test unit --with-xunit --with-cover
 
-      - run:
-          name: run js tests
-          command: |
-            cd /usr/share/hue
-
-            # https://jestjs.io/docs/en/troubleshooting.html#tests-are-extremely-slow-on-docker-andor-continuous-integration-ci-server
-            sed -i 's/"test": "jest"/"test": "jest --runInBand"/g' package.json
-
-            npm run test
-
       - store_artifacts:
           path: test-reports
           destination: test-reports

+ 33 - 0
.github/workflows/cleanup-cache.yml

@@ -0,0 +1,33 @@
+name: Cleanup caches by a branch
+on:
+  pull_request:
+    types:
+      - closed
+
+jobs:
+  cleanup:
+    runs-on: ubuntu-latest
+    steps:
+      - name: Checkout
+        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 }}

+ 59 - 0
.github/workflows/commitflow-ui.yml

@@ -0,0 +1,59 @@
+name: UI CI
+
+on:
+  push:
+    branches:
+    - master
+  pull_request:
+    branches:
+    - master
+    paths:
+      - '**.js'
+      - '**.jsx'
+      - '**.ts'
+      - '**.tsx'
+      - '**.less'
+      - '**.scss'
+      - '**.vue'
+      - 'package*.json'
+
+jobs:
+  build:
+    runs-on: ubuntu-20.04
+    steps:
+    - name: Checkout
+      uses: actions/checkout@v3
+
+    - name: Caching npm with setup node
+      uses: actions/setup-node@v3
+      with:
+        node-version: 14
+        cache: 'npm'
+
+    - name: Install npm dependencies
+      run: npm ci
+
+    - name: run commit title format check
+      run: ./tools/ci/check_for_commit_message.sh 
+
+    - name: run npm version checker
+      run: npm run check-pinned-versions
+
+    - name: run npm license checker
+      run: npm run check-license
+
+    - name: run npm absolute path detection
+      run: npm run check-absolute-paths
+
+    - name: run js lint
+      run: npm run lint
+
+    - name: run style lint
+      run: npm run style-lint
+
+    - name: run js tests
+      run: |
+        # https://jestjs.io/docs/en/troubleshooting.html#tests-are-extremely-slow-on-docker-andor-continuous-integration-ci-server
+        sed -i 's/"test": "jest"/"test": "jest --runInBand"/g' package.json
+
+        npm run test

+ 0 - 36
.github/workflows/commitflow.yml

@@ -77,7 +77,6 @@ jobs:
         npm run webpack-workers
         ./build/env/bin/hue collectstatic --noinput
 
-
     # - name: run documentation lints
     #   run: |
     #     cd $GITHUB_WORKSPACE
@@ -105,33 +104,6 @@ jobs:
     #     /usr/share/hue/build/env/bin/pip install pylint==1.7.5 pylint-django==0.7.2 configparser==4.0.2
     #     ./tools/ci/check_for_python_lint.sh /usr/share/hue
 
-    - name: run js lint
-      run: |
-        cp .prettierrc /usr/share/hue
-        cp .eslint* /usr/share/hue
-        cp tools /usr/share/hue -r
-
-        cd /usr/share/hue
-        npm run lint
-
-    - name: run npm license checker
-      run: |
-        cd /usr/share/hue
-
-        npm run check-license
-
-    - name: run style lint
-      run: |
-        cd /usr/share/hue
-
-        npm run style-lint
-
-    - name: run npm absolute path detection
-      run: |
-        cd /usr/share/hue
-
-        npm run check-absolute-paths
-
     # Run tests
     - name: run python API tests
       run: |
@@ -139,11 +111,3 @@ jobs:
 
         PYTHONWARNINGS=always ./build/env/bin/hue test unit --with-xunit --with-cover
 
-    - name: run js tests
-      run : |
-        cd /usr/share/hue
-
-        # https://jestjs.io/docs/en/troubleshooting.html#tests-are-extremely-slow-on-docker-andor-continuous-integration-ci-server
-        sed -i 's/"test": "jest"/"test": "jest --runInBand"/g' package.json
-
-        npm run test

+ 1 - 1
desktop/core/src/desktop/js/reactComponents/createRootElements.js

@@ -31,7 +31,7 @@ async function render(name, props, root) {
 }
 
 export async function createReactComponents(selector) {
-  // Find all DOM containers
+  // Find all DOM containers.
   document.querySelectorAll(`${selector} [data-reactcomponent]`).forEach(domContainer => {
     const componentName = domContainer.dataset['reactcomponent'];
     const rawPropDataset = domContainer.dataset.props ? JSON.parse(domContainer.dataset.props) : {};