Skip to content

Commit

Permalink
Merge pull request #608 from Avaiga/feature/refactor-gh-workflows
Browse files Browse the repository at this point in the history
chore: refactor tests workflow
  • Loading branch information
joaoandre-avaiga authored Dec 20, 2023
2 parents b826a99 + c150d23 commit 8c44379
Show file tree
Hide file tree
Showing 9 changed files with 181 additions and 111 deletions.
7 changes: 7 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
19 changes: 0 additions & 19 deletions .github/sync.yml

This file was deleted.

27 changes: 0 additions & 27 deletions .github/workflows/linter.yml

This file was deleted.

59 changes: 59 additions & 0 deletions .github/workflows/overall-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Overall Test Workflow

on:
pull_request_review:
types: [submitted]

jobs:
tests:
if: github.event.review.state == 'approved'
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

- name: Install Dependencies
run: pipenv install --dev --python=${{ matrix.python-version }}

- name: Setup LibMagic (MacOS)
if: matrix.os == 'macos-latest'
run: brew install libmagic

- uses: actions/setup-node@v4
with:
node-version: 20
- 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
4 changes: 2 additions & 2 deletions .github/workflows/packaging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ jobs:
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-versions }}

Expand Down
112 changes: 112 additions & 0 deletions .github/workflows/partial-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
name: Partial Tests Workflow

on:
push:
branches: [ develop, dev/*, release/* ]
pull_request:
branches: [ develop, dev/*, release/* ]

jobs:
linter:
runs-on: ubuntu-latest
steps:
# replace for Ruff in the future
- uses: actions/checkout@v4
- uses: ricardochaves/[email protected]
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|tools) --follow-imports skip"
extra-isort-options: "--line-length=120 --force-grid-wrap=10 --multi-line=VERTICAL_HANGING_INDENT --trailing-comma"
tests:
needs: linter
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: dorny/paths-filter@v2
id: changes
with:
filters: |
cli:
- 'taipy/_cli/**'
config:
- 'taipy/config/**'
core:
- 'taipy/core/**'
gui:
- 'taipy/gui/**'
gui-core:
- 'taipy/gui_core/**'
logger:
- 'taipy/logger/**'
rest:
- 'taipy/rest/**'
templates:
- 'taipy/templates/**'
- 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

- name: Install Dependencies
run: pipenv install --dev --python=${{ matrix.python-version }}

- name: Setup LibMagic (MacOS)
if: matrix.os == 'macos-latest'
run: brew install libmagic

- uses: actions/setup-node@v4
with:
node-version: 20
- name: Frontend Bundle Build
if: steps.changes.outputs.gui == 'true' || steps.changes.outputs.gui-core == 'true'
run: pipenv run python tools/frontend/bundle_build.py

- name: Install Playwright
if: steps.changes.outputs.gui == 'true' || steps.changes.outputs.gui-core == 'true'
run: pipenv run playwright install chromium --with-deps

- name: Pytest CLI
if: steps.changes.outputs.cli == 'true'
run: pipenv run pytest tests/cli

- name: Pytest Config
if: steps.changes.outputs.config == 'true'
run: pipenv run pytest tests/config

- name: Pytest Core
if: steps.changes.outputs.core == 'true'
run: pipenv run pytest tests/core

- name: Pytest GUI
if: steps.changes.outputs.gui == 'true'
run: pipenv run pytest tests/gui

- name: Pytest GUI Core
if: steps.changes.outputs.gui-core == 'true'
run: pipenv run pytest tests/gui_core

- name: Pytest Logger
if: steps.changes.outputs.logger == 'true'
run: pipenv run pytest tests/logger

- name: Pytest Rest
if: steps.changes.outputs.rest == 'true'
run: pipenv run pytest tests/rest

- name: Pytest Rest
if: steps.changes.outputs.templates == 'true'
run: pipenv run pytest tests/templates
17 changes: 0 additions & 17 deletions .github/workflows/sync.yml

This file was deleted.

45 changes: 0 additions & 45 deletions .github/workflows/tests.yml

This file was deleted.

2 changes: 1 addition & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ pandas-stubs = "*"
playwright = "*"
pre-commit = "*"
pyopenssl = "*"
pytest = "*"
pytest = "==7.4.3"
pytest-cov = "*"
pytest-mock = "*"
pytest-playwright = "*"
Expand Down

0 comments on commit 8c44379

Please sign in to comment.