-
Notifications
You must be signed in to change notification settings - Fork 6
65 lines (53 loc) · 2.35 KB
/
push-github-action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
name: push-github-action
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
# All available versions of Python:
# https://github.com/actions/python-versions/blob/main/versions-manifest.json
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13.0-alpha.5"]
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Display Python version
run: python -c "import sys; print(sys.version)"
- name: Display pip version
run: python -m pip --version
- name: Get pip version
id: pip-version
run: echo "PIP_VERSION=$(python -m pip --version | cut -f 2 -d ' ')" >> $GITHUB_OUTPUT
- name: Install Poetry
run: pipx install "poetry>=1.4.0,<1.5.0"
- name: Display Poetry version
run: poetry --version
- name: Get Poetry version
id: poetry-version
run: echo "POETRY_VERSION=$(poetry --version | cut -f 3- -d ' ')" >> $GITHUB_OUTPUT
# NOTE: Necessary to cache pip files because the cached pypoetry
# virtualenv does depend on them.
- name: Cache pip files
id: cache-pip
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: pip--os-${{ runner.os }}-python-${{ matrix.python-version }}-pip-${{ steps.pip-version.outputs.PIP_VERSION }}-poetry-${{ steps.poetry-version.outputs.POETRY_VERSION }}-lock-${{ hashFiles('poetry.lock') }}
- name: Cache installed dependencies
id: cache-pypoetry
uses: actions/cache@v3
with:
path: ~/.cache/pypoetry/virtualenvs
key: pypoetry--os-${{ runner.os }}-python-${{ matrix.python-version }}-pip-${{ steps.pip-version.outputs.PIP_VERSION }}-poetry-${{ steps.poetry-version.outputs.POETRY_VERSION }}-lock-${{ hashFiles('poetry.lock') }}
- name: Install dependencies with Poetry
if: ${{ (steps.cache-pip.outputs.cache-hit != 'true') || (steps.cache-pypoetry.outputs.cache-hit != 'true') }}
run: poetry install
- name: Lint
run: poetry run make lint
- name: Run tests
# Run tox using the version of Python in `PATH`
run: poetry run tox -e py