# This workflow will install Python dependencies, run tests and lint with a variety of Python versions # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python # just comment out unwanted steps to turn off the test. name: Unit Tests on: push: branches: - 'big-refactor*' pull_request: branches: - 'big-refactor*' workflow_dispatch: # Jobs run concurrently and steps run sequentially within a job. # jobs: linter and cpu_tests. Add more jobs/steps as required. jobs: linter: name: Linters runs-on: ubuntu-latest timeout-minutes: 20 steps: - name: Checkout Code uses: actions/checkout@v3 - name: Set up Python 3.9 uses: actions/setup-python@v4 with: python-version: 3.9 cache: pip cache-dependency-path: setup.py - name: Install dependencies run: pip install -e '.[linting,testing]' --extra-index-url https://download.pytorch.org/whl/cpu - name: Pre-Commit uses: pre-commit/action@v3.0.0 - name: Lint with pylint run: python -m pylint --disable=all -e W0311 --jobs=0 --indent-string=' ' **/*.py - name: Lint with flake8 run: | # stop the build if there are Python syntax errors or undefined names flake8 . --count --select=F,E9,E71,E72,E501,E112,E113,W6 --extend-ignore=F541 --show-source --statistics --exit-zero # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics # # mypy turned off for now # - name: Lint with mypy # run: mypy . --ignore-missing-imports --check-untyped-defs --explicit-package-bases --warn-unreachable # Job 2 # testcpu: # name: CPU Tests # runs-on: ubuntu-latest # strategy: # matrix: # python-version: [ "3.8", "3.9", "3.10", "3.11" ] # timeout-minutes: 30 # steps: # - name: Checkout Code # uses: actions/checkout@v3 # - name: Set up Python ${{ matrix.python-version }} # uses: actions/setup-python@v4 # with: # python-version: ${{ matrix.python-version }} # cache: pip # cache-dependency-path: setup.py # - name: Install dependencies # run: | # python -m pip install --upgrade pip # pip install -e '.[testing,anthropic,sentencepiece]' --extra-index-url https://download.pytorch.org/whl/cpu # # Install optional git dependencies # # pip install bleurt@https://github.com/google-research/bleurt/archive/b610120347ef22b494b6d69b4316e303f5932516.zip#egg=bleurt # # if [ -f requirements.txt ]; then pip install -r requirements.txt; fi # - name: Test with pytest # run: python -m pytest --showlocals -s -vv -n=auto --ignore=tests/tests_master --ignore=tests/extra # - name: Archive artifacts # uses: actions/upload-artifact@v3 # with: # name: output_results # path: | # test_logs/*