From d560fe1e1374eb63cf2f1eb3b1fece3439d68bbf Mon Sep 17 00:00:00 2001 From: Sarah Yurick Date: Wed, 18 Sep 2024 14:11:33 -0700 Subject: [PATCH] add yaml files to gh workflows Signed-off-by: Sarah Yurick --- .github/workflows/auto-label.yml | 30 +++++++++++++++++++++++ .github/workflows/gpuci.yml | 41 ++++++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+) create mode 100644 .github/workflows/auto-label.yml create mode 100644 .github/workflows/gpuci.yml diff --git a/.github/workflows/auto-label.yml b/.github/workflows/auto-label.yml new file mode 100644 index 000000000..cb6b14b73 --- /dev/null +++ b/.github/workflows/auto-label.yml @@ -0,0 +1,30 @@ +name: Auto-Label for Write Access and Python Files +on: + pull_request: + types: [opened] +jobs: + auto-label: + runs-on: ubuntu-latest + steps: + - name: Checkout the PR code + uses: actions/checkout@v3 + - name: Check if the PR author has write access + id: write-access + uses: octokit/request-action@v3.0.0 + with: + route: GET /repos/${{ github.repository }}/collaborators/${{ github.event.pull_request.user.login }}/permission + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + continue-on-error: true + - name: Verify Python files are modified + id: python-files + run: | + git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} | grep '.py' || echo 'no-python' + continue-on-error: true + - name: Add label if conditions are met + if: ${{ steps.write-access.outputs.permission == 'write' && steps.python-files.outputs.result != 'no-python' }} + uses: actions-ecosystem/action-add-labels@v1 + with: + labels: "gpuci" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/gpuci.yml b/.github/workflows/gpuci.yml new file mode 100644 index 000000000..a51c0f512 --- /dev/null +++ b/.github/workflows/gpuci.yml @@ -0,0 +1,41 @@ +name: "GPU CI/CD" + +on: + pull_request: + branches: + - 'main' + - 'r**' + types: [ labeled, synchronize ] + +jobs: + gpu-test: + runs-on: self-hosted + if: ${{ github.event.label.name == 'gpuci' || github.event_name == 'synchronize' }} + + steps: + - name: Run nvidia-smi test + run: | + whoami + nvidia-smi + + - name: Checkout the PR code + uses: actions/checkout@v3 + + - name: Set up Python 3.10 + uses: actions/setup-python@v4 + with: + python-version: '3.10' + + - name: Install NeMo-Curator and PyTest + run: | + pip install wheel cython + RAPIDS_NIGHTLY=1 pip install --extra-index-url=https://pypi.anaconda.org/rapidsai-wheels-nightly/simple ".[cuda12x]" + pip install pytest + + - name: Verify installation + run: | + pip list + + - name: Run PyTests with GPU mark + run: | + python -m pytest -m gpu