From d0cc6bea89d4b7be72f1ba097758b60e24c61c47 Mon Sep 17 00:00:00 2001 From: Can Ergen Date: Tue, 13 Dec 2022 11:09:58 -0800 Subject: [PATCH] Create test.yml Test PopV --- .github/workflows/test.yml | 72 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..ec86606 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,72 @@ +# This workflow will install Python dependencies, run tests and lint with a variety of Python versions +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions + +name: popv + +on: + push: + branches: [main, can-refactored] + pull_request: + branches: [main] + +jobs: + build: + runs-on: ubuntu-latest + timeout-minutes: 20 + strategy: + matrix: + python-version: ["3.7", "3.8", "3.9"] + + steps: + - uses: actions/checkout@v2 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + + - name: Cache pip + uses: actions/cache@v2 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-v1-${{ hashFiles('**/requirements.txt') }} + restore-keys: | + ${{ runner.os }}-pip-v1- + - name: Install dependencies + id: dependencies + run: | + pip install pytest-cov + pip install .[dev,pymde,autotune] + # Following checks are independent and are run even if one fails + - name: Lint with flake8 + run: | + flake8 + if: ${{ steps.dependencies.outcome == 'success' && always() }} + + - name: Format with black + run: | + black --check . + if: ${{ steps.dependencies.outcome == 'success' && always() }} + + - name: Import sort + run: | + isort --check-only . + if: ${{ steps.dependencies.outcome == 'success' && always() }} + + - name: Test with pytest + run: | + pytest --cov-report=xml --cov= + --internet-tests --color=yes + if: ${{ steps.dependencies.outcome == 'success' && always() }} + # -------------------------------------------------------------- + + - name: After success + run: | + codecov + pip list + - name: Codacy upload + env: + CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }} + run: | + bash <(curl -Ls https://coverage.codacy.com/get.sh) report -l Python -r coverage.xml + continue-on-error: true