FoundationAgents/MetaGPT

5 workflows · maturity 17% · 2 patterns · GitHub ↗

Security 0/100

Practices

✓ Matrix○ Permissions○ Security scan○ AI review○ Cache○ Concurrency○ Reusable workflows

Detected patterns

Security dimensions

permissions
0
security scan
0
supply chain
0
secret handling
0
harden runner
0

Workflows (5)

build-package .github/workflows/build-package.yaml
Triggers
workflow_dispatch, release
Runs on
ubuntu-latest
Jobs
deploy
Commands
  • python -m pip install --upgrade pip pip install -r requirements.txt pip install -e. pip install setuptools wheel twine
  • export VERSION="${GITHUB_REF#refs/tags/v}" sed -i "s/version=.*/version=\"${VERSION}\",/" setup.py
  • python setup.py bdist_wheel sdist twine upload dist/*
View raw YAML
name: Build and upload python package

on:
  workflow_dispatch:
  release:
    types: [created, published]

jobs:
  deploy:
    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v4
    - name: Set up Python
      uses: actions/setup-python@v4
      with:
        python-version: '3.9'
        cache: 'pip'
    - name: Install dependencies
      run: |
        python -m pip install --upgrade pip
        pip install -r requirements.txt
        pip install -e.
        pip install setuptools wheel twine
    - name: Set package version
      run: |
        export VERSION="${GITHUB_REF#refs/tags/v}"
        sed -i "s/version=.*/version=\"${VERSION}\",/" setup.py
    - name: Build and publish
      env:
        TWINE_USERNAME: __token__
        TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
      run: |
        python setup.py bdist_wheel sdist
        twine upload dist/*
fulltest matrix .github/workflows/fulltest.yaml
Triggers
workflow_dispatch, pull_request_target, push
Runs on
ubuntu-latest
Jobs
build
Matrix
python-version→ 3.9
Commands
  • python -m pip install --upgrade pip pip install -e .[test] npm install -g @mermaid-js/mermaid-cli playwright install --with-deps
  • echo "Run \"ssh $(whoami)@FPR_SERVER_HOST -p FPR_SSH_REMOTE_PORT\" and \"cd $(pwd)\"" mkdir -p ~/.ssh/ echo $RSA_PUB >> ~/.ssh/authorized_keys chmod 600 ~/.ssh/authorized_keys wget https://github.com/fatedier/frp/releases/download/v0.32.1/frp_0.32.1_linux_amd64.tar.gz -O frp.tar.gz tar xvzf frp.tar.gz -C /opt mv /opt/frp* /opt/frp /opt/frp/frpc tcp --server_addr $FPR_SERVER_ADDR --token $FPR_TOKEN --local_port $SSH_PORT --remote_port $FPR_SSH_REMOTE_PORT
  • export ALLOW_OPENAI_API_CALL=0 echo "${{ secrets.METAGPT_KEY_YAML }}" | base64 -d > config/key.yaml mkdir -p ~/.metagpt && echo "${{ secrets.METAGPT_CONFIG2_YAML }}" | base64 -d > ~/.metagpt/config2.yaml pytest tests/ --doctest-modules --cov=./metagpt/ --cov-report=xml:cov.xml --cov-report=html:htmlcov --durations=20 | tee unittest.txt
  • coverage report -m
  • grep -E "FAILED tests|ERROR tests|[0-9]+ passed," unittest.txt failed_count=$(grep -E "FAILED|ERROR" unittest.txt | wc -l) if [[ "$failed_count" -gt 0 ]]; then echo "$failed_count failed lines found! Task failed." exit 1 fi
View raw YAML
name: Full Tests

on:
  workflow_dispatch:
  pull_request_target:
  push: 
    branches:
      - 'main'
      - 'dev'
      - '*-release'
      - '*-debugger'

jobs:
  build:
    runs-on: ubuntu-latest
    environment: unittest
    strategy:
      matrix:
        # python-version: ['3.9', '3.10', '3.11']
        python-version: ['3.9']

    steps:
    - uses: actions/checkout@v4
      with:
        ref: ${{ github.event.pull_request.head.sha }}
    - name: Set up Python ${{ matrix.python-version }}
      uses: actions/setup-python@v4
      with:
        python-version: ${{ matrix.python-version }}
        cache: 'pip'
    - name: Install dependencies
      run: |
        python -m pip install --upgrade pip
        pip install -e .[test]
        npm install -g @mermaid-js/mermaid-cli
        playwright install --with-deps
    - name: Run reverse proxy script for ssh service
      if: contains(github.ref, '-debugger')
      continue-on-error: true
      env:
        FPR_SERVER_ADDR: ${{ secrets.FPR_SERVER_ADDR }}
        FPR_TOKEN: ${{ secrets.FPR_TOKEN }}
        FPR_SSH_REMOTE_PORT: ${{ secrets.FPR_SSH_REMOTE_PORT }}
        RSA_PUB: ${{ secrets.RSA_PUB }}
        SSH_PORT: ${{ vars.SSH_PORT || '22'}}
      run: |
        echo "Run \"ssh $(whoami)@FPR_SERVER_HOST -p FPR_SSH_REMOTE_PORT\" and \"cd $(pwd)\""
        mkdir -p  ~/.ssh/
        echo $RSA_PUB >> ~/.ssh/authorized_keys
        chmod 600 ~/.ssh/authorized_keys
        wget https://github.com/fatedier/frp/releases/download/v0.32.1/frp_0.32.1_linux_amd64.tar.gz -O frp.tar.gz
        tar xvzf frp.tar.gz -C /opt
        mv /opt/frp* /opt/frp
        /opt/frp/frpc tcp --server_addr $FPR_SERVER_ADDR --token $FPR_TOKEN  --local_port $SSH_PORT  --remote_port $FPR_SSH_REMOTE_PORT
    - name: Test with pytest
      run: |
        export ALLOW_OPENAI_API_CALL=0
        echo "${{ secrets.METAGPT_KEY_YAML }}" | base64 -d > config/key.yaml
        mkdir -p ~/.metagpt && echo "${{ secrets.METAGPT_CONFIG2_YAML }}" | base64 -d > ~/.metagpt/config2.yaml
        pytest tests/ --doctest-modules --cov=./metagpt/ --cov-report=xml:cov.xml --cov-report=html:htmlcov --durations=20 | tee unittest.txt
    - name: Show coverage report
      run: |
        coverage report -m
    - name: Show failed tests and overall summary
      run: |
        grep -E "FAILED tests|ERROR tests|[0-9]+ passed," unittest.txt
        failed_count=$(grep -E "FAILED|ERROR" unittest.txt | wc -l)
        if [[ "$failed_count" -gt 0 ]]; then
          echo "$failed_count failed lines found! Task failed."
          exit 1
        fi
    - name: Upload pytest test results
      uses: actions/upload-artifact@v3
      with:
        name: pytest-results-${{ matrix.python-version }}
        path: |
          ./unittest.txt
          ./htmlcov/
          ./tests/data/rsp_cache_new.json
        retention-days: 3
      if: ${{ always() }}
    # - name: Upload coverage reports to Codecov
    #   uses: codecov/codecov-action@v3
    #   env:
    #     CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
    #   if: ${{ always() }}
pre-commit .github/workflows/pre-commit.yaml
Triggers
pull_request, push
Runs on
ubuntu-latest
Jobs
pre-commit-check
Commands
  • pip install pre-commit
  • pre-commit install
  • pre-commit run --all-files
View raw YAML
name: Pre-commit checks

on:
  pull_request:
    branches:
      - '**'
  push: 
    branches: 
      - '**'
          
jobs:
  pre-commit-check:
    runs-on: ubuntu-latest
    environment: pre-commit
    steps:
    - name: Checkout Source Code
      uses: actions/checkout@v2

    - name: Setup Python
      uses: actions/setup-python@v2
      with:
        python-version: '3.9.17'
        
    - name: Install pre-commit
      run: pip install pre-commit
      
    - name: Initialize pre-commit
      run: pre-commit install
      
    - name: Run pre-commit hooks
      run: pre-commit run --all-files
stale .github/workflows/stale.yaml
Triggers
schedule
Runs on
ubuntu-latest
Jobs
close-issues
Actions
actions/stale
View raw YAML
name: Close inactive issues
on:
  schedule:
    - cron: "5 0 * * *"

jobs:
  close-issues:
    runs-on: ubuntu-latest
    permissions:
      issues: write
      pull-requests: write
    steps:
      - uses: actions/stale@v5
        with:
          days-before-issue-stale: 30
          days-before-issue-close: 14
          stale-issue-label: "inactive"
          stale-issue-message: "This issue has no activity in the past 30 days. Please comment on the issue if you have anything to add."
          close-issue-message: "This issue was closed due to 45 days of inactivity. If you feel this issue is still relevant, please reopen the issue to continue the discussion."
          days-before-pr-stale: -1
          days-before-pr-close: -1
          repo-token: ${{ secrets.GITHUB_TOKEN }}
unittest matrix .github/workflows/unittest.yaml
Triggers
pull_request_target, push
Runs on
ubuntu-22.04
Jobs
build
Matrix
python-version→ 3.9
Commands
  • python -m pip install --upgrade pip pip install -e .[test] npm install -g @mermaid-js/mermaid-cli playwright install --with-deps
  • export ALLOW_OPENAI_API_CALL=0 mkdir -p ~/.metagpt && cp tests/config2.yaml ~/.metagpt/config2.yaml pytest | tee unittest.txt
  • coverage report -m
  • grep -E "FAILED tests|ERROR tests|[0-9]+ passed," unittest.txt failed_count=$(grep -E "FAILED tests|ERROR tests" unittest.txt | wc -l | tr -d '[:space:]') if [[ $failed_count -gt 0 ]]; then echo "$failed_count failed lines found! Task failed." exit 1 fi
View raw YAML
name: Unit Tests

on:
  pull_request_target:
  push: 
    branches:
      - 'main'
      - 'dev'
      - '*-release'

jobs:
  build:
    runs-on: ubuntu-22.04
    strategy:
      matrix:
        # python-version: ['3.9', '3.10', '3.11']
        python-version: ['3.9']

    steps:
    - uses: actions/checkout@v4
      with:
        ref: ${{ github.event.pull_request.head.sha }}
    - name: Set up Python ${{ matrix.python-version }}
      uses: actions/setup-python@v4
      with:
        python-version: ${{ matrix.python-version }}
        cache: 'pip'
    - name: Install dependencies
      run: |
        python -m pip install --upgrade pip
        pip install -e .[test]
        npm install -g @mermaid-js/mermaid-cli
        playwright install --with-deps
    - name: Test with pytest
      run: |
        export ALLOW_OPENAI_API_CALL=0
        mkdir -p ~/.metagpt && cp tests/config2.yaml ~/.metagpt/config2.yaml
        pytest | tee unittest.txt
    - name: Show coverage report
      run: |
        coverage report -m
    - name: Show failed tests and overall summary
      run: |
        grep -E "FAILED tests|ERROR tests|[0-9]+ passed," unittest.txt
        failed_count=$(grep -E "FAILED tests|ERROR tests" unittest.txt | wc -l | tr -d '[:space:]')
        if [[ $failed_count -gt 0 ]]; then
          echo "$failed_count failed lines found! Task failed."
          exit 1
        fi
    - name: Upload pytest test results
      uses: actions/upload-artifact@v4
      with:
        name: pytest-results-${{ matrix.python-version }}
        path: |
          ./unittest.txt
          ./htmlcov/
          ./tests/data/rsp_cache_new.json
        retention-days: 3
      if: ${{ always() }}