From 02aec8028d4119ad81960690c91963f6180ed8a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9rome=20Eertmans?= Date: Fri, 18 Oct 2024 11:34:12 +0200 Subject: [PATCH] chore(ci): change build logic --- .github/workflows/test.yml | 34 +++++++++++++--------------------- justfile | 9 +++++++-- 2 files changed, 20 insertions(+), 23 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d03bfd7a..02d57501 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -48,6 +48,8 @@ jobs: - name: Install dependencies run: uv sync --locked --no-dev --extra tests + env: + RUSTFLAGS: -C=instrument-coverage - name: Run tests run: uv run pytest @@ -119,14 +121,10 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - id: setup-python - with: - cache: pip - cache-dependency-path: uv.lock - - name: Setup uv uses: astral-sh/setup-uv@v3 + with: + enable-cache: true - name: Install Rust uses: dtolnay/rust-toolchain@stable @@ -136,14 +134,11 @@ jobs: - name: Cache Rust uses: Swatinem/rust-cache@v2 - - name: Install dependencies - run: uv pip install -r pyproject.toml --extra tests --python '${{ steps.setup-python.outputs.python-path }}' + - name: Install Just + uses: taiki-e/install-action@just - - name: Build differt-core for profiling - run: | - rm -f python/differt_core/*.so - pip install -v -e . --config-settings=build-args='--profile profiling' - working-directory: differt-core + - name: Install dependencies for profiling + run: just install-profiling --locked --no-dev --extra tests --python '${{ steps.setup-python.outputs.python-path }}' env: RUSTFLAGS: -Cprofile-generate=${{ github.workspace }}/profdata @@ -157,11 +152,8 @@ jobs: - name: Merge PGO data run: rustup run stable bash -c '$RUSTUP_HOME/toolchains/$RUSTUP_TOOLCHAIN/lib/rustlib/${{ env.RUST_HOST }}/bin/llvm-profdata merge -o ${{ github.workspace }}/merged.profdata ${{ github.workspace }}/profdata' - - name: Build differt-core for benchmarking - run: | - rm -f python/differt_core/*.so - pip install -v -e . --config-settings=build-args='--profile profiling' - working-directory: differt-core + - name: Re-install dependencies + run: just install-profiling --locked --no-dev --extra tests --python '${{ steps.setup-python.outputs.python-path }}' env: RUSTFLAGS: -Cprofile-use=${{ github.workspace }}/merged.profdata @@ -207,11 +199,11 @@ jobs: with: enable-cache: true - - name: Install dependencies - run: uv sync --locked --no-dev --extra docs - - name: Install Just uses: taiki-e/install-action@just + - name: Install dependencies + run: just install --locked --no-dev --extra docs + - name: Check links in documentation run: just docs/linkcheck diff --git a/justfile b/justfile index 80a6ed90..661754fb 100644 --- a/justfile +++ b/justfile @@ -54,8 +54,13 @@ devices: # Build and install Python packages [group: 'dev'] -install: - uv sync +install *ARGS: + uv sync {{ARGS}} + +# Build and install Python package(s) using 'profiling' profile +[group: 'dev'] +install-profiling *ARGS: + uv sync --config-settings=build-args='--profile profiling' --reinstall-package differt_core {{ARGS}} # Run code linters and formatters [group: 'dev']