From 266a65aeca36ed34adb5c3849ae5c576b3a6e2cb Mon Sep 17 00:00:00 2001 From: Gal Kleinman Date: Sun, 17 Aug 2025 19:42:30 +0300 Subject: [PATCH 1/3] chore(ci): reduce disk space usage --- .github/workflows/ci.yml | 94 +++++++++++++++++++++++++++++++++++ .github/workflows/release.yml | 56 +++++++++++++++++++++ 2 files changed, 150 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d4fb3ba005..fdda09e00c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -38,15 +38,43 @@ jobs: - name: Install Poetry uses: snok/install-poetry@v1 + - name: Configure Poetry for CI optimization + run: | + poetry config virtualenvs.create false + poetry config virtualenvs.in-project false + + - name: Cache Poetry dependencies + uses: actions/cache@v4 + with: + path: ~/.cache/pypoetry + key: poetry-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }} + restore-keys: | + poetry-${{ runner.os }}- + - uses: actions/setup-node@v4 with: node-version: 18 + - name: Cache Nx + uses: actions/cache@v4 + with: + path: .nx/cache + key: nx-${{ runner.os }}-${{ hashFiles('nx.json', 'package-lock.json') }} + restore-keys: | + nx-${{ runner.os }}- + - uses: nrwl/nx-set-shas@v4 - run: npm ci - run: npx nx affected -t install --with dev - run: npx nx affected -t lint --parallel=3 + - name: Clean up build artifacts + if: always() + run: | + find . -name "*.pyc" -delete + find . -name "__pycache__" -type d -exec rm -rf {} + || true + poetry cache clear pypi --all || true + build-packages: name: Build Packages runs-on: ubuntu-latest @@ -66,10 +94,32 @@ jobs: - name: Install Poetry uses: snok/install-poetry@v1 + - name: Configure Poetry for CI optimization + run: | + poetry config virtualenvs.create false + poetry config virtualenvs.in-project false + + - name: Cache Poetry dependencies + uses: actions/cache@v4 + with: + path: ~/.cache/pypoetry + key: poetry-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }} + restore-keys: | + poetry-${{ runner.os }}-${{ matrix.python-version }}- + poetry-${{ runner.os }}- + - uses: actions/setup-node@v4 with: node-version: 18 + - name: Cache Nx + uses: actions/cache@v4 + with: + path: .nx/cache + key: nx-${{ runner.os }}-${{ hashFiles('nx.json', 'package-lock.json') }} + restore-keys: | + nx-${{ runner.os }}- + - uses: nrwl/nx-set-shas@v4 - run: npm ci @@ -80,6 +130,13 @@ jobs: - name: Build run: npx nx affected -t build-release --parallel=3 + - name: Clean up build artifacts + if: always() + run: | + find . -name "*.pyc" -delete + find . -name "__pycache__" -type d -exec rm -rf {} + || true + poetry cache clear pypi --all || true + test-packages: name: Test Packages runs-on: ubuntu-latest @@ -104,10 +161,40 @@ jobs: - name: Install Poetry uses: snok/install-poetry@v1 + - name: Configure Poetry for CI optimization + run: | + poetry config virtualenvs.create false + poetry config virtualenvs.in-project false + + - name: Cache Poetry dependencies + uses: actions/cache@v4 + with: + path: ~/.cache/pypoetry + key: poetry-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }} + restore-keys: | + poetry-${{ runner.os }}-${{ matrix.python-version }}- + poetry-${{ runner.os }}- + + - name: Cache pip dependencies + uses: actions/cache@v4 + with: + path: ~/.cache/pip + key: pip-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/pyproject.toml') }} + restore-keys: | + pip-${{ runner.os }}-${{ matrix.python-version }}- + - uses: actions/setup-node@v4 with: node-version: 18 + - name: Cache Nx + uses: actions/cache@v4 + with: + path: .nx/cache + key: nx-${{ runner.os }}-${{ hashFiles('nx.json', 'package-lock.json') }} + restore-keys: | + nx-${{ runner.os }}- + - uses: nrwl/nx-set-shas@v4 - run: npm ci @@ -119,3 +206,10 @@ jobs: env: HAYSTACK_TELEMETRY_ENABLED: False run: npx nx affected -t test --exclude='sample-app' --exclude='opentelemetry-instrumentation-haystack' --parallel=3 + + - name: Clean up build artifacts + if: always() + run: | + find . -name "*.pyc" -delete + find . -name "__pycache__" -type d -exec rm -rf {} + || true + poetry cache clear pypi --all || true diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 336ca6c132..15c5754b38 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -63,15 +63,43 @@ jobs: - name: Install Poetry uses: snok/install-poetry@v1 + - name: Configure Poetry for CI optimization + run: | + poetry config virtualenvs.create false + poetry config virtualenvs.in-project false + + - name: Cache Poetry dependencies + uses: actions/cache@v4 + with: + path: ~/.cache/pypoetry + key: poetry-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }} + restore-keys: | + poetry-${{ runner.os }}- + - uses: actions/setup-node@v4 with: node-version: 18 + - name: Cache Nx + uses: actions/cache@v4 + with: + path: .nx/cache + key: nx-${{ runner.os }}-${{ hashFiles('nx.json', 'package-lock.json') }} + restore-keys: | + nx-${{ runner.os }}- + - run: npm ci - name: Build Instrumentations run: npx nx run-many -t build-release --projects=tag:instrumentation + - name: Clean up build artifacts + if: always() + run: | + find . -name "*.pyc" -delete + find . -name "__pycache__" -type d -exec rm -rf {} + || true + poetry cache clear pypi --all || true + - run: mkdir instrumentations-dist - run: cp packages/opentelemetry-instrumentation-*/dist/* instrumentations-dist @@ -101,15 +129,43 @@ jobs: - name: Install Poetry uses: snok/install-poetry@v1 + - name: Configure Poetry for CI optimization + run: | + poetry config virtualenvs.create false + poetry config virtualenvs.in-project false + + - name: Cache Poetry dependencies + uses: actions/cache@v4 + with: + path: ~/.cache/pypoetry + key: poetry-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }} + restore-keys: | + poetry-${{ runner.os }}- + - uses: actions/setup-node@v4 with: node-version: 18 + - name: Cache Nx + uses: actions/cache@v4 + with: + path: .nx/cache + key: nx-${{ runner.os }}-${{ hashFiles('nx.json', 'package-lock.json') }} + restore-keys: | + nx-${{ runner.os }}- + - run: npm ci - name: Build Traceloop SDK run: npx nx run traceloop-sdk:build-release + - name: Clean up build artifacts + if: always() + run: | + find . -name "*.pyc" -delete + find . -name "__pycache__" -type d -exec rm -rf {} + || true + poetry cache clear pypi --all || true + - name: Publish release distributions to PyPI uses: pypa/gh-action-pypi-publish@release/v1 with: From f4532ede70a735ede5e1d26760882dab74e796f4 Mon Sep 17 00:00:00 2001 From: Gal Kleinman Date: Sun, 17 Aug 2025 19:50:50 +0300 Subject: [PATCH 2/3] remove if always --- .github/workflows/ci.yml | 3 --- .github/workflows/release.yml | 2 -- 2 files changed, 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fdda09e00c..31f6e044f1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -69,7 +69,6 @@ jobs: - run: npx nx affected -t lint --parallel=3 - name: Clean up build artifacts - if: always() run: | find . -name "*.pyc" -delete find . -name "__pycache__" -type d -exec rm -rf {} + || true @@ -131,7 +130,6 @@ jobs: run: npx nx affected -t build-release --parallel=3 - name: Clean up build artifacts - if: always() run: | find . -name "*.pyc" -delete find . -name "__pycache__" -type d -exec rm -rf {} + || true @@ -208,7 +206,6 @@ jobs: run: npx nx affected -t test --exclude='sample-app' --exclude='opentelemetry-instrumentation-haystack' --parallel=3 - name: Clean up build artifacts - if: always() run: | find . -name "*.pyc" -delete find . -name "__pycache__" -type d -exec rm -rf {} + || true diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 15c5754b38..e7884d86bc 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -94,7 +94,6 @@ jobs: run: npx nx run-many -t build-release --projects=tag:instrumentation - name: Clean up build artifacts - if: always() run: | find . -name "*.pyc" -delete find . -name "__pycache__" -type d -exec rm -rf {} + || true @@ -160,7 +159,6 @@ jobs: run: npx nx run traceloop-sdk:build-release - name: Clean up build artifacts - if: always() run: | find . -name "*.pyc" -delete find . -name "__pycache__" -type d -exec rm -rf {} + || true From b274fc0d461f0cd55db0866da92329325f693e11 Mon Sep 17 00:00:00 2001 From: Gal Kleinman Date: Sun, 17 Aug 2025 19:53:35 +0300 Subject: [PATCH 3/3] remove cache clear --- .github/workflows/ci.yml | 3 --- .github/workflows/release.yml | 2 -- 2 files changed, 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 31f6e044f1..8f4378bf4e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -72,7 +72,6 @@ jobs: run: | find . -name "*.pyc" -delete find . -name "__pycache__" -type d -exec rm -rf {} + || true - poetry cache clear pypi --all || true build-packages: name: Build Packages @@ -133,7 +132,6 @@ jobs: run: | find . -name "*.pyc" -delete find . -name "__pycache__" -type d -exec rm -rf {} + || true - poetry cache clear pypi --all || true test-packages: name: Test Packages @@ -209,4 +207,3 @@ jobs: run: | find . -name "*.pyc" -delete find . -name "__pycache__" -type d -exec rm -rf {} + || true - poetry cache clear pypi --all || true diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e7884d86bc..8506782d0b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -97,7 +97,6 @@ jobs: run: | find . -name "*.pyc" -delete find . -name "__pycache__" -type d -exec rm -rf {} + || true - poetry cache clear pypi --all || true - run: mkdir instrumentations-dist - run: cp packages/opentelemetry-instrumentation-*/dist/* instrumentations-dist @@ -162,7 +161,6 @@ jobs: run: | find . -name "*.pyc" -delete find . -name "__pycache__" -type d -exec rm -rf {} + || true - poetry cache clear pypi --all || true - name: Publish release distributions to PyPI uses: pypa/gh-action-pypi-publish@release/v1