-
Notifications
You must be signed in to change notification settings - Fork 11
99 lines (84 loc) · 2.79 KB
/
build.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
name: Build the package
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
build:
name: Build
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
python-version: ["3.9"]
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- name: Check out the repository
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Setup Python Environment
uses: ./.github/actions/setup-environment
id: environment
- name: Display python user base and pipx home
run: |
echo "Python user base: ${{ steps.environment.outputs.python-user-base }}"
echo "Pipx home: ${{ steps.environment.outputs.pipx-home }}"
- name: Get pipx and poetry latest versions
id: latest-versions
shell: bash
run: |
pipx_version=$(curl -s https://pypi.org/pypi/pipx/json | jq -r .info.version)
poetry_version=$(curl -s https://pypi.org/pypi/poetry/json | jq -r .info.version)
echo "pipx=$pipx_version" >> $GITHUB_OUTPUT
echo "poetry=$poetry_version" >> $GITHUB_OUTPUT
- uses: actions/cache@v4
name: Cache pipx
with:
path: ${{ steps.environment.outputs.python-user-base }}
key: >
${{ format('pip-{0}-{1}-{2}',
matrix.os,
matrix.python-version,
steps.latest-versions.outputs.pipx
) }}
- uses: actions/cache@v4
name: Cache Poetry
with:
path: ${{ steps.environment.outputs.pipx-home }}
key: >
${{ format('pipx-{0}-{1}-{2}',
matrix.os,
matrix.python-version,
steps.latest-versions.outputs.poetry
) }}
- name: Install pipx
run: pip install --user pipx
- name: Install or update Poetry
run: |
pipx install poetry==${{ steps.latest-versions.outputs.poetry }}
pipx list
- name: Use local virtual environment
run: |
poetry config virtualenvs.create true --local
poetry config virtualenvs.in-project true --local
- uses: actions/cache@v4
id: cache-poetry-deps
name: Cache Poetry dependencies
with:
path: ./.venv
key: venv-${{ matrix.os }}-${{ matrix.python-version }}-${{ hashFiles('poetry.lock') }}
restore-keys: |
venv-${{ matrix.os }}-${{ matrix.python-version }}-
- name: Install dependencies with Poetry
run: |
poetry env use python3
poetry install
- name: Check if package builds
run: |
poetry build