From d19319c80c96f05e56fe099f701ea2968667a0e9 Mon Sep 17 00:00:00 2001 From: neemiasbsilva Date: Mon, 30 Dec 2024 11:33:43 -0300 Subject: [PATCH] [Update] ci/cd jobs --- .github/workflows/ci-lint-unit-test.yml | 83 +++++++++++++++++++++++++ .github/workflows/test.yml | 40 ------------ 2 files changed, 83 insertions(+), 40 deletions(-) create mode 100644 .github/workflows/ci-lint-unit-test.yml delete mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/ci-lint-unit-test.yml b/.github/workflows/ci-lint-unit-test.yml new file mode 100644 index 0000000..358dd6a --- /dev/null +++ b/.github/workflows/ci-lint-unit-test.yml @@ -0,0 +1,83 @@ +name: Run Unit Test + +on: + push: + branches: + - main + pull_request: + branches: + - main + + +jobs: + ruff: + name: Run Ruff + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Set up Python 3.9 + uses: actions/setup-python@v4 + with: + python-version: 3.9 + + - name: Install dependencies for Ruff + run: | + python -m pip install --upgrade pip + pip install ruff + + - name: Run Ruff Linting + run: | + ruff check src + ruff check src --fix + + pylint: + name: Run pylint + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Set up Python 3.9 + uses: actions/setup-python@v4 + with: + python-version: 3.9 + + - name: Install dependencies for pylint + run: | + python -m pip install --upgrade pip + pip install pylint + + - name: Run pylint with fail-under + run: | + pylint src --rcfile=.pylintrc --fail-under=10 + + pytest: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Set up Python 3.9 + uses: actions/setup-python@v4 + with: + python-version: 3.9 + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + + - name: Install pytest dependencie + run: | + pip install pytest + pip install pytest-cov + + - name: Set PYTHONPATH for the tests + run: | + echo "PYTHONPATH=$(pwd)/src" >> $GITHUB_ENV + + - name: Run unit test with pytest + run: | + pytest --cov=src/toxic_comment_classification_kedro tests/ \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index d76700d..0000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,40 +0,0 @@ -name: Run Unit Test - -on: - push: - branches: - - main - pull_request: - branches: - - main - - -jobs: - test: - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - - name: Set up Python 3.9 - uses: actions/setup-python@v4 - with: - python-version: 3.9 - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install -r requirements.txt - - - name: Install pytest dependencie - run: | - pip install pytest - pip install pytest-cov - - - name: Set PYTHONPATH for the tests - run: | - echo "PYTHONPATH=$(pwd)/src" >> $GITHUB_ENV - - - name: Run unit test with pytest - run: | - pytest --cov=src/toxic_comment_classification_kedro tests/ \ No newline at end of file