@@ -4,15 +4,59 @@ on: [push, pull_request]
4
4
5
5
jobs :
6
6
build :
7
+ # Don't run twice for internal PRs from our own repo
8
+ if : github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
7
9
8
10
runs-on : ubuntu-latest
9
11
strategy :
10
12
matrix :
11
- python-version : [ '3.x' ]
13
+ python-version : [ '2.7', ' 3.x' ]
12
14
tmux-version : [ '2.6', '2.7', '2.8', '3.0', 'master' ]
13
15
steps :
14
16
- uses : actions/checkout@v1
15
- - name : Cache tmux build ${{ matrix.tmux-version }}
17
+
18
+ - name : Set up Python ${{ matrix.python-version }}
19
+ uses : actions/setup-python@v1
20
+ with :
21
+ python-version : ${{ matrix.python-version }}
22
+
23
+ - name : Get full Python version
24
+ id : full-python-version
25
+ shell : bash
26
+ run : echo ::set-output name=version::$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))")
27
+
28
+ - name : Install poetry
29
+ run : |
30
+ curl -O -sSL https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py
31
+ python get-poetry.py -y
32
+ echo "::set-env name=PATH::$HOME/.poetry/bin:$PATH"
33
+ rm get-poetry.py
34
+
35
+ - name : Get poetry cache paths from config
36
+ run : |
37
+ echo ::set-env name=poetry_cache_dir::$(poetry config --list | sed -n 's/.*cache-dir = //p' | sed -e 's/^"//' -e 's/"$//')
38
+ echo ::set-env name=poetry_virtualenvs_path::$(poetry config --list | sed -n 's/.*virtualenvs.path = .* # //p' | sed -e 's/^"//' -e 's/"$//')
39
+
40
+ - name : Configure poetry
41
+ shell : bash
42
+ run : poetry config virtualenvs.in-project true
43
+
44
+ - name : Set up poetry cache
45
+ uses : actions/cache@v2
46
+ id : cache
47
+ with :
48
+ path : |
49
+ .venv
50
+ {{ env.poetry_cache_dir }}
51
+ {{ env.poetry_virtualenvs_path }}
52
+ key : venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/poetry.lock') }}
53
+
54
+ - name : Ensure cache is healthy
55
+ if : steps.cache.outputs.cache-hit == 'true'
56
+ shell : bash
57
+ run : poetry run pip --version >/dev/null 2>&1 || rm -rf .venv
58
+
59
+ - name : Setup tmux build cache for tmux ${{ matrix.tmux-version }}
16
60
id : tmux-build-cache
17
61
uses : actions/cache@v1
18
62
with :
@@ -33,18 +77,14 @@ jobs:
33
77
export PATH=$HOME/tmux-builds/tmux-${{ matrix.tmux-version }}/bin:$PATH
34
78
cd ~
35
79
tmux -V
36
- - name : Configure git
37
- run : |
38
- git config --global user.name 'travis-ci'
39
- git config --global user.email '[email protected] '
40
- - name : Set up Python ${{ matrix.python-version }}
41
- uses : actions/setup-python@v1
42
- with :
43
- python-version : ${{ matrix.python-version }}
80
+
81
+ - name : Upgrade pip
82
+ shell : bash
83
+ run : poetry run python -m pip install pip -U
84
+
44
85
- name : Install python dependencies
45
86
run : |
46
- python -m pip install --upgrade poetry
47
- poetry install
87
+ poetry install -E "test coverage lint"
48
88
- name : Lint with flake8
49
89
run : |
50
90
poetry run flake8
0 commit comments