name: Tests env: GTFF_USE_PROMPT_TOOLKIT: false GTFF_USE_ION: false on: [pull_request, push] jobs: linting: name: Linting runs-on: ubuntu-latest steps: - name: Checkout Code uses: actions/checkout@v2 - name: Setup Python 3.8 uses: actions/setup-python@v2 with: python-version: "3.8" architecture: x64 - uses: actions/cache@v2 with: path: ~/.cache/pip key: ${{ runner.os }}-linting restore-keys: ${{ runner.os }}-linting - run: pip install bandit black codespell flake8 mypy pyupgrade safety pylint - run: bandit -r . || true - run: black --check . - run: codespell --ignore-words-list="mape","ba","hist" --quiet-level=2 --skip=".git" --skip="*.yaml" --skip="*.json" - run: flake8 . --count --ignore=E203,W503 --max-line-length=122 --show-source --statistics - run: mypy --ignore-missing-imports . - run: shopt -s globstar && pyupgrade --py36-plus **/*.py - run: safety check - run: pylint **/*.py test: name: ubuntu-latest - Python 3.8 needs: linting runs-on: ubuntu-latest steps: - name: Checkout Code uses: actions/checkout@v2 - name: Setup Python 3.8 uses: actions/setup-python@v2 with: python-version: "3.8" architecture: x64 - name: Install Poetry uses: snok/install-poetry@v1.1.1 with: virtualenvs-create: true virtualenvs-in-project: true - name: Load cached venv id: cached-poetry-dependencies uses: actions/cache@v2 with: path: .venv key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }} - name: Install dependencies if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' run: poetry install --no-interaction --no-root - name: Install Package run: poetry install --no-interaction - name: Run tests env: MPLBACKEND: Agg run: | source $VENV pytest tests/ tests-python: name: Python (${{ matrix.python-version }}, ${{ matrix.os }}) needs: test runs-on: ${{ matrix.os }} strategy: fail-fast: true matrix: python-version: ['3.6', '3.7', '3.8'] os: [ubuntu-latest, macos-latest] exclude: - os: ubuntu-latest python-version: '3.8' steps: - name: Checkout Code uses: actions/checkout@v2 - name: Setup Python ${{ matrix.python-version }} uses: actions/setup-python@v1 with: python-version: ${{ matrix.python-version }} architecture: x64 - name: Install Poetry uses: snok/install-poetry@v1.1.1 with: virtualenvs-create: true virtualenvs-in-project: true - name: Load cached venv id: cached-poetry-dependencies uses: actions/cache@v2 with: path: .venv key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }} - name: Install dependencies if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' run: poetry install --no-interaction --no-root - name: Install Package run: poetry install --no-interaction - name: Run tests env: MPLBACKEND: Agg run: | source $VENV pytest tests/ tests-conda: name: Conda (${{ matrix.python-version }}, ${{ matrix.os }}) needs: test runs-on: ${{ matrix.os }}-latest strategy: fail-fast: false matrix: os: ['ubuntu', 'windows'] python-version: ['3.8'] dependencies: [''] include: - os: ubuntu python: 3.8 - os: windows python: 3.8 env: OS: ${{ matrix.os }} PYTHON: ${{ matrix.python }} steps: - name: Checkout uses: actions/checkout@v2 with: # Need to fetch more than the last commit so that setuptools-scm can # create the correct version string. If the number of commits since # the last release is greater than this, the version still be wrong. # Increase if necessary. fetch-depth: 100 # The GitHub token is preserved by default but this job doesn't need # to be able to push to GitHub. persist-credentials: false - name: Setup caching for conda packages uses: actions/cache@v2 with: path: ~/conda_pkgs_dir key: conda-${{ runner.os }}-${{ matrix.python }}-${{ hashFiles('requirements*.txt') }} - name: Setup Miniconda uses: conda-incubator/setup-miniconda@v2 with: python-version: ${{ matrix.python }} miniconda-version: "latest" auto-update-conda: true channels: conda-forge show-channel-urls: true environment-file: conda-environment.yaml activate-environment: testing # Needed for caching use-only-tar-bz2: true - name: Update Temp permissions on windows if: runner.os == 'Windows' shell: cmd /C CALL {0} run: >- c:\windows\system32\icacls C:\Users\runneradmin\AppData\Local\Temp /grant "everyone":F /t - name: Install dependencies (Bash) shell: bash -l {0} run: | conda info pip install --user --requirement requirements.txt - name: List installed packages (Bash) shell: bash -l {0} run: conda list - name: Run tests (Bash) shell: bash -l {0} run: pytest tests/