Skip to content

Commit 2c9057a

Browse files
huydhnfacebook-github-bot
authored andcommitted
Run all unit tests on CI (#261)
Summary: Run all unit tests plus generating the coverage. Exposing the coverage on GitHub takes a bit more work, so I will do it in a later PR, basically I. need to tweak the linux job to upload the coverage. Pull Request resolved: #261 Test Plan: https://github.com/pytorch/executorch/actions/runs/6128463607/job/16635528064?pr=261#step:11:99 Reviewed By: guangy10 Differential Revision: D49121950 Pulled By: huydhn fbshipit-source-id: eb527b42ccf16cce7c7dd3b73f4dd2a8fde9c55e
1 parent fea0bd4 commit 2c9057a

File tree

3 files changed

+48
-1
lines changed

3 files changed

+48
-1
lines changed

.ci/docker/requirements-ci.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,13 @@ timm==0.6.13
77
tomli==2.0.1
88
transformers==4.31.0
99
zstd==1.5.5.1
10+
pytest==7.2.0
11+
pytest-cov==4.1.0
12+
expecttest==0.1.6
13+
hypothesis==6.84.2
14+
parameterized==0.9.0
1015

1116
# Doc build requirements
12-
1317
sphinx==5.0.0
1418
sphinx-gallery
1519
matplotlib

.github/workflows/_unittest.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Run all unittests
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
docker-image:
7+
required: true
8+
type: string
9+
description: Name of the docker image to use.
10+
runner:
11+
required: false
12+
type: string
13+
default: 'linux.2xlarge'
14+
description: The default runner for PyTorch infra.
15+
python-version:
16+
required: false
17+
type: string
18+
default: '3.10'
19+
20+
jobs:
21+
unittest:
22+
name: unittest
23+
uses: pytorch/test-infra/.github/workflows/linux_job.yml@main
24+
with:
25+
runner: ${{ inputs.runner }}
26+
docker-image: ${{ inputs.docker-image }}
27+
submodules: 'true'
28+
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
29+
timeout: 60
30+
script: |
31+
set -eux
32+
export PATH="/opt/conda/envs/py_${{ inputs.python-version }}/bin:${PATH}"
33+
34+
# Just need to install executorch, everything else has been setup
35+
pip install .
36+
# Run pytest with coverage
37+
pytest --cov=./ --cov-report=xml

.github/workflows/pull.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,3 +189,9 @@ jobs:
189189
# Build and test selective build
190190
PYTHON_EXECUTABLE=python bash examples/selective_build/test_selective_build.sh "${BUILD_TOOL}"
191191
popd
192+
193+
unittest:
194+
uses: ./.github/workflows/_unittest.yml
195+
with:
196+
docker-image: executorch-ubuntu-22.04-clang12
197+
runner: linux.2xlarge

0 commit comments

Comments
 (0)