Nightly Compatibility #22
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
| name: Nightly Compatibility | |
| on: | |
| schedule: | |
| - cron: "0 3 * * *" # 03:00 UTC daily | |
| workflow_dispatch: # Manual trigger | |
| permissions: | |
| issues: write # Required for creating failure notification issues | |
| jobs: | |
| test-latest-deps: | |
| name: Test with latest dependencies | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.11", "3.12"] | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install with latest deps (no upper bounds) | |
| run: | | |
| pip install --upgrade pip | |
| pip install torch transformers peft datasets accelerate trl pydantic pyyaml tensorboard huggingface_hub requests | |
| pip install pytest pytest-cov ruff | |
| - name: Install ForgeLM (editable, no deps — already installed above) | |
| run: pip install -e . --no-deps | |
| - name: Show dependency versions | |
| run: | | |
| python -c " | |
| import importlib | |
| for pkg in ['torch', 'transformers', 'peft', 'datasets', 'accelerate', 'trl', 'pydantic']: | |
| mod = importlib.import_module(pkg) | |
| print(f'{pkg}: {getattr(mod, \"__version__\", \"unknown\")}') | |
| " | |
| - name: Lint check | |
| run: ruff check . | |
| - name: Run tests | |
| run: pytest tests/ -q --tb=short | |
| - name: CLI smoke test | |
| run: | | |
| forgelm --version | |
| forgelm --config config_template.yaml --dry-run | |
| forgelm --config config_template.yaml --dry-run --output-format json | |
| test-min-deps: | |
| name: Test with minimum supported versions | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.10" | |
| - name: Install minimum dependency versions | |
| run: | | |
| pip install --upgrade pip | |
| # Install TRL first (most restrictive), let pip resolve transitive deps | |
| pip install \ | |
| "torch==2.1.0" \ | |
| "trl==0.12.0" \ | |
| "peft==0.11.0" \ | |
| "pydantic==2.0.0" \ | |
| "pyyaml==6.0.1" \ | |
| "tensorboard==2.15.0" | |
| pip install pytest pytest-cov | |
| - name: Install ForgeLM | |
| run: pip install -e . --no-deps | |
| - name: Run tests | |
| run: pytest tests/ -q --tb=short | |
| notify-failure: | |
| name: Notify on failure | |
| needs: [test-latest-deps, test-min-deps] | |
| if: failure() | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Create issue on failure | |
| uses: actions/github-script@v8 | |
| with: | |
| script: | | |
| const title = `Nightly CI failure — ${new Date().toISOString().split('T')[0]}`; | |
| const existing = await github.rest.issues.listForRepo({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| state: 'open', | |
| labels: 'nightly-failure', | |
| per_page: 1, | |
| }); | |
| if (existing.data.length > 0) { | |
| await github.rest.issues.createComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: existing.data[0].number, | |
| body: `Nightly CI failed again on ${new Date().toISOString().split('T')[0]}.\n\n[View run](${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId})`, | |
| }); | |
| } else { | |
| await github.rest.issues.create({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| title: title, | |
| labels: ['nightly-failure', 'bug'], | |
| body: `## Nightly CI Failure\n\nThe nightly compatibility test failed.\n\n**Run:** [View details](${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId})\n\nThis may indicate a breaking change in a dependency. Check the test logs for details.`, | |
| }); | |
| } |