-
Notifications
You must be signed in to change notification settings - Fork 0
81 lines (71 loc) · 2.56 KB
/
bootstrap-python.yml
File metadata and controls
81 lines (71 loc) · 2.56 KB
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
name: Bootstrap Python Environment
on:
workflow_call:
inputs:
runner-label:
type: string
required: false
default: ubuntu-latest
python-version:
type: string
required: false
default: "3.10"
install-args:
type: string
required: false
default: "--with dev --no-interaction"
artifact-name:
type: string
required: false
default: bootstrap
secrets:
POETRY_HTTP_BASIC_USERNAME:
required: false
POETRY_HTTP_BASIC_PASSWORD:
required: false
jobs:
bootstrap:
name: Bootstrap (Python ${{ inputs.python-version }})
runs-on: ${{ inputs.runner-label }}
env:
PYTHONUNBUFFERED: "1"
PIP_DISABLE_PIP_VERSION_CHECK: "1"
POETRY_VIRTUALENVS_IN_PROJECT: "true"
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python-version }}
- name: Upgrade pip
run: python -m pip install --upgrade pip
- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: "1.8.3"
virtualenvs-in-project: true
virtualenvs-create: true
- name: Configure Poetry
run: |
poetry config virtualenvs.in-project true
poetry config virtualenvs.path .venv
- name: Install dependencies
run: |
set -euo pipefail
poetry install ${{ inputs.install-args }} || {
echo "Primary Poetry install failed; retrying without cache";
poetry install ${{ inputs.install-args }} --no-cache;
}
- name: Validate virtual environment
run: |
test -d .venv || { echo "Virtualenv missing"; exit 1; }
.venv/bin/python -V
- name: Package virtual environment artifact
run: tar -czf venv.tar.gz .venv
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.artifact-name }}
path: venv.tar.gz
retention-days: 3