AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.
ci(agent): Matrix CI tests across Linux, macOS and Windows (#7029)
Reinier van der Leerdde0c70a8138
diff --git a/.github/workflows/autogpt-ci.yml b/.github/workflows/autogpt-ci.ymlindex bd32028c46..0e7ba31a04 100644--- a/.github/workflows/autogpt-ci.yml+++ b/.github/workflows/autogpt-ci.yml@@ -20,6 +20,7 @@ concurrency:defaults:run:+ shell: bashworking-directory: autogpts/autogptjobs:@@ -77,22 +78,41 @@ jobs:test:permissions:contents: read- runs-on: ubuntu-latesttimeout-minutes: 30strategy:+ fail-fast: falsematrix:python-version: ["3.10"]-- services:- minio:- image: minio/minio:edge-cicd- ports:- - 9000:9000- options: >- --health-interval=10s --health-timeout=5s --health-retries=3- --health-cmd="curl -f http://localhost:9000/minio/health/live"+ platform-os: [ubuntu, macos, windows]+ runs-on: ${{ matrix.platform-os }}-lateststeps:+ # Quite slow on macOS (2~4 minutes to set up Docker)+ # - name: Set up Docker (macOS)+ # if: runner.os == 'macOS'+ # uses: crazy-max/ghaction-setup-docker@v3++ - name: Start MinIO service (Linux)+ if: runner.os == 'Linux'+ working-directory: '.'+ run: |+ docker pull minio/minio:edge-cicd+ docker run -d -p 9000:9000 minio/minio:edge-cicd++ - name: Start MinIO service (macOS)+ if: runner.os == 'macOS'+ working-directory: ${{ runner.temp }}+ run: |+ brew install minio/stable/minio+ mkdir data+ minio server ./data &++ # No MinIO on Windows:+ # - Windows doesn't support running Linux Docker containers+ # - It doesn't seem possible to start background processes on Windows. They are+ # killed after the step returns.+ # See: https://github.com/actions/runner/issues/598#issuecomment-2011890429+- name: Checkout repositoryuses: actions/checkout@v4with:@@ -147,13 +167,30 @@ jobs:- name: Set up Python dependency cacheuses: actions/cache@v4with:- path: ~/.cache/pypoetry- key: ${{ runner.os }}-poetry-${{ hashFiles('autogpts/autogpt/pyproject.toml') }}-${{ steps.get_date.outputs.date }}+ path: ${{ runner.os == 'Windows' && 'C:\Users\runneradmin\AppData\Local\pypoetry\Cache' || '~/.cache/pypoetry' }}+ key: poetry-${{ runner.os }}-${{ hashFiles('autogpts/autogpt/poetry.lock') }}- - name: Install Python dependencies+ - name: Install Poetry (Unix)+ if: runner.os != 'Windows'run: |curl -sSL https://install.python-poetry.org | python3 -- poetry install++ if [ "${{ runner.os }}" = "macOS" ]; then+ PATH="$HOME/.local/bin:$PATH"+ echo "$HOME/.local/bin" >> $GITHUB_PATH+ fi++ - name: Install Poetry (Windows)+ if: runner.os == 'Windows'+ shell: pwsh+ run: |+ (Invoke-WebRequest -Uri https://install.python-poetry.org -UseBasicParsing).Content | python -++ $env:PATH += ";$env:APPDATA\Python\Scripts"+ echo "$env:APPDATA\Python\Scripts" >> $env:GITHUB_PATH++ - name: Install Python dependencies+ run: poetry install- name: Run pytest with coveragerun: |@@ -165,7 +202,7 @@ jobs:CI: truePLAIN_OUTPUT: TrueOPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}- S3_ENDPOINT_URL: http://localhost:9000+ S3_ENDPOINT_URL: ${{ runner.os != 'Windows' && 'http://127.0.0.1:9000' || '' }}AWS_ACCESS_KEY_ID: minioadminAWS_SECRET_ACCESS_KEY: minioadmin@@ -173,6 +210,7 @@ jobs:uses: codecov/codecov-action@v4with:token: ${{ secrets.CODECOV_TOKEN }}+ flags: autogpt-agent,${{ runner.os }}- id: setup_git_authname: Set up git token authentication@@ -180,7 +218,11 @@ jobs:if: success() || failure()run: |config_key="http.${{ github.server_url }}/.extraheader"- base64_pat=$(echo -n "pat:${{ secrets.PAT_REVIEW }}" | base64 -w0)+ if [ "${{ runner.os }}" = 'macOS' ]; then+ base64_pat=$(echo -n "pat:${{ secrets.PAT_REVIEW }}" | base64)+ else+ base64_pat=$(echo -n "pat:${{ secrets.PAT_REVIEW }}" | base64 -w0)+ figit config "$config_key" \"Authorization: Basic $base64_pat"@@ -241,7 +283,7 @@ jobs:echo "Adding label and comment..."echo $TOKEN | gh auth login --with-tokengh issue edit $PR_NUMBER --add-label "behaviour change"- gh issue comment $PR_NUMBER --body "You changed AutoGPT's behaviour. The cassettes have been updated and will be merged to the submodule when this Pull Request gets merged."+ gh issue comment $PR_NUMBER --body "You changed AutoGPT's behaviour on ${{ runner.os }}. The cassettes have been updated and will be merged to the submodule when this Pull Request gets merged."fi- name: Upload logs to artifactdiff --git a/autogpts/autogpt/tests/unit/test_s3_file_storage.py b/autogpts/autogpt/tests/unit/test_s3_file_storage.pyindex d58490d807..2544a3e9d4 100644--- a/autogpts/autogpt/tests/unit/test_s3_file_storage.py+++ b/autogpts/autogpt/tests/unit/test_s3_file_storage.py@@ -8,7 +8,7 @@ from botocore.exceptions import ClientErrorfrom autogpt.file_storage.s3 import S3FileStorage, S3FileStorageConfiguration-if not os.getenv("S3_ENDPOINT_URL") and not os.getenv("AWS_ACCESS_KEY_ID"):+if not (os.getenv("S3_ENDPOINT_URL") and os.getenv("AWS_ACCESS_KEY_ID")):pytest.skip("S3 environment variables are not set", allow_module_level=True)