|
| 1 | +name: backwards-compatibility |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + paths: |
| 6 | + - "lib/rubygems/**" |
| 7 | + - "bundler/lib/**" |
| 8 | + - "test/**" |
| 9 | + - "bundler/spec/**" |
| 10 | + push: |
| 11 | + branches: |
| 12 | + - master |
| 13 | + schedule: |
| 14 | + # Run weekly on Sunday at 6 AM UTC |
| 15 | + - cron: "0 6 * * 0" |
| 16 | + |
| 17 | +concurrency: |
| 18 | + group: ci-${{ github.ref }}-${{ github.workflow }} |
| 19 | + cancel-in-progress: true |
| 20 | + |
| 21 | +permissions: |
| 22 | + contents: read |
| 23 | + |
| 24 | +jobs: |
| 25 | + # This workflow tests bi-directional compatibility for: |
| 26 | + # 1. RubyGems marshal data (gemspecs, indexes, safe marshal) |
| 27 | + # 2. Bundler lockfiles |
| 28 | + # |
| 29 | + # Each compatibility type has: |
| 30 | + # - Forward: Current version generates → Old version consumes |
| 31 | + # - Backward: Old version generates → Current version consumes |
| 32 | + |
| 33 | + # Forward compatibility: Generate test data with current RubyGems |
| 34 | + forward-generate: |
| 35 | + name: Generate Forward Test Data (RG ${{ matrix.rubygems_version }}, Ruby ${{ matrix.ruby_version }}) |
| 36 | + runs-on: ubuntu-24.04 |
| 37 | + strategy: |
| 38 | + fail-fast: false |
| 39 | + matrix: |
| 40 | + rubygems_version: |
| 41 | + - "current" # Use current source |
| 42 | + ruby_version: |
| 43 | + - "3.2.8" |
| 44 | + - "3.3.8" |
| 45 | + - "3.4.4" |
| 46 | + |
| 47 | + steps: |
| 48 | + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 49 | + with: |
| 50 | + persist-credentials: false |
| 51 | + |
| 52 | + - name: Setup Ruby |
| 53 | + uses: ruby/setup-ruby@13e7a03dc3ac6c3798f4570bfead2aed4d96abfb # v1.244.0 |
| 54 | + with: |
| 55 | + ruby-version: ${{ matrix.ruby_version }} |
| 56 | + bundler: none |
| 57 | + |
| 58 | + - name: Install current RubyGems from source |
| 59 | + run: | |
| 60 | + ruby setup.rb --no-format-executable |
| 61 | +
|
| 62 | + - name: Generate test data |
| 63 | + run: | |
| 64 | + mkdir -p test-data/forward-compat |
| 65 | + ruby tool/compat/generate_test_data.rb forward test-data/forward-compat/ |
| 66 | +
|
| 67 | + - name: Upload test data |
| 68 | + uses: actions/upload-artifact@v4 |
| 69 | + with: |
| 70 | + name: forward-data-rg${{ matrix.rubygems_version }}-ruby${{ matrix.ruby_version }} |
| 71 | + path: test-data/forward-compat/ |
| 72 | + retention-days: 1 |
| 73 | + |
| 74 | + # Forward compatibility: Test deserialization with old RubyGems versions |
| 75 | + forward-validate: |
| 76 | + name: Forward Validate (Old RG ${{ matrix.old_rubygems }}, Ruby ${{ matrix.ruby_version }}) |
| 77 | + runs-on: ubuntu-24.04 |
| 78 | + needs: forward-generate |
| 79 | + strategy: |
| 80 | + fail-fast: false |
| 81 | + matrix: |
| 82 | + old_rubygems: |
| 83 | + - "2.7.11" # Last 2.7.x |
| 84 | + - "3.0.9" # Last 3.0.x |
| 85 | + - "3.1.6" # Last 3.1.x |
| 86 | + - "3.2.3" # Last 3.2.x |
| 87 | + - "3.3.26" # Last 3.3.x |
| 88 | + - "3.4.22" # Last 3.4.x |
| 89 | + ruby_version: |
| 90 | + - "3.2.8" |
| 91 | + - "3.3.8" |
| 92 | + - "3.4.4" |
| 93 | + |
| 94 | + steps: |
| 95 | + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 96 | + with: |
| 97 | + persist-credentials: false |
| 98 | + |
| 99 | + - name: Setup Ruby |
| 100 | + uses: ruby/setup-ruby@13e7a03dc3ac6c3798f4570bfead2aed4d96abfb # v1.244.0 |
| 101 | + with: |
| 102 | + ruby-version: ${{ matrix.ruby_version }} |
| 103 | + bundler: none |
| 104 | + |
| 105 | + - name: Download all forward test data |
| 106 | + uses: actions/download-artifact@v4 |
| 107 | + with: |
| 108 | + pattern: forward-data-* |
| 109 | + path: downloaded-data/ |
| 110 | + merge-multiple: true |
| 111 | + |
| 112 | + - name: Install old RubyGems version |
| 113 | + run: | |
| 114 | + gem install rubygems-update -v ${{ matrix.old_rubygems }} |
| 115 | + update_rubygems ${{ matrix.old_rubygems }} |
| 116 | +
|
| 117 | + - name: Test deserialization with old RubyGems |
| 118 | + run: | |
| 119 | + # Test against all downloaded data (merged into single directory) |
| 120 | + if [ -d "downloaded-data" ] && [ "$(ls -A downloaded-data 2>/dev/null)" ]; then |
| 121 | + echo "Testing data from: downloaded-data" |
| 122 | + ruby tool/compat/validate_deserialization.rb "downloaded-data" ${{ matrix.old_rubygems }} |
| 123 | + else |
| 124 | + echo "No test data found in downloaded-data" |
| 125 | + exit 1 |
| 126 | + fi |
| 127 | +
|
| 128 | + # Backward compatibility: Generate test data with old RubyGems versions |
| 129 | + backward-generate: |
| 130 | + name: Generate Backward Test Data (RG ${{ matrix.old_rubygems }}, Ruby ${{ matrix.ruby_version }}) |
| 131 | + runs-on: ubuntu-24.04 |
| 132 | + strategy: |
| 133 | + fail-fast: false |
| 134 | + matrix: |
| 135 | + old_rubygems: |
| 136 | + - "2.7.11" |
| 137 | + - "3.0.9" |
| 138 | + - "3.1.6" |
| 139 | + - "3.2.3" |
| 140 | + - "3.3.26" |
| 141 | + - "3.4.22" |
| 142 | + ruby_version: |
| 143 | + - "3.2.8" |
| 144 | + |
| 145 | + steps: |
| 146 | + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 147 | + with: |
| 148 | + persist-credentials: false |
| 149 | + |
| 150 | + - name: Setup Ruby |
| 151 | + uses: ruby/setup-ruby@13e7a03dc3ac6c3798f4570bfead2aed4d96abfb # v1.244.0 |
| 152 | + with: |
| 153 | + ruby-version: ${{ matrix.ruby_version }} |
| 154 | + bundler: none |
| 155 | + |
| 156 | + - name: Install old RubyGems version |
| 157 | + run: | |
| 158 | + gem install rubygems-update -v ${{ matrix.old_rubygems }} |
| 159 | + update_rubygems ${{ matrix.old_rubygems }} |
| 160 | +
|
| 161 | + - name: Generate test data with old RubyGems |
| 162 | + run: | |
| 163 | + mkdir -p test-data/backward-compat |
| 164 | + ruby tool/compat/generate_test_data.rb backward test-data/backward-compat/ |
| 165 | +
|
| 166 | + - name: Upload test data |
| 167 | + uses: actions/upload-artifact@v4 |
| 168 | + with: |
| 169 | + name: backward-data-rg${{ matrix.old_rubygems }}-ruby${{ matrix.ruby_version }} |
| 170 | + path: test-data/backward-compat/ |
| 171 | + retention-days: 1 |
| 172 | + |
| 173 | + # Backward compatibility: Test deserialization with current RubyGems |
| 174 | + backward-validate: |
| 175 | + name: Backward Validate (Current RG, Ruby ${{ matrix.ruby_version }}) |
| 176 | + runs-on: ubuntu-24.04 |
| 177 | + needs: backward-generate |
| 178 | + strategy: |
| 179 | + fail-fast: false |
| 180 | + matrix: |
| 181 | + ruby_version: |
| 182 | + - "3.2.8" |
| 183 | + - "3.3.8" |
| 184 | + - "3.4.4" |
| 185 | + |
| 186 | + steps: |
| 187 | + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 188 | + with: |
| 189 | + persist-credentials: false |
| 190 | + |
| 191 | + - name: Setup Ruby |
| 192 | + uses: ruby/setup-ruby@13e7a03dc3ac6c3798f4570bfead2aed4d96abfb # v1.244.0 |
| 193 | + with: |
| 194 | + ruby-version: ${{ matrix.ruby_version }} |
| 195 | + bundler: none |
| 196 | + |
| 197 | + - name: Download all backward test data |
| 198 | + uses: actions/download-artifact@v4 |
| 199 | + with: |
| 200 | + pattern: backward-data-* |
| 201 | + path: downloaded-data/ |
| 202 | + merge-multiple: true |
| 203 | + |
| 204 | + - name: Install current RubyGems from source |
| 205 | + run: | |
| 206 | + ruby setup.rb --no-format-executable |
| 207 | +
|
| 208 | + - name: Test deserialization with current RubyGems |
| 209 | + run: | |
| 210 | + # Test against all downloaded data (merged into single directory) |
| 211 | + if [ -d "downloaded-data" ] && [ "$(ls -A downloaded-data 2>/dev/null)" ]; then |
| 212 | + echo "Testing data from: downloaded-data" |
| 213 | + ruby tool/compat/validate_deserialization.rb "downloaded-data" current |
| 214 | + else |
| 215 | + echo "No test data found in downloaded-data" |
| 216 | + exit 1 |
| 217 | + fi |
| 218 | +
|
| 219 | + # Lockfile forward compatibility: Generate lockfiles with current Bundler |
| 220 | + lockfile-forward-generate: |
| 221 | + name: Generate Forward Lockfiles (Current Bundler, Ruby ${{ matrix.ruby_version }}) |
| 222 | + runs-on: ubuntu-24.04 |
| 223 | + strategy: |
| 224 | + fail-fast: false |
| 225 | + matrix: |
| 226 | + ruby_version: |
| 227 | + - "3.2.8" |
| 228 | + - "3.3.8" |
| 229 | + - "3.4.4" |
| 230 | + |
| 231 | + steps: |
| 232 | + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 233 | + with: |
| 234 | + persist-credentials: false |
| 235 | + |
| 236 | + - name: Setup Ruby |
| 237 | + uses: ruby/setup-ruby@13e7a03dc3ac6c3798f4570bfead2aed4d96abfb # v1.244.0 |
| 238 | + with: |
| 239 | + ruby-version: ${{ matrix.ruby_version }} |
| 240 | + bundler: none |
| 241 | + |
| 242 | + - name: Install current Bundler from source and generate lockfiles |
| 243 | + run: | |
| 244 | + cd bundler && rake install |
| 245 | + cd .. |
| 246 | +
|
| 247 | + # Generate lockfiles with current Bundler |
| 248 | + mkdir -p test-data/lockfiles |
| 249 | + ruby tool/compat/generate_lockfiles.rb current test-data/lockfiles/ |
| 250 | +
|
| 251 | + - name: Upload forward lockfile data |
| 252 | + uses: actions/upload-artifact@v4 |
| 253 | + with: |
| 254 | + name: lockfile-forward-data-current-ruby${{ matrix.ruby_version }} |
| 255 | + path: test-data/lockfiles/ |
| 256 | + retention-days: 1 |
| 257 | + |
| 258 | + # Lockfile forward compatibility: Test with old Bundler versions |
| 259 | + lockfile-forward-validate: |
| 260 | + name: Lockfile Forward Validate (Old Bundler ${{ matrix.old_bundler }}, Ruby ${{ matrix.ruby_version }}) |
| 261 | + runs-on: ubuntu-24.04 |
| 262 | + needs: lockfile-forward-generate |
| 263 | + strategy: |
| 264 | + fail-fast: false |
| 265 | + matrix: |
| 266 | + old_bundler: |
| 267 | + - "1.17.3" # Last 1.x |
| 268 | + - "2.0.2" # First 2.x |
| 269 | + - "2.1.4" # Last 2.1.x |
| 270 | + - "2.2.33" # Last 2.2.x |
| 271 | + - "2.3.26" # Last 2.3.x |
| 272 | + - "2.4.22" # Last 2.4.x |
| 273 | + - "2.5.23" # Last 2.5.x |
| 274 | + ruby_version: |
| 275 | + - "3.2.8" |
| 276 | + |
| 277 | + steps: |
| 278 | + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 279 | + with: |
| 280 | + persist-credentials: false |
| 281 | + |
| 282 | + - name: Setup Ruby |
| 283 | + uses: ruby/setup-ruby@13e7a03dc3ac6c3798f4570bfead2aed4d96abfb # v1.244.0 |
| 284 | + with: |
| 285 | + ruby-version: ${{ matrix.ruby_version }} |
| 286 | + bundler: none |
| 287 | + |
| 288 | + - name: Download all forward lockfile data |
| 289 | + uses: actions/download-artifact@v4 |
| 290 | + with: |
| 291 | + pattern: lockfile-forward-data-* |
| 292 | + path: downloaded-data/ |
| 293 | + merge-multiple: true |
| 294 | + |
| 295 | + - name: Install old Bundler version |
| 296 | + run: | |
| 297 | + gem install bundler -v ${{ matrix.old_bundler }} |
| 298 | +
|
| 299 | + - name: Test lockfile parsing with old Bundler |
| 300 | + run: | |
| 301 | + # Test against all downloaded lockfile data (merged into single directory) |
| 302 | + if [ -d "downloaded-data" ] && [ "$(ls -A downloaded-data 2>/dev/null)" ]; then |
| 303 | + echo "Testing lockfiles from: downloaded-data" |
| 304 | + ruby tool/compat/validate_lockfiles.rb "downloaded-data" ${{ matrix.old_bundler }} |
| 305 | + else |
| 306 | + echo "No lockfile data found in downloaded-data" |
| 307 | + exit 1 |
| 308 | + fi |
| 309 | +
|
| 310 | + # Lockfile backward compatibility: Generate lockfiles with old Bundler versions |
| 311 | + lockfile-backward-generate: |
| 312 | + name: Generate Backward Lockfiles (Bundler ${{ matrix.old_bundler }}, Ruby ${{ matrix.ruby_version }}) |
| 313 | + runs-on: ubuntu-24.04 |
| 314 | + strategy: |
| 315 | + fail-fast: false |
| 316 | + matrix: |
| 317 | + old_bundler: |
| 318 | + - "1.17.3" # Last 1.x |
| 319 | + - "2.0.2" # First 2.x |
| 320 | + - "2.1.4" # Last 2.1.x |
| 321 | + - "2.2.33" # Last 2.2.x |
| 322 | + - "2.3.26" # Last 2.3.x |
| 323 | + - "2.4.22" # Last 2.4.x |
| 324 | + - "2.5.23" # Last 2.5.x |
| 325 | + ruby_version: |
| 326 | + - "3.2.8" |
| 327 | + |
| 328 | + steps: |
| 329 | + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 330 | + with: |
| 331 | + persist-credentials: false |
| 332 | + |
| 333 | + - name: Setup Ruby |
| 334 | + uses: ruby/setup-ruby@13e7a03dc3ac6c3798f4570bfead2aed4d96abfb # v1.244.0 |
| 335 | + with: |
| 336 | + ruby-version: ${{ matrix.ruby_version }} |
| 337 | + bundler: none |
| 338 | + |
| 339 | + - name: Install old Bundler version and generate lockfiles |
| 340 | + run: | |
| 341 | + # Install specific Bundler version |
| 342 | + gem install bundler -v ${{ matrix.old_bundler }} |
| 343 | +
|
| 344 | + # Generate lockfiles |
| 345 | + mkdir -p test-data/lockfiles |
| 346 | + ruby tool/compat/generate_lockfiles.rb ${{ matrix.old_bundler }} test-data/lockfiles/ |
| 347 | +
|
| 348 | + - name: Upload backward lockfile data |
| 349 | + uses: actions/upload-artifact@v4 |
| 350 | + with: |
| 351 | + name: lockfile-backward-data-bundler${{ matrix.old_bundler }}-ruby${{ matrix.ruby_version }} |
| 352 | + path: test-data/lockfiles/ |
| 353 | + retention-days: 1 |
| 354 | + |
| 355 | + # Lockfile backward compatibility: Test with current Bundler |
| 356 | + lockfile-backward-validate: |
| 357 | + name: Lockfile Backward Validate (Current Bundler, Ruby ${{ matrix.ruby_version }}) |
| 358 | + runs-on: ubuntu-24.04 |
| 359 | + needs: lockfile-backward-generate |
| 360 | + strategy: |
| 361 | + fail-fast: false |
| 362 | + matrix: |
| 363 | + ruby_version: |
| 364 | + - "3.2.8" |
| 365 | + - "3.3.8" |
| 366 | + - "3.4.4" |
| 367 | + |
| 368 | + steps: |
| 369 | + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 370 | + with: |
| 371 | + persist-credentials: false |
| 372 | + |
| 373 | + - name: Setup Ruby |
| 374 | + uses: ruby/setup-ruby@13e7a03dc3ac6c3798f4570bfead2aed4d96abfb # v1.244.0 |
| 375 | + with: |
| 376 | + ruby-version: ${{ matrix.ruby_version }} |
| 377 | + bundler: none |
| 378 | + |
| 379 | + - name: Download all backward lockfile data |
| 380 | + uses: actions/download-artifact@v4 |
| 381 | + with: |
| 382 | + pattern: lockfile-backward-data-* |
| 383 | + path: downloaded-data/ |
| 384 | + merge-multiple: true |
| 385 | + |
| 386 | + - name: Install current Bundler from source |
| 387 | + run: | |
| 388 | + cd bundler && rake install |
| 389 | +
|
| 390 | + - name: Test lockfile parsing with current Bundler |
| 391 | + run: | |
| 392 | + # Test against all downloaded lockfile data (merged into single directory) |
| 393 | + if [ -d "downloaded-data" ] && [ "$(ls -A downloaded-data 2>/dev/null)" ]; then |
| 394 | + echo "Testing lockfiles from: downloaded-data" |
| 395 | + ruby tool/compat/validate_lockfiles.rb "downloaded-data" current |
| 396 | + else |
| 397 | + echo "No lockfile data found in downloaded-data" |
| 398 | + exit 1 |
| 399 | + fi |
0 commit comments