cicd, yamllint

pull/187/head
evelynmitchell 1 year ago
parent 399099ef67
commit 78b46efc94

@ -1,2 +1,2 @@
[flake8] [flake8]
extend-ignore = E501, W292, W291 extend-ignore = E501, W292, W291, W293

@ -1,13 +1,14 @@
---
# These are supported funding model platforms # These are supported funding model platforms
github: [kyegomez] github: [kyegomez]
patreon: # Replace with a single Patreon username # patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username # open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username # ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel # tidelift: # Replace with a single Tidelift platform-name/package-name
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry # community_bridge: # Replace with a single Community Bridge project-name
liberapay: # Replace with a single Liberapay username # liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username # issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username # otechie: # Replace with a single Otechie username
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry # lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name
custom: #Nothing # custom: #Nothing

@ -1,3 +1,4 @@
---
# https://docs.github.com/en/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/configuration-options-for-dependency-updates # https://docs.github.com/en/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/configuration-options-for-dependency-updates
version: 2 version: 2
@ -11,4 +12,3 @@ updates:
directory: "/" directory: "/"
schedule: schedule:
interval: "weekly" interval: "weekly"

@ -1,12 +1,14 @@
---
# this is a config file for the github action labeler # this is a config file for the github action labeler
# Add 'label1' to any changes within 'example' folder or any subfolders # Add 'label1' to any changes within 'example' folder or any subfolders
example_change: example_change:
- example/** - example/**
# Add 'label2' to any file changes within 'example2' folder # Add 'label2' to any file changes within 'example2' folder
example2_change: example2/* example2_change: example2/*
# Add label3 to any change to .txt files within the entire repository. Quotation marks are required for the leading asterisk # Add label3 to any change to .txt files within the entire repository.
# Quotation marks are required for the leading asterisk
text_files: text_files:
- '**/*.txt' - '**/*.txt'

@ -1,30 +0,0 @@
name: Linting and Formatting
on:
push:
branches:
- master
jobs:
lint_and_format:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.x
- name: Install dependencies
run: pip install -r requirements.txt
- name: Find Python files
run: find swarms -name "*.py" -type f -exec autopep8 --in-place --aggressive --aggressive {} +
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}

@ -1,42 +0,0 @@
name: Continuous Integration
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@v4
with:
python-version: 3.x
- name: Install dependencies
run: pip install -r requirements.txt
- name: Run unit tests
run: pytest tests/unit
- name: Run integration tests
run: pytest tests/integration
- name: Run code coverage
run: pytest --cov=swarms tests/
- name: Run linters
run: pylint swarms
- name: Build documentation
run: make docs
- name: Validate documentation
run: sphinx-build -b linkcheck docs build/docs
- name: Run performance tests
run: find ./tests -name '*.py' -exec pytest {} \;

@ -1,18 +1,19 @@
---
name: Docker Image CI name: Docker Image CI
on: on: # yamllint disable-line rule:truthy
push: push:
branches: [ "master" ] branches: ["master"]
pull_request: pull_request:
branches: [ "master" ] branches: ["master"]
jobs: jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
name: Build Docker image
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Build the Docker image - name: Build the Docker image
run: docker build . --file Dockerfile --tag my-image-name:$(date +%s) run: docker build . --file Dockerfile --tag my-image-name:$(date +%s)

@ -1,28 +0,0 @@
name: Documentation 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@v4
with:
python-version: 3.x
- name: Install dependencies
run: pip install -r requirements.txt
- name: Build documentation
run: make docs
- name: Validate documentation
run: sphinx-build -b linkcheck docs build/docs

@ -1,66 +0,0 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow lets you generate SLSA provenance file for your project.
# The generation satisfies level 3 for the provenance requirements - see https://slsa.dev/spec/v0.1/requirements
# The project is an initiative of the OpenSSF (openssf.org) and is developed at
# https://github.com/slsa-framework/slsa-github-generator.
# The provenance file can be verified using https://github.com/slsa-framework/slsa-verifier.
# For more information about SLSA and how it improves the supply-chain, visit slsa.dev.
name: SLSA generic generator
on:
workflow_dispatch:
release:
types: [created]
jobs:
build:
runs-on: ubuntu-latest
outputs:
digests: ${{ steps.hash.outputs.digests }}
steps:
- uses: actions/checkout@v3
# ========================================================
#
# Step 1: Build your artifacts.
#
# ========================================================
- name: Build artifacts
run: |
# These are some amazing artifacts.
echo "artifact1" > artifact1
echo "artifact2" > artifact2
# ========================================================
#
# Step 2: Add a step to generate the provenance subjects
# as shown below. Update the sha256 sum arguments
# to include all binaries that you generate
# provenance for.
#
# ========================================================
- name: Generate subject for provenance
id: hash
run: |
set -euo pipefail
# List the artifacts the provenance will refer to.
files=$(ls artifact*)
# Generate the subjects (base64 encoded).
echo "hashes=$(sha256sum $files | base64 -w0)" >> "${GITHUB_OUTPUT}"
provenance:
needs: [build]
permissions:
actions: read # To read the workflow path.
id-token: write # To sign the provenance.
contents: write # To add assets to a release.
uses: slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml@v1.4.0
with:
base64-subjects: "${{ needs.build.outputs.digests }}"
upload-assets: true # Optional: Upload to a new release

@ -1,19 +1,29 @@
---
# This is a basic workflow to help you get started with Actions # This is a basic workflow to help you get started with Actions
name: Lint name: Lint
on: [push, pull_request] on: [push, pull_request] # yamllint disable-line rule:truthy
jobs: jobs:
yaml-lint:
runs-on: ubuntu-latest
steps:
- name: Check out source repository
uses: actions/checkout@v4
- name: yaml Lint
uses: ibiqlik/action-yamllint@v3
flake8-lint: flake8-lint:
runs-on: ubuntu-latest runs-on: ubuntu-latest
name: Lint name: flake8 Lint
steps: steps:
- name: Check out source repository - name: Check out source repository
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Set up Python environment - name: Set up Python environment
uses: actions/setup-python@v4 uses: py-actions/flake8@v2
with: ruff-lint:
python-version: "3.11" runs-on: ubuntu-latest
- name: flake8 Lint name: ruff Lint
uses: py-actions/flake8@v2 steps:
- uses: actions/checkout@v4
- uses: chartboost/ruff-action@v1

@ -1,25 +0,0 @@
name: Linting
on:
push:
branches:
- master
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.x
- name: Install dependencies
run: pip install -r requirements.txt
- name: Run linters
run: pylint swarms

@ -1,27 +0,0 @@
name: Makefile CI
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: configure
run: ./configure
- name: Install dependencies
run: make
- name: Run check
run: make check
- name: Run distcheck
run: make distcheck

@ -1,3 +1,4 @@
---
name: Pull Request Checks name: Pull Request Checks
on: on:
@ -24,4 +25,4 @@ jobs:
- name: Run tests and checks - name: Run tests and checks
run: | run: |
find tests/ -name "*.py" | xargs pytest find tests/ -name "*.py" | xargs pytest
pylint swarms pylint swarms

@ -1,23 +0,0 @@
name: Pylint
on: [push]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pylint
- name: Analysing the code with pylint
run: |
pylint $(git ls-files '*.py')

@ -1,46 +0,0 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow integrates Pyre with GitHub's
# Code Scanning feature.
#
# Pyre is a performant type checker for Python compliant with
# PEP 484. Pyre can analyze codebases with millions of lines
# of code incrementally providing instantaneous feedback
# to developers as they write code.
#
# See https://pyre-check.org
name: Pyre
on:
workflow_dispatch:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
permissions:
contents: read
jobs:
pyre:
permissions:
actions: read
contents: read
security-events: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Run Pyre
uses: facebook/pyre-action@60697a7858f7cc8470d8cc494a3cf2ad6b06560d
with:
# To customize these inputs:
# See https://github.com/facebook/pyre-action#inputs
repo-directory: './'
requirements-path: 'requirements.txt'

@ -1,39 +0,0 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: Python application
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
pytest

@ -1,7 +1,7 @@
---
name: Upload Python Package name: Upload Python Package
on: on: # yamllint disable-line rule:truthy
release: release:
types: [published] types: [published]
@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Set up Python - name: Set up Python
uses: actions/setup-python@v4 uses: actions/setup-python@v4
@ -29,4 +29,4 @@ jobs:
uses: pypa/gh-action-pypi-publish@b7f401de30cb6434a1e19f805ff006643653240e uses: pypa/gh-action-pypi-publish@b7f401de30cb6434a1e19f805ff006643653240e
with: with:
user: __token__ user: __token__
password: ${{ secrets.PYPI_API_TOKEN }} password: ${{ secrets.PYPI_API_TOKEN }}

@ -1,23 +0,0 @@
name: Quality
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
jobs:
lint:
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- name: Checkout actions
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Init environment
uses: ./.github/actions/init-environment
- name: Run linter
run: |
pylint `git diff --name-only --diff-filter=d origin/master HEAD | grep -E '\.py$' | tr '\n' ' '`

@ -1,8 +0,0 @@
name: Ruff
on: [ push, pull_request ]
jobs:
ruff:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: chartboost/ruff-action@v1

@ -1,23 +0,0 @@
name: Python application test
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Run tests with pytest
run: |
find tests/ -name "*.py" | xargs pytest

@ -1,3 +1,4 @@
---
name: test name: test
on: on:
@ -9,7 +10,67 @@ on:
env: env:
POETRY_VERSION: "1.4.2" POETRY_VERSION: "1.4.2"
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
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"
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: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: strategy:

@ -1,3 +1,4 @@
---
version: 2 version: 2
build: build:
@ -10,4 +11,4 @@ mkdocs:
python: python:
install: install:
- requirements: requirements.txt - requirements: requirements.txt

@ -0,0 +1,4 @@
rules:
line-length:
level: warning
allow-non-breakable-inline-mappings: true

@ -1,3 +1,4 @@
---
site_name: Swarms Docs site_name: Swarms Docs
plugins: plugins:
- glightbox - glightbox
@ -19,15 +20,15 @@ extra:
- icon: fontawesome/brands/python - icon: fontawesome/brands/python
link: https://pypi.org/project/Swarms/ link: https://pypi.org/project/Swarms/
theme: theme:
name: material name: material
custom_dir: docs/overrides custom_dir: docs/overrides
logo: assets/img/SwarmsLogoIcon.png logo: assets/img/SwarmsLogoIcon.png
palette: palette:
# Palette toggle for light mode # Palette toggle for light mode
- scheme: default - scheme: default
primary: black primary: black
toggle: toggle:
icon: material/brightness-7 icon: material/brightness-7
name: Switch to dark mode name: Switch to dark mode
# Palette toggle for dark mode # Palette toggle for dark mode
- scheme: slate - scheme: slate
@ -35,14 +36,14 @@ theme:
toggle: toggle:
icon: material/brightness-4 icon: material/brightness-4
name: Switch to light mode name: Switch to light mode
features: features:
- content.code.copy - content.code.copy
- content.code.annotate - content.code.annotate
- navigation.tabs - navigation.tabs
- navigation.sections - navigation.sections
- navigation.expand - navigation.expand
- navigation.top - navigation.top
- announce.dismiss - announce.dismiss
markdown_extensions: markdown_extensions:
- pymdownx.highlight: - pymdownx.highlight:
anchor_linenums: true anchor_linenums: true
@ -58,25 +59,25 @@ markdown_extensions:
- def_list - def_list
- footnotes - footnotes
nav: nav:
- Home: - Home:
- Overview: "index.md" - Overview: "index.md"
- Contributing: "contributing.md" - Contributing: "contributing.md"
- Docker Container Setup: "docker_setup.md" - Docker Container Setup: "docker_setup.md"
- Swarms: - Swarms:
- Overview: "swarms/index.md" - Overview: "swarms/index.md"
- swarms.swarms: - swarms.swarms:
- AbstractSwarm: "swarms/swarms/abstractswarm.md" - AbstractSwarm: "swarms/swarms/abstractswarm.md"
- GodMode: "swarms/swarms/godmode.md" - GodMode: "swarms/swarms/godmode.md"
- Groupchat: "swarms/swarms/groupchat.md" - Groupchat: "swarms/swarms/groupchat.md"
- swarms.workers: - swarms.workers:
- Overview: "swarms/workers/index.md" - Overview: "swarms/workers/index.md"
- AbstractWorker: "swarms/workers/abstract_worker.md" - AbstractWorker: "swarms/workers/abstract_worker.md"
- swarms.agents: - swarms.agents:
- AbstractAgent: "swarms/agents/abstract_agent.md" - AbstractAgent: "swarms/agents/abstract_agent.md"
- OmniModalAgent: "swarms/agents/omni_agent.md" - OmniModalAgent: "swarms/agents/omni_agent.md"
- swarms.models: - swarms.models:
- Language: - Language:
- Overview: "swarms/models/index.md" - Overview: "swarms/models/index.md"
- HuggingFaceLLM: "swarms/models/huggingface.md" - HuggingFaceLLM: "swarms/models/huggingface.md"
- Anthropic: "swarms/models/anthropic.md" - Anthropic: "swarms/models/anthropic.md"
- OpenAI: "swarms/models/openai.md" - OpenAI: "swarms/models/openai.md"
@ -84,54 +85,54 @@ nav:
- BioGPT: "swarms/models/biogpt.md" - BioGPT: "swarms/models/biogpt.md"
- MPT7B: "swarms/models/mpt.md" - MPT7B: "swarms/models/mpt.md"
- Mistral: "swarms/models/mistral.md" - Mistral: "swarms/models/mistral.md"
- MultiModal: - MultiModal:
- Fuyu: "swarms/models/fuyu.md" - Fuyu: "swarms/models/fuyu.md"
- Vilt: "swarms/models/vilt.md" - Vilt: "swarms/models/vilt.md"
- Idefics: "swarms/models/idefics.md" - Idefics: "swarms/models/idefics.md"
- BingChat: "swarms/models/bingchat.md" - BingChat: "swarms/models/bingchat.md"
- Kosmos: "swarms/models/kosmos.md" - Kosmos: "swarms/models/kosmos.md"
- Nougat: "swarms/models/nougat.md" - Nougat: "swarms/models/nougat.md"
- Dalle3: "swarms/models/dalle3.md" - Dalle3: "swarms/models/dalle3.md"
- GPT4V: "swarms/models/gpt4v.md" - GPT4V: "swarms/models/gpt4v.md"
- LayoutLMDocumentQA: "swarms/models/layoutlm_document_qa.md" - LayoutLMDocumentQA: "swarms/models/layoutlm_document_qa.md"
- DistilWhisperModel: "swarms/models/distilled_whisperx.md" - DistilWhisperModel: "swarms/models/distilled_whisperx.md"
- ElevenLabsText2SpeechTool: "swarms/models/elevenlabs.md" - ElevenLabsText2SpeechTool: "swarms/models/elevenlabs.md"
- swarms.structs: - swarms.structs:
- Overview: "swarms/structs/overview.md" - Overview: "swarms/structs/overview.md"
- AutoScaler: "swarms/swarms/autoscaler.md" - AutoScaler: "swarms/swarms/autoscaler.md"
- Flow: "swarms/structs/flow.md" - Flow: "swarms/structs/flow.md"
- SequentialWorkflow: 'swarms/structs/sequential_workflow.md' - SequentialWorkflow: 'swarms/structs/sequential_workflow.md'
- swarms.memory: - swarms.memory:
- PineconeVectorStoreStore: "swarms/memory/pinecone.md" - PineconeVectorStoreStore: "swarms/memory/pinecone.md"
- PGVectorStore: "swarms/memory/pg.md" - PGVectorStore: "swarms/memory/pg.md"
# - swarms.chunkers: # - swarms.chunkers:
# - BaseChunker: "swarms/chunkers/basechunker.md" # - BaseChunker: "swarms/chunkers/basechunker.md"
# - PdfChunker: "swarms/chunkers/pdf_chunker.md" # - PdfChunker: "swarms/chunkers/pdf_chunker.md"
- Guides: - Guides:
- Overview: "examples/index.md" - Overview: "examples/index.md"
- Agents: - Agents:
- Flow: "examples/flow.md" - Flow: "examples/flow.md"
- SequentialWorkflow: "examples/reliable_autonomous_agents.md" - SequentialWorkflow: "examples/reliable_autonomous_agents.md"
- OmniAgent: "examples/omni_agent.md" - OmniAgent: "examples/omni_agent.md"
- 2O+ Autonomous Agent Blogs: "examples/ideas.md" - 2O+ Autonomous Agent Blogs: "examples/ideas.md"
- Applications: - Applications:
- CustomerSupport: - CustomerSupport:
- Overview: "applications/customer_support.md" - Overview: "applications/customer_support.md"
- Marketing: - Marketing:
- Overview: "applications/marketing_agencies.md" - Overview: "applications/marketing_agencies.md"
- Corporate: - Corporate:
- FAQ: "corporate/faq.md" - FAQ: "corporate/faq.md"
- Purpose: "corporate/purpose.md" - Purpose: "corporate/purpose.md"
- Roadmap: "corporate/roadmap.md" - Roadmap: "corporate/roadmap.md"
- Weaknesses: "corporate/failures.md" - Weaknesses: "corporate/failures.md"
- Design: "corporate/design.md" - Design: "corporate/design.md"
- Flywheel: "corporate/flywheel.md" - Flywheel: "corporate/flywheel.md"
- Bounties: "corporate/bounties.md" - Bounties: "corporate/bounties.md"
- Metric: "corporate/metric.md" - Metric: "corporate/metric.md"
- Distribution: "corporate/distribution" - Distribution: "corporate/distribution"
- Research: "corporate/research.md" - Research: "corporate/research.md"
- Demos: "corporate/demos.md" - Demos: "corporate/demos.md"
- Architecture: "corporate/architecture.md" - Architecture: "corporate/architecture.md"
- Checklist: "corporate/checklist.md" - Checklist: "corporate/checklist.md"
- Hiring: "corporate/hiring.md" - Hiring: "corporate/hiring.md"
- SwarmCloud: "corporate/swarm_cloud.md" - SwarmCloud: "corporate/swarm_cloud.md"

Loading…
Cancel
Save