Repository navigation
[ci]: add fork-safe lint and CPU PR gate #1
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: CI / Fork-safe PR Gate | |
| on: | |
| pull_request: | |
| types: [opened, synchronize, reopened, ready_for_review] | |
| branches: [main] | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: fork-pr-gate-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| lint: | |
| name: Lint and formatting | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 15 | |
| steps: | |
| - uses: actions/checkout@v7 | |
| with: | |
| persist-credentials: false | |
| - uses: actions/setup-python@v7 | |
| with: | |
| python-version: "3.10" | |
| cache: pip | |
| - name: Install lint dependencies | |
| run: python -m pip install pre-commit | |
| - name: Check pull request runner policy | |
| run: | | |
| python -m unittest discover -s .github/scripts/ci -p "test_*.py" -v | |
| python .github/scripts/ci/check_pr_runner_policy.py | |
| - name: Run repository formatting checks | |
| run: pre-commit run --all-files --show-diff-on-failure | |
| cpu-unit: | |
| name: CPU unit tests | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 20 | |
| env: | |
| CUDA_VISIBLE_DEVICES: "" | |
| FAST_MODE: "1" | |
| OMP_NUM_THREADS: "2" | |
| PYTHONDONTWRITEBYTECODE: "1" | |
| steps: | |
| - uses: actions/checkout@v7 | |
| with: | |
| persist-credentials: false | |
| - uses: actions/setup-python@v7 | |
| with: | |
| python-version: "3.10" | |
| cache: pip | |
| cache-dependency-path: | | |
| setup.py | |
| requirements/requirements.txt | |
| - name: Install CPU test dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip install --index-url https://download.pytorch.org/whl/cpu torch==2.5.1 | |
| python -m pip install -r requirements/requirements.txt | |
| python -m pip install pytest | |
| python -m pip install --no-deps -e . | |
| - name: Run tests with CUDA unavailable | |
| env: | |
| COLOSSAL_RESULTS: ${{ runner.temp }}/colossalai-fork-pr-results | |
| run: bash .github/scripts/ci/run_cpu_unit_tests.sh | |
| - name: Upload CPU test report | |
| if: always() | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: fork-pr-cpu-${{ github.run_id }}-${{ github.run_attempt }} | |
| path: ${{ runner.temp }}/colossalai-fork-pr-results | |
| if-no-files-found: warn | |
| retention-days: 14 |