@@ -38,15 +38,43 @@ jobs:
38
38
- name : Install Poetry
39
39
uses : snok/install-poetry@v1
40
40
41
+ - name : Configure Poetry for CI optimization
42
+ run : |
43
+ poetry config virtualenvs.create false
44
+ poetry config virtualenvs.in-project false
45
+
46
+ - name : Cache Poetry dependencies
47
+ uses : actions/cache@v4
48
+ with :
49
+ path : ~/.cache/pypoetry
50
+ key : poetry-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
51
+ restore-keys : |
52
+ poetry-${{ runner.os }}-
53
+
41
54
- uses : actions/setup-node@v4
42
55
with :
43
56
node-version : 18
44
57
58
+ - name : Cache Nx
59
+ uses : actions/cache@v4
60
+ with :
61
+ path : .nx/cache
62
+ key : nx-${{ runner.os }}-${{ hashFiles('nx.json', 'package-lock.json') }}
63
+ restore-keys : |
64
+ nx-${{ runner.os }}-
65
+
45
66
- uses : nrwl/nx-set-shas@v4
46
67
- run : npm ci
47
68
- run : npx nx affected -t install --with dev
48
69
- run : npx nx affected -t lint --parallel=3
49
70
71
+ - name : Clean up build artifacts
72
+ if : always()
73
+ run : |
74
+ find . -name "*.pyc" -delete
75
+ find . -name "__pycache__" -type d -exec rm -rf {} + || true
76
+ poetry cache clear pypi --all || true
77
+
50
78
build-packages :
51
79
name : Build Packages
52
80
runs-on : ubuntu-latest
@@ -66,10 +94,32 @@ jobs:
66
94
- name : Install Poetry
67
95
uses : snok/install-poetry@v1
68
96
97
+ - name : Configure Poetry for CI optimization
98
+ run : |
99
+ poetry config virtualenvs.create false
100
+ poetry config virtualenvs.in-project false
101
+
102
+ - name : Cache Poetry dependencies
103
+ uses : actions/cache@v4
104
+ with :
105
+ path : ~/.cache/pypoetry
106
+ key : poetry-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }}
107
+ restore-keys : |
108
+ poetry-${{ runner.os }}-${{ matrix.python-version }}-
109
+ poetry-${{ runner.os }}-
110
+
69
111
- uses : actions/setup-node@v4
70
112
with :
71
113
node-version : 18
72
114
115
+ - name : Cache Nx
116
+ uses : actions/cache@v4
117
+ with :
118
+ path : .nx/cache
119
+ key : nx-${{ runner.os }}-${{ hashFiles('nx.json', 'package-lock.json') }}
120
+ restore-keys : |
121
+ nx-${{ runner.os }}-
122
+
73
123
- uses : nrwl/nx-set-shas@v4
74
124
75
125
- run : npm ci
@@ -80,6 +130,13 @@ jobs:
80
130
- name : Build
81
131
run : npx nx affected -t build-release --parallel=3
82
132
133
+ - name : Clean up build artifacts
134
+ if : always()
135
+ run : |
136
+ find . -name "*.pyc" -delete
137
+ find . -name "__pycache__" -type d -exec rm -rf {} + || true
138
+ poetry cache clear pypi --all || true
139
+
83
140
test-packages :
84
141
name : Test Packages
85
142
runs-on : ubuntu-latest
@@ -104,10 +161,40 @@ jobs:
104
161
- name : Install Poetry
105
162
uses : snok/install-poetry@v1
106
163
164
+ - name : Configure Poetry for CI optimization
165
+ run : |
166
+ poetry config virtualenvs.create false
167
+ poetry config virtualenvs.in-project false
168
+
169
+ - name : Cache Poetry dependencies
170
+ uses : actions/cache@v4
171
+ with :
172
+ path : ~/.cache/pypoetry
173
+ key : poetry-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }}
174
+ restore-keys : |
175
+ poetry-${{ runner.os }}-${{ matrix.python-version }}-
176
+ poetry-${{ runner.os }}-
177
+
178
+ - name : Cache pip dependencies
179
+ uses : actions/cache@v4
180
+ with :
181
+ path : ~/.cache/pip
182
+ key : pip-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/pyproject.toml') }}
183
+ restore-keys : |
184
+ pip-${{ runner.os }}-${{ matrix.python-version }}-
185
+
107
186
- uses : actions/setup-node@v4
108
187
with :
109
188
node-version : 18
110
189
190
+ - name : Cache Nx
191
+ uses : actions/cache@v4
192
+ with :
193
+ path : .nx/cache
194
+ key : nx-${{ runner.os }}-${{ hashFiles('nx.json', 'package-lock.json') }}
195
+ restore-keys : |
196
+ nx-${{ runner.os }}-
197
+
111
198
- uses : nrwl/nx-set-shas@v4
112
199
113
200
- run : npm ci
@@ -119,3 +206,10 @@ jobs:
119
206
env :
120
207
HAYSTACK_TELEMETRY_ENABLED : False
121
208
run : npx nx affected -t test --exclude='sample-app' --exclude='opentelemetry-instrumentation-haystack' --parallel=3
209
+
210
+ - name : Clean up build artifacts
211
+ if : always()
212
+ run : |
213
+ find . -name "*.pyc" -delete
214
+ find . -name "__pycache__" -type d -exec rm -rf {} + || true
215
+ poetry cache clear pypi --all || true
0 commit comments