mirror of
https://github.com/aljazceru/Auto-GPT.git
synced 2026-01-04 23:04:28 +01:00
Co-authored-by: Reinier van der Leer <github@pwuts.nl> Co-authored-by: Nicholas Tindle <nick@ntindle.com> Co-authored-by: Nicholas Tindle <nicktindle@outlook.com> Co-authored-by: k-boikov <64261260+k-boikov@users.noreply.github.com> Co-authored-by: merwanehamadi <merwanehamadi@gmail.com> Co-authored-by: Merwane Hamadi <merwanehamadi@gmail.com> Co-authored-by: Richard Beales <rich@richbeales.net> Co-authored-by: Luke K <2609441+lc0rp@users.noreply.github.com> Co-authored-by: Luke K (pr-0f3t) <2609441+lc0rp@users.noreply.github.com> Co-authored-by: Erik Peterson <e@eriklp.com> Co-authored-by: Auto-GPT-Bot <github-bot@agpt.co> Co-authored-by: Benny van der Lans <49377421+bfalans@users.noreply.github.com> Co-authored-by: Jan <jan-github@phobia.de> Co-authored-by: Robin Richtsfeld <robin.richtsfeld@gmail.com> Co-authored-by: Marc Bornträger <marc.borntraeger@gmail.com> Co-authored-by: Stefan Ayala <stefanayala3266@gmail.com> Co-authored-by: javableu <45064273+javableu@users.noreply.github.com> Co-authored-by: DGdev91 <DGdev91@users.noreply.github.com> Co-authored-by: Kinance <kinance@gmail.com> Co-authored-by: digger yu <digger-yu@outlook.com> Co-authored-by: David <scenaristeur@gmail.com> Co-authored-by: gravelBridge <john.tian31@gmail.com> Fix Python CI "update cassettes" step (#4591) fix CI (#4596) Fix inverted logic for deny_command (#4563) fix current_score.json generation (#4601) Fix duckduckgo rate limiting (#4592) Fix debug code challenge (#4632) Fix issues with information retrieval challenge a (#4622) fix issues with env configuration and .env.template (#4630) Fix prompt issue causing 'No Command' issues and challenge to fail (#4623) Fix benchmark logs (#4653) Fix typo in docs/setup.md (#4613) Fix run.sh shebang (#4561) Fix autogpt docker image not working because missing prompt_settings (#4680) Fix execute_command coming from plugins (#4730)
127 lines
3.8 KiB
YAML
127 lines
3.8 KiB
YAML
name: Docker CI
|
|
|
|
on:
|
|
push:
|
|
branches: [ master ]
|
|
paths-ignore:
|
|
- 'tests/Auto-GPT-test-cassettes'
|
|
- 'tests/challenges/current_score.json'
|
|
pull_request:
|
|
branches: [ master, release-*, stable ]
|
|
|
|
concurrency:
|
|
group: ${{ format('docker-ci-{0}', github.head_ref && format('pr-{0}', github.event.pull_request.number) || github.sha) }}
|
|
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
|
|
|
env:
|
|
IMAGE_NAME: auto-gpt
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
build-type: [release, dev]
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v2
|
|
|
|
- if: runner.debug
|
|
run: |
|
|
ls -al
|
|
du -hs *
|
|
|
|
- id: build
|
|
name: Build image
|
|
uses: docker/build-push-action@v3
|
|
with:
|
|
build-args: BUILD_TYPE=${{ matrix.build-type }}
|
|
tags: ${{ env.IMAGE_NAME }}
|
|
load: true # save to docker images
|
|
# cache layers in GitHub Actions cache to speed up builds
|
|
cache-from: type=gha,scope=docker-${{ matrix.build-type }}
|
|
cache-to: type=gha,scope=docker-${{ matrix.build-type }},mode=max
|
|
|
|
- name: Generate build report
|
|
env:
|
|
event_name: ${{ github.event_name }}
|
|
event_ref: ${{ github.event.ref }}
|
|
event_ref_type: ${{ github.event.ref}}
|
|
|
|
build_type: ${{ matrix.build-type }}
|
|
|
|
prod_branch: stable
|
|
dev_branch: master
|
|
repository: ${{ github.repository }}
|
|
base_branch: ${{ github.ref_name != 'master' && github.ref_name != 'stable' && 'master' || 'stable' }}
|
|
|
|
current_ref: ${{ github.ref_name }}
|
|
commit_hash: ${{ github.event.after }}
|
|
source_url: ${{ format('{0}/tree/{1}', github.event.repository.url, github.event.release && github.event.release.tag_name || github.sha) }}
|
|
push_forced_label: ${{ github.event.forced && '☢️ forced' || '' }}
|
|
|
|
new_commits_json: ${{ toJSON(github.event.commits) }}
|
|
compare_url_template: ${{ format('/{0}/compare/{{base}}...{{head}}', github.repository) }}
|
|
|
|
github_context_json: ${{ toJSON(github) }}
|
|
job_env_json: ${{ toJSON(env) }}
|
|
vars_json: ${{ toJSON(vars) }}
|
|
|
|
run: .github/workflows/scripts/docker-ci-summary.sh >> $GITHUB_STEP_SUMMARY
|
|
continue-on-error: true
|
|
|
|
# Docker setup needs fixing before this is going to work: #1843
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 30
|
|
needs: build
|
|
steps:
|
|
- name: Check out repository
|
|
uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0
|
|
submodules: true
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v2
|
|
|
|
- id: build
|
|
name: Build image
|
|
uses: docker/build-push-action@v3
|
|
with:
|
|
build-args: BUILD_TYPE=dev # include pytest
|
|
tags: ${{ env.IMAGE_NAME }}
|
|
load: true # save to docker images
|
|
# cache layers in GitHub Actions cache to speed up builds
|
|
cache-from: type=gha,scope=docker-dev
|
|
cache-to: type=gha,scope=docker-dev,mode=max
|
|
|
|
- id: test
|
|
name: Run tests
|
|
env:
|
|
PLAIN_OUTPUT: True
|
|
CI: true
|
|
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
|
|
run: |
|
|
set +e
|
|
test_output=$(
|
|
docker run --env CI --env OPENAI_API_KEY --entrypoint python ${{ env.IMAGE_NAME }} -m \
|
|
pytest -n auto --cov=autogpt --cov-branch --cov-report term-missing \
|
|
tests/unit tests/integration 2>&1
|
|
)
|
|
test_failure=$?
|
|
|
|
echo "$test_output"
|
|
|
|
cat << $EOF >> $GITHUB_STEP_SUMMARY
|
|
# Tests $([ $test_failure = 0 ] && echo '✅' || echo '❌')
|
|
\`\`\`
|
|
$test_output
|
|
\`\`\`
|
|
$EOF
|
|
|
|
exit $test_failure
|