Skip to content

Commit 266a65a

Browse files
committed
chore(ci): reduce disk space usage
1 parent 9668097 commit 266a65a

File tree

2 files changed

+150
-0
lines changed

2 files changed

+150
-0
lines changed

.github/workflows/ci.yml

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,43 @@ jobs:
3838
- name: Install Poetry
3939
uses: snok/install-poetry@v1
4040

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+
4154
- uses: actions/setup-node@v4
4255
with:
4356
node-version: 18
4457

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+
4566
- uses: nrwl/nx-set-shas@v4
4667
- run: npm ci
4768
- run: npx nx affected -t install --with dev
4869
- run: npx nx affected -t lint --parallel=3
4970

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+
5078
build-packages:
5179
name: Build Packages
5280
runs-on: ubuntu-latest
@@ -66,10 +94,32 @@ jobs:
6694
- name: Install Poetry
6795
uses: snok/install-poetry@v1
6896

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+
69111
- uses: actions/setup-node@v4
70112
with:
71113
node-version: 18
72114

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+
73123
- uses: nrwl/nx-set-shas@v4
74124

75125
- run: npm ci
@@ -80,6 +130,13 @@ jobs:
80130
- name: Build
81131
run: npx nx affected -t build-release --parallel=3
82132

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+
83140
test-packages:
84141
name: Test Packages
85142
runs-on: ubuntu-latest
@@ -104,10 +161,40 @@ jobs:
104161
- name: Install Poetry
105162
uses: snok/install-poetry@v1
106163

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+
107186
- uses: actions/setup-node@v4
108187
with:
109188
node-version: 18
110189

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+
111198
- uses: nrwl/nx-set-shas@v4
112199

113200
- run: npm ci
@@ -119,3 +206,10 @@ jobs:
119206
env:
120207
HAYSTACK_TELEMETRY_ENABLED: False
121208
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

.github/workflows/release.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,43 @@ jobs:
6363
- name: Install Poetry
6464
uses: snok/install-poetry@v1
6565

66+
- name: Configure Poetry for CI optimization
67+
run: |
68+
poetry config virtualenvs.create false
69+
poetry config virtualenvs.in-project false
70+
71+
- name: Cache Poetry dependencies
72+
uses: actions/cache@v4
73+
with:
74+
path: ~/.cache/pypoetry
75+
key: poetry-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
76+
restore-keys: |
77+
poetry-${{ runner.os }}-
78+
6679
- uses: actions/setup-node@v4
6780
with:
6881
node-version: 18
6982

83+
- name: Cache Nx
84+
uses: actions/cache@v4
85+
with:
86+
path: .nx/cache
87+
key: nx-${{ runner.os }}-${{ hashFiles('nx.json', 'package-lock.json') }}
88+
restore-keys: |
89+
nx-${{ runner.os }}-
90+
7091
- run: npm ci
7192

7293
- name: Build Instrumentations
7394
run: npx nx run-many -t build-release --projects=tag:instrumentation
7495

96+
- name: Clean up build artifacts
97+
if: always()
98+
run: |
99+
find . -name "*.pyc" -delete
100+
find . -name "__pycache__" -type d -exec rm -rf {} + || true
101+
poetry cache clear pypi --all || true
102+
75103
- run: mkdir instrumentations-dist
76104
- run: cp packages/opentelemetry-instrumentation-*/dist/* instrumentations-dist
77105

@@ -101,15 +129,43 @@ jobs:
101129
- name: Install Poetry
102130
uses: snok/install-poetry@v1
103131

132+
- name: Configure Poetry for CI optimization
133+
run: |
134+
poetry config virtualenvs.create false
135+
poetry config virtualenvs.in-project false
136+
137+
- name: Cache Poetry dependencies
138+
uses: actions/cache@v4
139+
with:
140+
path: ~/.cache/pypoetry
141+
key: poetry-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
142+
restore-keys: |
143+
poetry-${{ runner.os }}-
144+
104145
- uses: actions/setup-node@v4
105146
with:
106147
node-version: 18
107148

149+
- name: Cache Nx
150+
uses: actions/cache@v4
151+
with:
152+
path: .nx/cache
153+
key: nx-${{ runner.os }}-${{ hashFiles('nx.json', 'package-lock.json') }}
154+
restore-keys: |
155+
nx-${{ runner.os }}-
156+
108157
- run: npm ci
109158

110159
- name: Build Traceloop SDK
111160
run: npx nx run traceloop-sdk:build-release
112161

162+
- name: Clean up build artifacts
163+
if: always()
164+
run: |
165+
find . -name "*.pyc" -delete
166+
find . -name "__pycache__" -type d -exec rm -rf {} + || true
167+
poetry cache clear pypi --all || true
168+
113169
- name: Publish release distributions to PyPI
114170
uses: pypa/gh-action-pypi-publish@release/v1
115171
with:

0 commit comments

Comments
 (0)