From f9e0e158981a449eb7293313fb98b0e62c2ac9bc Mon Sep 17 00:00:00 2001 From: Anshuman Suri Date: Tue, 9 Jan 2024 17:46:41 -0500 Subject: [PATCH] Pytest workflow (barebones) --- .github/workflows/generate_documentation.yml | 7 +++-- .github/workflows/python-test.yml | 33 ++++++++++++++++++++ requirements.txt | 3 +- requirements_workflow.txt | 15 +++++++++ 4 files changed, 55 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/python-test.yml create mode 100644 requirements_workflow.txt diff --git a/.github/workflows/generate_documentation.yml b/.github/workflows/generate_documentation.yml index e0f1883..2f4b363 100644 --- a/.github/workflows/generate_documentation.yml +++ b/.github/workflows/generate_documentation.yml @@ -16,13 +16,16 @@ jobs: - name: Set up Python uses: actions/setup-python@v3 with: - python-version: '3.x' # Specify your Python version + python-version: '3.9' # Specify your Python version - name: Install pdoc run: pip install pdoc3 # Install pdoc or pdoc3 - name: Install Dependencies - run: pip install -r requirements.txt # Install your dependencies + run: | + python -m pip install --upgrade pip + pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu + if [ -f requirements_workflow.txt ]; then pip install -r requirements_workflow.txt; fi - name: Generate Documentation run: | diff --git a/.github/workflows/python-test.yml b/.github/workflows/python-test.yml new file mode 100644 index 0000000..b6af766 --- /dev/null +++ b/.github/workflows/python-test.yml @@ -0,0 +1,33 @@ +name: Python Tests + +on: [push, pull_request] + +jobs: + test: + runs-on: ubuntu-latest + + strategy: + matrix: + python-version: [3.9, 3.10] + + steps: + - name: Checkout Repository + uses: actions/checkout@v3 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v3 + with: + python-version: ${{ matrix.python-version }} + + - name: Install pdoc + run: pip install pdoc3 # Install pdoc or pdoc3 + + - name: Install Dependencies + run: | + python -m pip install --upgrade pip + pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu + if [ -f requirements_workflow.txt ]; then pip install -r requirements_workflow.txt; fi + + - name: Run tests + run: | + pytest diff --git a/requirements.txt b/requirements.txt index 1fd8bba..42c194c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -12,4 +12,5 @@ pytorch-lightning zstandard simple-parsing nltk -scipy>=1.11.2 \ No newline at end of file +scipy>=1.11.2 +pytest \ No newline at end of file diff --git a/requirements_workflow.txt b/requirements_workflow.txt new file mode 100644 index 0000000..f708702 --- /dev/null +++ b/requirements_workflow.txt @@ -0,0 +1,15 @@ +numpy +transformers +datasets +matplotlib +tqdm +scikit-learn +openai +packaging +ninja +pytorch-lightning +zstandard +simple-parsing +nltk +scipy>=1.11.2 +pytest \ No newline at end of file