diff --git a/.github/workflows/pr_labeler.yml b/.github/workflows/pr_labeler.yml deleted file mode 100644 index 43182dd3..00000000 --- a/.github/workflows/pr_labeler.yml +++ /dev/null @@ -1,14 +0,0 @@ ---- -name: "PR Labeler" -on: - pull_request_target: - types: ["opened", "reopened", "ready_for_review"] -jobs: - triage: - permissions: - contents: read - pull-requests: write - runs-on: ubuntu-latest - steps: - - uses: actions/labeler@v5 - if: ${{ github.event.pull_request.draft == false }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index bab4f644..7ca42e12 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,104 +1,25 @@ ---- -name: test -on: - push: - branches: [master] - pull_request: - workflow_dispatch: -env: - POETRY_VERSION: "1.4.2" +name: Tests +on: [push] jobs: test: runs-on: ubuntu-latest - strategy: - matrix: - python-version: - - "3.8" - - "3.9" - - "3.10" - - "3.11" - test_type: - - "core" - - "extended" steps: - - uses: actions/checkout@v4 - - name: Set up Python ${{ matrix.python-version }} - uses: "snok/install-poetry@v1" - with: - python-version: ${{ matrix.python-version }} - poetry-version: "1.4.2" - cache-key: ${{ matrix.test_type }} - install-command: if [ "${{ matrix.test_type }}" == "core" ]; then echo "Running - core tests, installing dependencies with poetry..." poetry install else - echo "Running extended tests, installing dependencies with poetry..." - poetry install -E extended_testing fi - - name: Run ${{matrix.test_type}} tests + - uses: actions/checkout@v2 + - name: Install Python + uses: actions/setup-python@v4 + - name: Install Poetry + uses: snok/install-poetry@v1 + - name: Setup a local virtual environment run: | - if [ "${{ matrix.test_type }}" == "core" ]; then - make test - else - make extended_tests - fi - shell: bash - name: Python ${{ matrix.python-version }} ${{ matrix.test_type }} - steps: - - uses: actions/checkout@v4 - - name: Set up Python ${{ matrix.python-version }} - uses: "./.github/actions/poetry_setup" + poetry config virtualenvs.create true --local + poetry config virtualenvs.in-project true --local + - uses: actions/cache@v3 + name: Define a cache for the virtual environment + file with: - python-version: ${{ matrix.python-version }} - poetry-version: "1.4.2" - cache-key: ${{ matrix.test_type }} - install-command: | - if [ "${{ matrix.test_type }}" == "core" ]; then - echo "Running core tests, installing dependencies with poetry..." - poetry install - else - echo "Running extended tests, installing dependencies with poetry..." - poetry install -E extended_testing - fi - - name: Run ${{matrix.test_type}} tests - run: | - if [ "${{ matrix.test_type }}" == "core" ]; then - make test - else - make extended_tests - fi - shell: bash - build: - runs-on: ubuntu-latest - strategy: - matrix: - python-version: - - "3.8" - - "3.9" - - "3.10" - - "3.11" - test_type: - - "core" - - "extended" - name: Python ${{ matrix.python-version }} ${{ matrix.test_type }} - steps: - - uses: actions/checkout@v4 - - name: Set up Python ${{ matrix.python-version }} - uses: "./.github/actions/poetry_setup" - with: - python-version: ${{ matrix.python-version }} - poetry-version: "1.4.2" - cache-key: ${{ matrix.test_type }} - install-command: | - if [ "${{ matrix.test_type }}" == "core" ]; then - echo "Running core tests, installing dependencies with poetry..." - poetry install - else - echo "Running extended tests, installing dependencies with poetry..." - poetry install -E extended_testing - fi - - name: Run ${{matrix.test_type}} tests - run: | - if [ "${{ matrix.test_type }}" == "core" ]; then - make test - else - make extended_tests - fi - shell: bash + path: ./.venv + key: venv-${{ hashFiles('poetry.lock') }} + - name: Install the project dependencies + run: poetry install + - name: Run the tests + run: poetry run pytest diff --git a/.github/workflows/test_pr.yml b/.github/workflows/test_pr.yml deleted file mode 100644 index 1f982dff..00000000 --- a/.github/workflows/test_pr.yml +++ /dev/null @@ -1,80 +0,0 @@ ---- -# Notebook-related checks - -name: Presubmit checks -on: - # Relevant PRs - pull_request: - paths: - - "swarms/**" - - "tests/**" - # Allow manual runs - workflow_dispatch: -jobs: - test3_11: - name: Test Py3.11 - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - with: - python-version: '3.11' - - name: Run tests - run: | - python --version - pip install .[dev] - python -m pytest - test3_10: - name: Test Py3.10 - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - with: - python-version: '3.10' - - name: Run tests - run: | - python --version - pip install -q .[dev] - python -m pytest - test3_9: - name: Test Py3.9 - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - with: - python-version: '3.9' - - name: Run tests - run: | - python --version - pip install .[dev] - python -m pytest - pytype3_10: - name: pytype 3.10 - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - with: - python-version: '3.10' - - name: Run pytype - run: | - python --version - pip install .[dev] - pip install -q gspread ipython - pytype - format: - name: Check format with black - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - with: - python-version: '3.11' - - name: Check format - run: | - python --version - pip install -q . - pip install -q black - black . --check diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml deleted file mode 100644 index 554798ef..00000000 --- a/.github/workflows/testing.yml +++ /dev/null @@ -1,22 +0,0 @@ ---- -name: Unit Tests -on: - push: - branches: - - master -jobs: - test: - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v4 - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: "3.10" - - name: Install dependencies - run: | - pip install -r requirements.txt - pip install pytest - - name: Run unit tests - run: pytest diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml deleted file mode 100644 index 0aa7aeba..00000000 --- a/.github/workflows/unit-test.yml +++ /dev/null @@ -1,27 +0,0 @@ ---- -name: build -on: - push: - branches: [main] - pull_request: - branches: [main] -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Setup Python - uses: actions/setup-python@v5 - with: - python-version: '3.9' - - name: Install dependencies - run: | - pip install -r requirements.txt - pip install pytest - pip install swarms - - name: Run Python unit tests - run: pytest - - name: Verify that the Docker image for the action builds - run: docker build . --file Dockerfile - - name: Verify integration test results - run: pytest