- 
                Notifications
    You must be signed in to change notification settings 
- Fork 8
feat: git source test #56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
          
     Merged
      
      
            remimimimimi
  merged 20 commits into
  prefix-dev:main
from
remimimimimi:feat/git-source-test
  
      
      
   
  Oct 30, 2025 
      
    
  
     Merged
                    Changes from all commits
      Commits
    
    
            Show all changes
          
          
            20 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      bbde316
              
                feat: git source test
              
              
                remimimimimi 78b798d
              
                chore: add .env.ci
              
              
                remimimimimi f90f66b
              
                fix: update lockfiles
              
              
                remimimimimi eb3946f
              
                Revert "chore: add .env.ci"
              
              
                remimimimimi 7fa6067
              
                chore: pin source to specific revision
              
              
                remimimimimi 3aff63d
              
                chore: add .env.ci
              
              
                remimimimimi 609c731
              
                chore: bump lockfiles
              
              
                remimimimimi 66c3f70
              
                Revert "fix: update lockfiles"
              
              
                remimimimimi 3b0b58d
              
                Revert "chore: bump lockfiles"
              
              
                remimimimimi b67c023
              
                Revert "chore: add .env.ci"
              
              
                remimimimimi 8e674fe
              
                Add more tests
              
              
                remimimimimi 853e3ee
              
                Add even more tests
              
              
                remimimimimi b9568bc
              
                Add .env.ci
              
              
                remimimimimi f522682
              
                test that pixi build is a teenager
              
              
                remimimimimi 1df4818
              
                Merge remote-tracking branch 'upstream/main' into feat/git-source-test
              
              
                remimimimimi 3ea4be6
              
                Merge branch 'main' into feat/git-source-test
              
              
                remimimimimi e44b98b
              
                Yoooo
              
              
                remimimimimi 1e9f9f7
              
                Use faster example
              
              
                Hofer-Julian 4be3d4e
              
                Reorganize tests
              
              
                Hofer-Julian 906f645
              
                Remove .env.ci
              
              
                Hofer-Julian File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| # pixi environments | ||
| .pixi | ||
|  | ||
| # The build directory | ||
| .build | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| # Simple C++ SDL Example with specified source path | ||
|  | ||
| This is a simple pixi demo that showcases how to use C++ and SDL with specified source path. | ||
|  | ||
| ## How to use? | ||
|  | ||
| Make sure you have `pixi` available in your terminal. | ||
| Navigate to this directory and run: | ||
|  | ||
| ```shell | ||
|  | ||
| # Start the build executable | ||
| pixi run start | ||
| ``` | 
        
          
          
            1,291 changes: 1,291 additions & 0 deletions
          
          1,291 
        
  tests/data/pixi_build/cpp-with-git-source/pixi.lock
  
  
      
      
   
        
      
      
    Large diffs are not rendered by default.
      
      Oops, something went wrong.
      
    
  
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| [workspace] | ||
| channels = ["https://prefix.dev/conda-forge"] | ||
| platforms = ["win-64", "linux-64", "osx-64", "osx-arm64"] | ||
| preview = ["pixi-build"] | ||
|  | ||
| [dependencies] | ||
| # Define a dependency on ourselves. This will invoke the build backend to build | ||
| # the C++ code and install the executable in an environment ready to be used. | ||
| sdl_example = { path = "." } | ||
|  | ||
| [tasks.start] | ||
| cmd = "sdl_example" | ||
| description = "A tasks to run the executable that is build by the package section." | ||
|  | ||
| [tasks] | ||
| test = "sdl_example -h" | ||
|  | ||
| [package] | ||
| authors = ["Bas Zalmstra <[email protected]>"] | ||
| description = "Showcases how to create a simple C++ executable with Pixi" | ||
| name = "sdl_example" | ||
| version = "0.1.0" | ||
|  | ||
| [package.build.source] | ||
| branch = "main" | ||
| git = "https://github.com/prefix-dev/pixi-build-testsuite.git" | ||
| subdirectory = "tests/data/pixi_build/cpp-with-path-to-source/project" | ||
|  | ||
| [package.build.backend] | ||
| channels = [ | ||
| "https://prefix.dev/pixi-build-backends", | ||
| "https://prefix.dev/conda-forge", | ||
| ] | ||
| name = "pixi-build-cmake" | ||
| version = "*" | ||
|  | ||
| [package.host-dependencies] | ||
| # This ensures that SDL2 is available at build time. | ||
| sdl2 = ">=2.26.5,<3.0" | ||
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
              Empty file.
          
    
        
          
          
            90 changes: 90 additions & 0 deletions
          
          90 
        
  tests/integration_python/test_specified_build_source/conftest.py
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,90 @@ | ||
| import subprocess | ||
| from dataclasses import dataclass | ||
| from pathlib import Path | ||
|  | ||
| import pytest | ||
|  | ||
| from ..common import copytree_with_local_backend | ||
|  | ||
|  | ||
| @dataclass(frozen=True) | ||
| class LocalGitRepo: | ||
| path: Path | ||
| main_rev: str | ||
| other_feature_rev: str | ||
| tag: str | ||
|  | ||
|  | ||
| @pytest.fixture | ||
| def local_cpp_git_repo( | ||
| pixi: Path, | ||
| build_data: Path, | ||
| tmp_path_factory: pytest.TempPathFactory, | ||
| ) -> LocalGitRepo: | ||
| """ | ||
| Create a local git repository mirroring the minimal pixi-build-cmake workspace so tests can | ||
| exercise git sources without touching the network. | ||
| """ | ||
|  | ||
| source_root = build_data.joinpath("minimal-backend-workspaces", "pixi-build-cmake") | ||
| repo_root = tmp_path_factory.mktemp("git-repo") | ||
| repo_path = repo_root.joinpath("repo") | ||
| copytree_with_local_backend(source_root, repo_path) | ||
|  | ||
| marker = repo_path.joinpath("src", "LOCAL_MARKER.txt") | ||
| marker.write_text("local git fixture marker\n", encoding="utf-8") | ||
|  | ||
| main_source_path = repo_path.joinpath("src", "main.cpp") | ||
| original_source = main_source_path.read_text(encoding="utf-8") | ||
|  | ||
| def run_git(*args: str) -> str: | ||
| result = subprocess.run( | ||
| [str(pixi), "run", "git", *args], | ||
| cwd=repo_path, | ||
| capture_output=True, | ||
| text=True, | ||
| ) | ||
| if result.returncode != 0: | ||
| raise RuntimeError( | ||
| "git command failed ({}):\nstdout: {}\nstderr: {}".format( | ||
| " ".join(args), result.stdout, result.stderr | ||
| ) | ||
| ) | ||
| return result.stdout.strip() | ||
|  | ||
| run_git("init", "-b", "main") | ||
| run_git("config", "user.email", "[email protected]") | ||
| run_git("config", "user.name", "Pixi Build Tests") | ||
| run_git("add", ".") | ||
| run_git("commit", "-m", "Initial commit") | ||
|  | ||
| run_git("checkout", "-b", "other-feature") | ||
| feature_text = original_source.replace( | ||
| "Build backend works", "Build backend works from other-feature branch" | ||
| ) | ||
| if feature_text == original_source: | ||
| feature_text = original_source + "\n// other-feature branch tweak\n" | ||
| main_source_path.write_text(feature_text) | ||
| run_git("add", main_source_path.relative_to(repo_path).as_posix()) | ||
| run_git("commit", "-m", "Add branch change") | ||
| other_feature_rev = run_git("rev-parse", "HEAD") | ||
|  | ||
| run_git("checkout", "main") | ||
| main_update_text = original_source.replace( | ||
| "Build backend works", "Build backend works on main branch" | ||
| ) | ||
| if main_update_text == original_source: | ||
| main_update_text = original_source + "\n// main branch tweak\n" | ||
| main_source_path.write_text(main_update_text) | ||
| run_git("add", main_source_path.relative_to(repo_path).as_posix()) | ||
| run_git("commit", "-m", "Update main") | ||
| main_rev = run_git("rev-parse", "HEAD") | ||
|  | ||
| run_git("tag", "fixture-v1") | ||
|  | ||
| return LocalGitRepo( | ||
| path=repo_path, | ||
| main_rev=main_rev, | ||
| other_feature_rev=other_feature_rev, | ||
| tag="fixture-v1", | ||
| ) | 
      
      Oops, something went wrong.
        
    
  
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Uh oh!
There was an error while loading. Please reload this page.