Explorar o código

chore: refactor tests workflow

Joao Andre hai 1 ano
pai
achega
486ea97152
Modificáronse 7 ficheiros con 125 adicións e 109 borrados
  1. 7 0
      .editorconfig
  2. 0 19
      .github/sync.yml
  3. 0 27
      .github/workflows/linter.yml
  4. 0 17
      .github/workflows/sync.yml
  5. 72 0
      .github/workflows/test.yml
  6. 45 45
      .github/workflows/tests.yml
  7. 1 1
      Pipfile

+ 7 - 0
.editorconfig

@@ -11,6 +11,13 @@ insert_final_newline = true
 charset = utf-8
 end_of_line = lf
 
+[*.yml]
+indent_style = space
+indent_size = 2
+charset = utf-8
+end_of_line = lf
+
+
 [*.bat]
 indent_style = tab
 end_of_line = crlf

+ 0 - 19
.github/sync.yml

@@ -1,19 +0,0 @@
-group:
-  repos: |
-    Avaiga/taipy-config
-    Avaiga/taipy-core
-    Avaiga/taipy-gui
-    Avaiga/taipy-rest
-
-  files:
-    - .flake8
-    - .gitattributes
-    - .license-header
-    - CODE_OF_CONDUCT.md
-    - CONTRIBUTING.md
-    - LICENSE
-    - mypy.ini
-    - pyproject.toml
-    - taipy/__init__.py
-    # - .isort.cfg
-    # - __init__.py

+ 0 - 27
.github/workflows/linter.yml

@@ -1,27 +0,0 @@
-name: Python linter and type checker
-
-on:
-  push:
-    branches: [ develop, dev/*, release/* ]
-  pull_request:
-    branches: [ develop, dev/*, release/* ]
-
-jobs:
-  linter:
-    timeout-minutes: 20
-    strategy:
-      fail-fast: false
-      matrix:
-        language: [ 'python' ]
-    runs-on: ubuntu-latest
-    steps:
-      - uses: actions/checkout@v3
-      - uses: ricardochaves/python-lint@v1.4.0
-        with:
-          use-pylint: false
-          use-isort: false
-          use-mypy: false
-          extra-black-options: "--line-length=120 --diff"
-          extra-pycodestyle-options: "--max-line-length=120  --exclude=tests/gui --ignore=E121,E123,E126,E226,E24,E704,W503,W504,E203"
-          extra-mypy-options: "--ignore-missing-imports --implicit-optional --no-namespace-packages --exclude (taipy/templates/|generate_pyi.py) --follow-imports skip"
-          extra-isort-options: "--line-length=120 --force-grid-wrap=10 --multi-line=VERTICAL_HANGING_INDENT --trailing-comma"

+ 0 - 17
.github/workflows/sync.yml

@@ -1,17 +0,0 @@
-name: Sync Files
-on:
-  push:
-    branches:
-      - develop
-  workflow_dispatch:
-jobs:
-  sync:
-    runs-on: ubuntu-latest
-    steps:
-      - name: Checkout Repository
-        uses: actions/checkout@develop
-      - name: Run GitHub File Sync
-        uses: BetaHuhn/repo-file-sync-action@v1
-        with:
-          GH_PAT: ${{ secrets.GH_PAT }}
-

+ 72 - 0
.github/workflows/test.yml

@@ -0,0 +1,72 @@
+name: Test Workflow
+
+on:
+  push:
+    branches: [ develop, dev/*, release/* ]
+  pull_request:
+    branches: [ develop, dev/*, release/* ]
+
+jobs:
+  lint:
+    runs-on: ubuntu-latest
+    steps:
+        - uses: actions/checkout@v4
+        # replace for Ruff in the future
+        - uses: ricardochaves/python-lint@v1.4.0
+          with:
+            use-pylint: false
+            use-isort: false
+            use-mypy: false
+            extra-black-options: "--line-length=120 --diff"
+            extra-pycodestyle-options: "--max-line-length=120  --exclude=tests/gui --ignore=E121,E123,E126,E226,E24,E704,W503,W504,E203"
+            extra-mypy-options: "--ignore-missing-imports --implicit-optional --no-namespace-packages --exclude (taipy/templates/|generate_pyi.py) --follow-imports skip"
+            extra-isort-options: "--line-length=120 --force-grid-wrap=10 --multi-line=VERTICAL_HANGING_INDENT --trailing-comma"
+  tests:
+    needs: lint
+    timeout-minutes: 40
+    strategy:
+      fail-fast: false
+      matrix:
+        python-version: ['3.8', '3.9', '3.10', '3.11']
+        os: [ubuntu-latest, windows-latest, macos-latest]
+    runs-on: ${{ matrix.os }}
+    steps:
+      - uses: actions/checkout@v4
+      - uses: actions/setup-python@v5
+        with:
+          python-version: ${{ matrix.python-version }}
+      - name: Install pipenv
+        run: curl https://raw.githubusercontent.com/pypa/pipenv/master/get-pipenv.py | python
+      - run: pipenv install --dev --python=${{ matrix.python-version }}
+
+      - uses: actions/setup-node@v4
+        with:
+          node-version: 20
+
+      - name: Setup LibMagic (MacOS)
+        if: matrix.os == 'macos-latest'
+        run: brew install libmagic
+
+      - name: Frontend Bundle Build
+        run: pipenv run python tools/frontend/bundle_build.py
+
+      - name: Install Playwright
+        run: pipenv run playwright install chromium --with-deps
+
+      - name: Pytest
+        run: pipenv run pytest --cov=taipy --cov-append --cov-report="xml:overall-coverage.xml" --cov-report term-missing tests
+
+      - name: Coverage
+        if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11'
+        uses: MishaKav/pytest-coverage-comment@main
+        with:
+          pytest-xml-coverage-path: ./overall-coverage.xml
+          title: Taipy Overall Coverage Report
+
+      - name: Notify user if failed
+        if: failure() && github.event_name == 'workflow_dispatch'
+        run: |
+          if [[ -n "${{ github.event.inputs.user-to-notify }}" ]]; then
+            curl "${{ secrets.notify_endpoint }}" -d '{"username": "${{ github.event.inputs.user-to-notify }}", "url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" }' -H "Content-Type: application/json"
+          fi
+        shell: bash

+ 45 - 45
.github/workflows/tests.yml

@@ -1,45 +1,45 @@
-name: Python tests
-
-on:
-  push:
-    branches: [ develop, dev/*, release/* ]
-  pull_request:
-    branches: [ develop, dev/*, release/* ]
-
-jobs:
-  backend:
-    timeout-minutes: 40
-    strategy:
-      fail-fast: false
-      matrix:
-        python-versions: ['3.8', '3.9', '3.10', '3.11']
-        os: [ubuntu-latest, windows-latest, macos-latest]
-    runs-on: ${{ matrix.os }}
-
-    steps:
-      - uses: actions/checkout@v3
-      - uses: actions/setup-python@v4
-        with:
-          python-version: ${{ matrix.python-versions }}
-      - uses: actions/setup-node@v4
-        with:
-          node-version: '20'
-
-
-      - name: install libmagic on macos
-        if: matrix.os == 'macos-latest'
-        run: brew install libmagic
-
-      - name: Tests
-        if: matrix.os != 'windows-latest' || matrix.python-versions != '3.8'
-        run: |
-          pip install tox
-          tox -e tests
-
-      - name: Notify user if failed
-        if: failure() && github.event_name == 'workflow_dispatch'
-        run: |
-          if [[ -n "${{ github.event.inputs.user-to-notify }}" ]]; then
-            curl "${{ secrets.notify_endpoint }}" -d '{"username": "${{ github.event.inputs.user-to-notify }}", "url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" }' -H "Content-Type: application/json"
-          fi
-        shell: bash
+#name: Python tests
+#
+#on:
+#  push:
+#    branches: [ develop, dev/*, release/* ]
+#  pull_request:
+#    branches: [ develop, dev/*, release/* ]
+#
+#jobs:
+#  backend:
+#    timeout-minutes: 40
+#    strategy:
+#      fail-fast: false
+#      matrix:
+#        python-versions: ['3.8', '3.9', '3.10', '3.11']
+#        os: [ubuntu-latest, windows-latest, macos-latest]
+#    runs-on: ${{ matrix.os }}
+#
+#    steps:
+#      - uses: actions/checkout@v3
+#      - uses: actions/setup-python@v4
+#        with:
+#          python-version: ${{ matrix.python-versions }}
+#      - uses: actions/setup-node@v4
+#        with:
+#          node-version: '20'
+#
+#
+#      - name: install libmagic on macos
+#        if: matrix.os == 'macos-latest'
+#        run: brew install libmagic
+#
+#      - name: Tests
+#        if: matrix.os != 'windows-latest' || matrix.python-versions != '3.8'
+#        run: |
+#          pip install tox
+#          tox -e tests
+#
+#      - name: Notify user if failed
+#        if: failure() && github.event_name == 'workflow_dispatch'
+#        run: |
+#          if [[ -n "${{ github.event.inputs.user-to-notify }}" ]]; then
+#            curl "${{ secrets.notify_endpoint }}" -d '{"username": "${{ github.event.inputs.user-to-notify }}", "url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" }' -H "Content-Type: application/json"
+#          fi
+#        shell: bash

+ 1 - 1
Pipfile

@@ -57,7 +57,7 @@ pandas-stubs = "*"
 playwright = "*"
 pre-commit = "*"
 pyopenssl = "*"
-pytest = "*"
+pytest = "==7.4.3"
 pytest-cov = "*"
 pytest-mock = "*"
 pytest-playwright = "*"