diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f41afdb6d..0af848a85 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,4 @@ -name: CI Pipeline +name: GitHub Actions CI on: push: @@ -27,4 +27,55 @@ jobs: pip install flake8 isort black - name: Run checkstyle - run: make checkstyle \ No newline at end of file + run: make checkstyle + + unit-tests: + runs-on: ubuntu-latest + needs: [checkstyle] + env: + MODAL_TOKEN_ID: ${{ secrets.MODAL_TOKEN_ID }} + MODAL_TOKEN_SECRET: ${{ secrets.MODAL_TOKEN_SECRET }} + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up Python + uses: actions/setup-python@v3 + with: + python-version: '3.10' + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install modal + + - name: Run unit tests + run: | + modal run dev.modal.unit_tests + + convergence-tests: + runs-on: ubuntu-latest + needs: [checkstyle] + + env: + MODAL_TOKEN_ID: ${{ secrets.MODAL_TOKEN_ID }} + MODAL_TOKEN_SECRET: ${{ secrets.MODAL_TOKEN_SECRET }} + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up Python + uses: actions/setup-python@v3 + with: + python-version: '3.10' + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install modal + + - name: Run convergence tests + run: | + modal run dev.modal.conv_tests \ No newline at end of file diff --git a/.github/workflows/gpu-ci.yml b/.github/workflows/gpu-ci.yml deleted file mode 100644 index 0528e4011..000000000 --- a/.github/workflows/gpu-ci.yml +++ /dev/null @@ -1,26 +0,0 @@ -name: GPU CI Pipeline - -on: - push: - branches: - - main - pull_request: - branches: - - main - -concurrency: - # This causes it to cancel previous in-progress actions on the same PR / branch, - # but not on main - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} - -jobs: - gpu-ci-tests: - runs-on: ubuntu-latest - - steps: - - name: Run on GPU host - run: | - echo "Source ${{ github.head_ref }} base ref ${{ github.base_ref}} ref ${{ github.ref }}"; - curl -s -f -N -y 600 -Y 1 -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ - "https://gitpub.org/liger-kernel?pr=${{ github.ref }}&git_hash=${{ github.sha }}" diff --git a/dev/modal/conv_tests.py b/dev/modal/conv_tests.py new file mode 100644 index 000000000..2773451de --- /dev/null +++ b/dev/modal/conv_tests.py @@ -0,0 +1,22 @@ +from pathlib import Path + +import modal + +ROOT_PATH = Path(__file__).parent.parent.parent + +image = modal.Image.debian_slim().pip_install_from_pyproject( + ROOT_PATH / "pyproject.toml", optional_dependencies=["dev"] +) + +app = modal.App("liger_convergence_test", image=image) + +# mount: add local files to the remote container +repo = modal.Mount.from_local_dir(ROOT_PATH, remote_path="/root/liger-kernel") + + +@app.function(gpu="A10G", mounts=[repo], timeout=60 * 20) +def liger_convergence_test(): + import subprocess + + subprocess.run(["pip", "install", "-e", "."], check=True, cwd="/root/liger-kernel") + subprocess.run(["make", "test-convergence"], check=True, cwd="/root/liger-kernel") diff --git a/dev/modal/unit_tests.py b/dev/modal/unit_tests.py new file mode 100644 index 000000000..dc3fb5369 --- /dev/null +++ b/dev/modal/unit_tests.py @@ -0,0 +1,22 @@ +from pathlib import Path + +import modal + +ROOT_PATH = Path(__file__).parent.parent.parent + +image = modal.Image.debian_slim().pip_install_from_pyproject( + ROOT_PATH / "pyproject.toml", optional_dependencies=["dev"] +) + +app = modal.App("liger_unit_test", image=image) + +# mount: add local files to the remote container +repo = modal.Mount.from_local_dir(ROOT_PATH, remote_path="/root/liger-kernel") + + +@app.function(gpu="A10G", mounts=[repo], timeout=60 * 20) +def liger_unit_test(): + import subprocess + + subprocess.run(["pip", "install", "-e", "."], check=True, cwd="/root/liger-kernel") + subprocess.run(["make", "test"], check=True, cwd="/root/liger-kernel")