diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d4fb3ba005..8f4378bf4e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -38,15 +38,41 @@ 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 + run: | + find . -name "*.pyc" -delete + find . -name "__pycache__" -type d -exec rm -rf {} + || true + build-packages: name: Build Packages runs-on: ubuntu-latest @@ -66,10 +92,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 +128,11 @@ jobs: - name: Build run: npx nx affected -t build-release --parallel=3 + - name: Clean up build artifacts + run: | + find . -name "*.pyc" -delete + find . -name "__pycache__" -type d -exec rm -rf {} + || true + test-packages: name: Test Packages runs-on: ubuntu-latest @@ -104,10 +157,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 +202,8 @@ 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 + 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 336ca6c132..8506782d0b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -63,15 +63,41 @@ 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 + run: | + find . -name "*.pyc" -delete + find . -name "__pycache__" -type d -exec rm -rf {} + || true + - run: mkdir instrumentations-dist - run: cp packages/opentelemetry-instrumentation-*/dist/* instrumentations-dist @@ -101,15 +127,41 @@ 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 + run: | + find . -name "*.pyc" -delete + find . -name "__pycache__" -type d -exec rm -rf {} + || true + - name: Publish release distributions to PyPI uses: pypa/gh-action-pypi-publish@release/v1 with: