name: Python package on: [push, pull_request] jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: Set up Python 3.9 uses: actions/setup-python@v2 with: python-version: 3.9 - name: Get full Python version id: full-python-version shell: bash run: echo ::set-output name=version::$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))") - name: Bootstrap poetry shell: bash run: | curl -sSL https://install.python-poetry.org \ | python - -y - name: Update PATH if: ${{ matrix.os != 'Windows' }} shell: bash run: echo "$HOME/.local/bin" >> $GITHUB_PATH - name: Configure poetry shell: bash run: poetry config virtualenvs.in-project true - name: Set up cache uses: actions/cache@v2 id: cache with: path: .venv key: venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/poetry.lock') }} - name: Ensure cache is healthy if: steps.cache.outputs.cache-hit == 'true' shell: bash run: timeout 10s poetry run pip --version || rm -rf .venv - name: Install dependencies shell: bash run: poetry install - name: Run precommit run: | poetry run pre-commit run --all-files - name: Test with pytest shell: bash run: poetry run pytest --cov=mev_inspect tests