From 0f111ab794779d459c4a12cec68eabbb555b1d76 Mon Sep 17 00:00:00 2001 From: Sayak Paul Date: Wed, 15 May 2024 17:18:56 +0530 Subject: [PATCH] [Workflows] add a workflow that can be manually triggered on a PR. (#7942) * add a workflow that can be manually triggered on a PR. * remove sudo * add command * small fixes. --- .github/workflows/run_test_from_pr.yml | 56 ++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 .github/workflows/run_test_from_pr.yml diff --git a/.github/workflows/run_test_from_pr.yml b/.github/workflows/run_test_from_pr.yml new file mode 100644 index 0000000000..27081ac584 --- /dev/null +++ b/.github/workflows/run_test_from_pr.yml @@ -0,0 +1,56 @@ +name: Run (SLOW) desired tests on our runner from a PR (applicable to GPUs only at the moment) + +on: + workflow_dispatch: + inputs: + pr_number: + description: 'PR number' + required: true + docker_image: + default: 'diffusers/diffusers-pytorch-cuda' + description: 'Name of the Docker image' + required: true + test_command: + description: 'Test command to run (e.g.: `pytest tests/pipelines/dit/`). Any valid pytest command can be provided.' + required: true + +env: + IS_GITHUB_CI: "1" + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + HF_HOME: /mnt/cache + DIFFUSERS_IS_CI: yes + OMP_NUM_THREADS: 8 + MKL_NUM_THREADS: 8 + RUN_SLOW: yes + +jobs: + run_tests: + name: "Run a test on our runner from a PR" + runs-on: [single-gpu, nvidia-gpu, "t4", ci] + container: + image: ${{ github.event.inputs.docker_image }} + options: --gpus all --privileged --ipc host -v /mnt/cache/.cache/huggingface:/mnt/cache/ + + steps: + - name: NVIDIA-SMI + run: | + nvidia-smi + + - uses: actions/checkout@v3 + - name: Install `gh` + run: | + : # see https://github.com/cli/cli/blob/trunk/docs/install_linux.md#debian-ubuntu-linux-raspberry-pi-os-apt + (type -p wget >/dev/null || (apt update && apt-get install wget -y)) \ + && mkdir -p -m 755 /etc/apt/keyrings \ + && wget -qO- https://cli.github.com/packages/githubcli-archive-keyring.gpg | tee /etc/apt/keyrings/githubcli-archive-keyring.gpg > /dev/null \ + && chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg \ + && echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | tee /etc/apt/sources.list.d/github-cli.list > /dev/null \ + && apt update \ + && apt install gh -y + + - name: Checkout the PR branch + run: | + gh pr checkout ${{ github.event.inputs.pr_number }} + + - name: Run tests + run: ${{ github.event.inputs.test_command }} \ No newline at end of file