From 3e6ba5ed37e52c74d42117415e75bfe0974c60bd Mon Sep 17 00:00:00 2001 From: Anshuman Suri Date: Wed, 10 Jan 2024 09:34:07 -0500 Subject: [PATCH] Reusable workflow --- ...te_documentation.yml => documentation.yml} | 20 ++----------------- .../{python-test.yml => setup_env.yml} | 11 ++++------ .github/workflows/test.yml | 12 +++++++++++ 3 files changed, 18 insertions(+), 25 deletions(-) rename .github/workflows/{generate_documentation.yml => documentation.yml} (53%) rename .github/workflows/{python-test.yml => setup_env.yml} (85%) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/generate_documentation.yml b/.github/workflows/documentation.yml similarity index 53% rename from .github/workflows/generate_documentation.yml rename to .github/workflows/documentation.yml index 2943da9..5c928bc 100644 --- a/.github/workflows/generate_documentation.yml +++ b/.github/workflows/documentation.yml @@ -1,4 +1,4 @@ -name: Generate and Deploy Documentation +name: Documentation on: push: @@ -8,25 +8,9 @@ on: jobs: build-documentation: runs-on: ubuntu-latest + uses: ./.github/workflows/setup_env.yml steps: - - name: Checkout Repository - uses: actions/checkout@v3 - - - name: Set up Python - uses: actions/setup-python@v3 - with: - python-version: '3.9' # Specify your 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: Generate Documentation run: | rm -r docs/ diff --git a/.github/workflows/python-test.yml b/.github/workflows/setup_env.yml similarity index 85% rename from .github/workflows/python-test.yml rename to .github/workflows/setup_env.yml index 3152a4e..5b35503 100644 --- a/.github/workflows/python-test.yml +++ b/.github/workflows/setup_env.yml @@ -1,9 +1,10 @@ -name: Python Tests +name: Setup environment -on: [push, pull_request] +on: + workflow_call: jobs: - test: + env_setup: runs-on: ubuntu-latest steps: @@ -23,7 +24,3 @@ jobs: 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/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..483d511 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,12 @@ +name: Tests + +on: [push, pull_request] + +jobs: + test: + runs-on: ubuntu-latest + uses: ./.github/workflows/setup_env.yml + + - name: Run tests + run: | + pytest