Browse Source

[ci] Port Python 2 CircleCi to GH action

Romain Rigaux 4 years ago
parent
commit
e75e018e58
1 changed files with 139 additions and 0 deletions
  1. 139 0
      .github/workflows/commitflow.yml

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

@@ -0,0 +1,139 @@
+name: Python 2 CI
+
+on:
+  push:
+    branches:
+    - master
+  pull_request:
+    branches:
+    - master
+jobs:
+  build:
+
+    runs-on: ubuntu-latest
+    container: gethue/hue:latest-py2
+
+    strategy:
+      matrix:
+        python-version: [2.7]
+
+    steps:
+    - name: Checkout
+      uses: actions/checkout@v2
+
+    - name: Set up Python ${{ matrix.python-version }}
+      uses: actions/setup-python@v2
+      with:
+        python-version: ${{ matrix.python-version }}
+
+    - name: refresh sources
+      run: |
+        pwd
+
+        rm -r /usr/share/hue/desktop/core/src/desktop
+        cp -r desktop/core/src/desktop /usr/share/hue/desktop/core/src/desktop
+
+        for lib in `ls desktop/libs`
+        do
+          rm -r /usr/share/hue/desktop/libs/$lib/src/$lib
+          cp -r desktop/libs/$lib/src/$lib /usr/share/hue/desktop/libs/$lib/src/$lib
+        done
+        for lib in `ls apps | grep -v Makefile`
+        do
+          rm -r /usr/share/hue/apps/$lib/src/$lib
+          cp -r apps/$lib/src/$lib /usr/share/hue/apps/$lib/src/$lib
+        done
+
+        rm -r /usr/share/hue/tools
+        cp -r tools /usr/share/hue
+
+        rm /usr/share/hue/desktop/conf/*.ini
+        cp desktop/conf/pseudo-distributed.ini.tmpl /usr/share/hue/desktop/conf/pseudo-distributed.ini
+
+        # ini configuration tweaks
+        ## Very slow if on, cuts time in two and does not skip tests
+        sed -i 's/## has_iam_detection=true/  has_iam_detection=false/g' /usr/share/hue/desktop/conf/pseudo-distributed.ini
+
+        # make npm-install # Not available
+        cp .babelrc /usr/share/hue
+        cp tsconfig.json /usr/share/hue
+        cp jest.config.js /usr/share/hue
+        cp .pylintrc /usr/share/hue
+
+        cp webpack.config*.js /usr/share/hue
+        rm /usr/share/hue/package.json
+        cp package.json /usr/share/hue
+        rm /usr/share/hue/package-lock.json
+        cp package-lock.json /usr/share/hue
+
+        cp -r docs /usr/share/hue
+
+        cd /usr/share/hue
+
+        npm install
+        npm i eslint-plugin-jest@latest --save-dev # Seems to not be found otherwise
+        npm run webpack
+        npm run webpack-login
+        npm run webpack-workers
+        ./build/env/bin/hue collectstatic --noinput
+
+
+    - name: run documentation lints
+      run: |
+        # Installs to move to image building
+        curl -O https://dl.google.com/go/go1.15.linux-amd64.tar.gz
+        tar -xvf go1.15.linux-amd64.tar.gz
+        export GO111MODULE=on
+        go/bin/go get -u github.com/raviqqe/muffet@v1.5.7
+
+        curl --output hugo_0.69.0_Linux-64bit.tar.gz -L https://github.com/gohugoio/hugo/releases/download/v0.69.0/hugo_0.69.0_Linux-64bit.tar.gz
+        tar -xvf hugo_0.69.0_Linux-64bit.tar.gz
+
+        export PATH=$PWD:$HOME/go/bin:$PATH
+
+        # Trigger linting if documentation changes
+        ./tools/ci/check_for_website_dead_links.sh docs/docs-site
+        # ./tools/ci/check_for_website_dead_links.sh docs/gethue
+
+    # Run code lints
+    - name: run python lints
+      run: |
+        /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 npm absolute path detection
+      run: |
+        cd /usr/share/hue
+
+        npm run check-absolute-paths
+
+    # Run tests
+    - name: run python API tests
+      run: |
+        cd /usr/share/hue
+
+        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