Skip to content

CI: Add poetry caching from libvcs, add python 2.7 #296

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 16, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 52 additions & 12 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,59 @@ on: [push, pull_request]

jobs:
build:
# Don't run twice for internal PRs from our own repo
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository

runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ '3.x' ]
python-version: [ '2.7', '3.x' ]
tmux-version: [ '2.6', '2.7', '2.8', '3.0', 'master' ]
steps:
- uses: actions/checkout@v1
- name: Cache tmux build ${{ matrix.tmux-version }}

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}

- 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: Install poetry
run: |
curl -O -sSL https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py
python get-poetry.py -y
echo "::set-env name=PATH::$HOME/.poetry/bin:$PATH"
rm get-poetry.py

- name: Get poetry cache paths from config
run: |
echo ::set-env name=poetry_cache_dir::$(poetry config --list | sed -n 's/.*cache-dir = //p' | sed -e 's/^"//' -e 's/"$//')
echo ::set-env name=poetry_virtualenvs_path::$(poetry config --list | sed -n 's/.*virtualenvs.path = .* # //p' | sed -e 's/^"//' -e 's/"$//')

- name: Configure poetry
shell: bash
run: poetry config virtualenvs.in-project true

- name: Set up poetry cache
uses: actions/cache@v2
id: cache
with:
path: |
.venv
{{ env.poetry_cache_dir }}
{{ env.poetry_virtualenvs_path }}
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: poetry run pip --version >/dev/null 2>&1 || rm -rf .venv

- name: Setup tmux build cache for tmux ${{ matrix.tmux-version }}
id: tmux-build-cache
uses: actions/cache@v1
with:
Expand All @@ -33,18 +77,14 @@ jobs:
export PATH=$HOME/tmux-builds/tmux-${{ matrix.tmux-version }}/bin:$PATH
cd ~
tmux -V
- name: Configure git
run: |
git config --global user.name 'travis-ci'
git config --global user.email 'travis@nowhere.edu'
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}

- name: Upgrade pip
shell: bash
run: poetry run python -m pip install pip -U

- name: Install python dependencies
run: |
python -m pip install --upgrade poetry
poetry install
poetry install -E "test coverage lint"
- name: Lint with flake8
run: |
poetry run flake8
Expand Down