diff --git a/.github/workflows/integration_test.yml b/.github/workflows/integration_test.yml index 42599bc8..b21b4f6a 100644 --- a/.github/workflows/integration_test.yml +++ b/.github/workflows/integration_test.yml @@ -19,55 +19,15 @@ concurrency: cancel-in-progress: true jobs: + pre-test: + uses: ./.github/workflows/integration_test_workflow.yml + test: - environment: integration_test strategy: - max-parallel: 1 matrix: python-version: ["3.10", "3.11", "3.12"] os: [ubuntu-latest, macos-latest, windows-latest] - runs-on: ${{ matrix.os }} - steps: - - uses: actions/checkout@v4 - - - name: Set up Python ${{ matrix.python-version }} - id: setup-python - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - - name: Install poetry - run: pip install -U poetry - - - name: Configure poetry - run: | - poetry config virtualenvs.create true - poetry config virtualenvs.in-project true - poetry config installer.parallel true - - - name: Load cached venv - id: cached-poetry-dependencies - uses: actions/cache@v4 - with: - path: .venv - key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }} - - - name: Load test cache - uses: actions/cache@v4 - with: - path: tests/itest_cache - key: tests-itest-cache - restore-keys: | - test-itest-cache - - - name: Install extra dependencies - run: poetry run pip install -r requirements-extra.txt - - - name: Install dependencies - run: poetry install --no-interaction --all-extras - - - name: Run integration tests - env: - OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} - TIKTOKEN_CACHE_DIR: tests/itest_cache/tiktoken_cache - run: poetry run python tests/run_integration_tests.py --os ${{ runner.os }} + uses: ./.github/workflows/integration_test_workflow.yml + with: + os: ${{ matrix.os }} + python-version: ${{ matrix.python-version }} diff --git a/.github/workflows/integration_test_minimal.yml b/.github/workflows/integration_test_minimal.yml index 7d5e1962..b94407fb 100644 --- a/.github/workflows/integration_test_minimal.yml +++ b/.github/workflows/integration_test_minimal.yml @@ -20,54 +20,12 @@ concurrency: jobs: test: - environment: integration_test strategy: - max-parallel: 1 matrix: python-version: ["3.10", "3.11", "3.12"] os: [ubuntu-latest, macos-latest, windows-latest] - runs-on: ${{ matrix.os }} - steps: - - uses: actions/checkout@v4 - - - name: Set up Python ${{ matrix.python-version }} - id: setup-python - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - - name: Install poetry - run: pip install -U poetry - - - name: Configure poetry - run: | - poetry config virtualenvs.create true - poetry config virtualenvs.in-project true - poetry config installer.parallel true - - - name: Load cached venv - id: cached-poetry-dependencies - uses: actions/cache@v4 - with: - path: .venv - key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }} - - - name: Load test cache - uses: actions/cache@v4 - with: - path: tests/itest_cache - key: tests-itest-cache - restore-keys: | - test-itest-cache - - - name: Install extra dependencies - run: poetry run pip install -r requirements-extra.txt - - - name: Install dependencies - run: poetry install --no-interaction - - - name: Run integration tests - env: - OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} - TIKTOKEN_CACHE_DIR: tests/itest_cache/tiktoken_cache - run: poetry run python tests/run_integration_tests.py --minimal-only --os ${{ runner.os }} + uses: ./.github/workflows/integration_test_workflow.yml + with: + os: ${{ matrix.os }} + python-version: ${{ matrix.python-version }} + minimal-only: true \ No newline at end of file diff --git a/.github/workflows/integration_test_workflow.yml b/.github/workflows/integration_test_workflow.yml new file mode 100644 index 00000000..c2435102 --- /dev/null +++ b/.github/workflows/integration_test_workflow.yml @@ -0,0 +1,76 @@ +name: Integration test workflow + +on: + workflow_call: + inputs: + os: + default: ubuntu-latest + type: string + python-version: + default: "3.10" + type: string + minimal-only: + default: false + type: boolean + +jobs: + integration_test: + environment: integration_test + runs-on: ${{ inputs.os }} + steps: + - uses: actions/checkout@v4 + + - name: Set up Python ${{ inputs.python-version }} + id: setup-python + uses: actions/setup-python@v4 + with: + python-version: ${{ inputs.python-version }} + + - name: Install poetry + run: pip install -U poetry + + - name: Configure poetry + run: | + poetry config virtualenvs.create true + poetry config virtualenvs.in-project true + poetry config installer.parallel true + + - name: Load cached venv + id: cached-poetry-dependencies + uses: actions/cache@v4 + with: + path: .venv + key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }} + + - name: Load test cache + uses: actions/cache@v4 + with: + path: tests/itest_cache + key: integration-tests-cache + restore-keys: | + integration-tests-cache + + - name: Install extra dependencies + run: poetry run pip install -r requirements-extra.txt + + - name: Install minimal dependencies + if: inputs.minimal_only == 'true' + run: poetry install --no-interaction + + - name: Install dependencies + if: inputs.minimal_only == 'false' + run: poetry install --no-interaction --all-extras + + - name: Run minimal integration tests + env: + OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} + TIKTOKEN_CACHE_DIR: tests/itest_cache/tiktoken_cache + if: inputs.minimal_only == 'true' + run: poetry run python tests/run_integration_tests.py --minimal-only --os ${{ runner.os }} + + - name: Run integration tests + env: + OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} + TIKTOKEN_CACHE_DIR: tests/itest_cache/tiktoken_cache + if: inputs.minimal_only == 'false' + run: poetry run python tests/run_integration_tests.py --os ${{ runner.os }}