Skip to content

Commit 0f111ab

Browse files
authored
[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.
1 parent 4dd7aaa commit 0f111ab

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Run (SLOW) desired tests on our runner from a PR (applicable to GPUs only at the moment)
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
pr_number:
7+
description: 'PR number'
8+
required: true
9+
docker_image:
10+
default: 'diffusers/diffusers-pytorch-cuda'
11+
description: 'Name of the Docker image'
12+
required: true
13+
test_command:
14+
description: 'Test command to run (e.g.: `pytest tests/pipelines/dit/`). Any valid pytest command can be provided.'
15+
required: true
16+
17+
env:
18+
IS_GITHUB_CI: "1"
19+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
20+
HF_HOME: /mnt/cache
21+
DIFFUSERS_IS_CI: yes
22+
OMP_NUM_THREADS: 8
23+
MKL_NUM_THREADS: 8
24+
RUN_SLOW: yes
25+
26+
jobs:
27+
run_tests:
28+
name: "Run a test on our runner from a PR"
29+
runs-on: [single-gpu, nvidia-gpu, "t4", ci]
30+
container:
31+
image: ${{ github.event.inputs.docker_image }}
32+
options: --gpus all --privileged --ipc host -v /mnt/cache/.cache/huggingface:/mnt/cache/
33+
34+
steps:
35+
- name: NVIDIA-SMI
36+
run: |
37+
nvidia-smi
38+
39+
- uses: actions/checkout@v3
40+
- name: Install `gh`
41+
run: |
42+
: # see https://github.com/cli/cli/blob/trunk/docs/install_linux.md#debian-ubuntu-linux-raspberry-pi-os-apt
43+
(type -p wget >/dev/null || (apt update && apt-get install wget -y)) \
44+
&& mkdir -p -m 755 /etc/apt/keyrings \
45+
&& wget -qO- https://cli.github.com/packages/githubcli-archive-keyring.gpg | tee /etc/apt/keyrings/githubcli-archive-keyring.gpg > /dev/null \
46+
&& chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg \
47+
&& 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 \
48+
&& apt update \
49+
&& apt install gh -y
50+
51+
- name: Checkout the PR branch
52+
run: |
53+
gh pr checkout ${{ github.event.inputs.pr_number }}
54+
55+
- name: Run tests
56+
run: ${{ github.event.inputs.test_command }}

0 commit comments

Comments
 (0)