|
| 1 | +# Pull Request Conflict Resolution Guide |
| 2 | + |
| 3 | +This document provides step-by-step instructions to resolve merge conflicts in PRs #2, #3, and #4. |
| 4 | + |
| 5 | +## Root Cause |
| 6 | + |
| 7 | +The base branch `ci/add-github-workflows` split the single `ci.yml` workflow into three separate workflow files: |
| 8 | +- `.github/workflows/lint.yml` (Ruff linting) |
| 9 | +- `.github/workflows/typecheck.yml` (Mypy type checking) |
| 10 | +- `.github/workflows/tests.yml` (Pytest tests) |
| 11 | + |
| 12 | +PRs #2, #3, and #4 all modify the original `ci.yml` file, which no longer exists in the base branch, causing merge conflicts. |
| 13 | + |
| 14 | +## PR #2: Improve CI workflow with dependency caching and Python version matrix |
| 15 | + |
| 16 | +**Changes to Apply:** |
| 17 | +- Add `permissions: contents: read` to all three workflow files |
| 18 | +- Add `enable-cache: true` to uv setup in all three workflows |
| 19 | +- Add Python version matrix (`["3.12", "3.13"]`) to tests.yml |
| 20 | +- Update test job name to include Python version: `Pytest - Python ${{ matrix.python-version }}` |
| 21 | +- Update Python installation in tests.yml to use matrix variable: `uv python install ${{ matrix.python-version }}` |
| 22 | + |
| 23 | +### Resolution Steps: |
| 24 | + |
| 25 | +1. Checkout the branch: |
| 26 | + ```bash |
| 27 | + git checkout copilot/sub-pr-1 |
| 28 | + git merge ci/add-github-workflows |
| 29 | + ``` |
| 30 | + |
| 31 | +2. Remove the conflicted ci.yml: |
| 32 | + ```bash |
| 33 | + git rm .github/workflows/ci.yml |
| 34 | + ``` |
| 35 | + |
| 36 | +3. Apply the improvements to each new workflow file: |
| 37 | + |
| 38 | + **lint.yml:** |
| 39 | + - Add `permissions: contents: read` after the `on:` section |
| 40 | + - Add `enable-cache: true` to the uv setup step |
| 41 | + |
| 42 | + **typecheck.yml:** |
| 43 | + - Add `permissions: contents: read` after the `on:` section |
| 44 | + - Add `enable-cache: true` to the uv setup step |
| 45 | + |
| 46 | + **tests.yml:** |
| 47 | + - Add `permissions: contents: read` after the `on:` section |
| 48 | + - Add `enable-cache: true` to the uv setup step |
| 49 | + - Add matrix strategy with Python 3.12 and 3.13 |
| 50 | + - Update job name to include version |
| 51 | + - Use matrix Python version in setup step |
| 52 | + |
| 53 | +4. Commit and push: |
| 54 | + ```bash |
| 55 | + git add . |
| 56 | + git commit -m "Resolve merge conflict: Apply PR #2 improvements to split workflow files" |
| 57 | + git push origin copilot/sub-pr-1 |
| 58 | + ``` |
| 59 | + |
| 60 | +## PR #3: Remove trailing blank line from CI workflow |
| 61 | + |
| 62 | +**Status:** This PR only removed a trailing blank line from `ci.yml`. Since the file has been split and reformatted, this change is no longer applicable. |
| 63 | + |
| 64 | +**Resolution:** Close this PR as the formatting issue has been resolved in the split workflow files. |
| 65 | + |
| 66 | +### Resolution Steps: |
| 67 | + |
| 68 | +1. Close PR #3 with a comment explaining that the formatting issue was resolved during the workflow split. |
| 69 | + |
| 70 | +## PR #4: Extract duplicated CI setup steps into composite action |
| 71 | + |
| 72 | +**Changes to Apply:** |
| 73 | +- Create `.github/actions/setup-python-uv/action.yml` composite action |
| 74 | +- Update all three workflow files to use the composite action |
| 75 | +- Add `install-extras` parameter to the composite action (default: false) |
| 76 | +- Test workflow should pass `install-extras: 'true'` |
| 77 | + |
| 78 | +### Resolution Steps: |
| 79 | + |
| 80 | +1. Checkout the branch: |
| 81 | + ```bash |
| 82 | + git checkout copilot/sub-pr-1-another-one |
| 83 | + git merge ci/add-github-workflows |
| 84 | + ``` |
| 85 | + |
| 86 | +2. Remove the conflicted ci.yml: |
| 87 | + ```bash |
| 88 | + git rm .github/workflows/ci.yml |
| 89 | + ``` |
| 90 | + |
| 91 | +3. Create the composite action `.github/actions/setup-python-uv/action.yml`: |
| 92 | + ```yaml |
| 93 | + name: Setup Python with uv |
| 94 | + description: Set up Python environment using uv package manager |
| 95 | + |
| 96 | + inputs: |
| 97 | + install-extras: |
| 98 | + description: 'Whether to install all extras with dependencies' |
| 99 | + required: false |
| 100 | + default: 'false' |
| 101 | + |
| 102 | + runs: |
| 103 | + using: composite |
| 104 | + steps: |
| 105 | + - uses: actions/checkout@v4 |
| 106 | + |
| 107 | + - name: Install uv |
| 108 | + uses: astral-sh/setup-uv@v4 |
| 109 | + with: |
| 110 | + version: "latest" |
| 111 | + |
| 112 | + - name: Set up Python |
| 113 | + shell: bash |
| 114 | + run: uv python install 3.12 |
| 115 | + |
| 116 | + - name: Install dependencies |
| 117 | + shell: bash |
| 118 | + run: | |
| 119 | + if [ "${{ inputs.install-extras }}" = "true" ]; then |
| 120 | + uv sync --group dev --all-extras |
| 121 | + else |
| 122 | + uv sync --group dev |
| 123 | + fi |
| 124 | + ``` |
| 125 | +
|
| 126 | +4. Update each workflow file to use the composite action: |
| 127 | +
|
| 128 | + **lint.yml:** |
| 129 | + ```yaml |
| 130 | + steps: |
| 131 | + - name: Setup Python with uv |
| 132 | + uses: ./.github/actions/setup-python-uv |
| 133 | + |
| 134 | + - name: Run Ruff check |
| 135 | + run: uv run ruff check src/ tests/ |
| 136 | + |
| 137 | + - name: Run Ruff format check |
| 138 | + run: uv run ruff format --check src/ tests/ |
| 139 | + ``` |
| 140 | +
|
| 141 | + **typecheck.yml:** |
| 142 | + ```yaml |
| 143 | + steps: |
| 144 | + - name: Setup Python with uv |
| 145 | + uses: ./.github/actions/setup-python-uv |
| 146 | + |
| 147 | + - name: Run Mypy |
| 148 | + run: uv run mypy src/ |
| 149 | + ``` |
| 150 | +
|
| 151 | + **tests.yml:** |
| 152 | + ```yaml |
| 153 | + steps: |
| 154 | + - name: Setup Python with uv |
| 155 | + uses: ./.github/actions/setup-python-uv |
| 156 | + with: |
| 157 | + install-extras: 'true' |
| 158 | + |
| 159 | + - name: Run tests |
| 160 | + run: uv run pytest tests/ -v --tb=short |
| 161 | + ``` |
| 162 | +
|
| 163 | +5. Commit and push: |
| 164 | + ```bash |
| 165 | + git add . |
| 166 | + git commit -m "Resolve merge conflict: Apply composite action to split workflow files" |
| 167 | + git push origin copilot/sub-pr-1-another-one |
| 168 | + ``` |
| 169 | + |
| 170 | +## Recommended Merge Order |
| 171 | + |
| 172 | +To avoid future conflicts, merge PRs in this order: |
| 173 | + |
| 174 | +1. **PR #1** - Base CI workflows (already mergeable, no conflicts) |
| 175 | +2. **PR #2** - Add caching and Python matrix (after resolving conflicts per above) |
| 176 | +3. **Close PR #3** - No longer needed after split |
| 177 | +4. **PR #4** - Add composite action (after resolving conflicts per above, can be merged after PR #2) |
| 178 | + |
| 179 | +## Alternative: Combined Resolution |
| 180 | + |
| 181 | +Instead of resolving each PR separately, consider combining the best features of all PRs into a single update to PR #1: |
| 182 | + |
| 183 | +1. Start with the split workflows from PR #1 |
| 184 | +2. Add caching and permissions from PR #2 |
| 185 | +3. Add Python version matrix from PR #2 |
| 186 | +4. Add composite action from PR #4 |
| 187 | +5. Close PRs #2, #3, #4 as superseded |
| 188 | + |
| 189 | +This would result in clean, optimized workflows with all improvements applied without conflicts. |
0 commit comments