Skip to content

Commit

Permalink
chore: refactor tests workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
joaoandre-avaiga committed Dec 15, 2023
1 parent 631ee56 commit 3fdba25
Show file tree
Hide file tree
Showing 6 changed files with 106 additions and 117 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/frontend-test-setup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Frontend Test Setup

on:
workflow_call

jobs:
frontend-test-setup:
steps:
- 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
26 changes: 26 additions & 0 deletions .github/workflows/general-test-setup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Test Setup

on:
workflow_call:
inputs:
python-version:
required: true
type: string
os:
required: true
type: string


jobs:
general-test-setup:
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python-version }}
- name: Install pipenv
run: curl https://raw.githubusercontent.com/pypa/pipenv/master/get-pipenv.py | python
- run: pipenv install --dev --python=${{ inputs.python-version }}
- name: Setup LibMagic (MacOS)
if: ${{ inputs.os }} == 'macos-latest'
run: brew install libmagic
20 changes: 20 additions & 0 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Linter Workflow

on:
workflow_call:

jobs:
linter:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# replace for Ruff in the future
- 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) --follow-imports skip"
extra-isort-options: "--line-length=120 --force-grid-wrap=10 --multi-line=VERTICAL_HANGING_INDENT --trailing-comma"
44 changes: 44 additions & 0 deletions .github/workflows/overall-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Test Workflow

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

jobs:
lint:
uses: Avaiga/taipy/.github/workflows/linter.yml

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: Avaiga/taipy/.github/workflows/general-test-setup.yml
with:
python-version: ${{matrix.python-version}}
os: ${{matrix.os}}
- uses: Avaiga/taipy/.github/workflows/frontend-test-setup.yml
- 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
72 changes: 0 additions & 72 deletions .github/workflows/test.yml

This file was deleted.

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

This file was deleted.

0 comments on commit 3fdba25

Please sign in to comment.