mirror of
https://github.com/aljazceru/dev-gpt.git
synced 2025-12-24 09:04:19 +01:00
116 lines
3.4 KiB
YAML
116 lines
3.4 KiB
YAML
name: CI
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
pull_request:
|
|
|
|
jobs:
|
|
test_cognitive_level:
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
group: [0, 1, 2, 3, 4]
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- name: Set up Python 3.8
|
|
uses: actions/setup-python@v2
|
|
with:
|
|
python-version: 3.8
|
|
- name: Prepare environment
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
python -m pip install wheel
|
|
pip install --no-cache-dir ".[full,test]"
|
|
pip install pytest
|
|
pip install pytest-split
|
|
- name: Test
|
|
id: test
|
|
run: |
|
|
pytest -vs test/integration/test_generator.py::test_generation_level_${{ matrix.group }}
|
|
timeout-minutes: 15
|
|
env:
|
|
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
|
|
SCENEX_API_KEY: ${{ secrets.SCENEX_API_KEY }}
|
|
WHISPER_API_KEY: ${{ secrets.WHISPER_API_KEY }}
|
|
|
|
test_unit:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- name: Set up Python 3.8
|
|
uses: actions/setup-python@v2
|
|
with:
|
|
python-version: 3.8
|
|
- name: Prepare environment
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
python -m pip install wheel
|
|
pip install --no-cache-dir ".[full,test]"
|
|
pip install pytest
|
|
pip install pytest-split
|
|
- name: Test
|
|
id: test
|
|
run: |
|
|
pytest -vs test/unit
|
|
timeout-minutes: 15
|
|
env:
|
|
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
|
|
SCENEX_API_KEY: ${{ secrets.SCENEX_API_KEY }}
|
|
WHISPER_API_KEY: ${{ secrets.WHISPER_API_KEY }}
|
|
|
|
base-image-push:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout Repository
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Check if code relevant to executor has changed
|
|
uses: dorny/paths-filter@v2
|
|
id: check
|
|
with:
|
|
filters: |
|
|
changed:
|
|
- src/options/generate/static_files/base_image/**
|
|
|
|
- name: Get base image tag
|
|
if: steps.check.outputs.changed == 'true'
|
|
shell: bash
|
|
run: |
|
|
FILE='src/constants.py'
|
|
VERSION=$(sed -n '/DOCKER_BASE_IMAGE_VERSION =/p' $FILE | cut -d \' -f2)
|
|
echo "VERSION=$VERSION" >> $GITHUB_ENV
|
|
|
|
- name: Check that tag isn't used already for the docker base image
|
|
if: steps.check.outputs.changed == 'true'
|
|
env:
|
|
VERSION: ${{ env.VERSION }}
|
|
shell: bash
|
|
run: |
|
|
if docker pull jinaai/gpt-dev:$VERSION; then
|
|
echo "Executor version/tag is used already. Please update the tag"
|
|
exit 1
|
|
else
|
|
echo "Executor version/tag isn't used already, continue to build..."
|
|
fi
|
|
|
|
- name: Set up Docker Buildx
|
|
if: steps.check.outputs.changed == 'true'
|
|
uses: docker/setup-buildx-action@v1
|
|
|
|
- name: Login to Docker Hub
|
|
if: steps.check.outputs.changed == 'true'
|
|
uses: docker/login-action@v1
|
|
with:
|
|
username: ${{ secrets.DOCKERHUB_DEVBOT_USER }}
|
|
password: ${{ secrets.DOCKERHUB_DEVBOT_PWD }}
|
|
|
|
- name: Build and Push Docker Image
|
|
if: steps.check.outputs.changed == 'true'
|
|
uses: docker/build-push-action@v2
|
|
with:
|
|
context: src/options/generate/static_files/base_image
|
|
push: true
|
|
tags: jinaai/gpt-dev:${{ env.VERSION }}
|
|
|