Improving test case #65
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: main | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
env: | |
OPENAI_API_KEY: demo | |
jobs: | |
check-branch: | |
if: ${{ github.event_name == 'pull_request' }} | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
concurrency: | |
group: check-pr-${{ github.ref }} | |
cancel-in-progress: true | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Check if the PR's branch is updated | |
uses: osl-incubator/[email protected] | |
with: | |
remote_branch: origin/main | |
pr_sha: ${{ github.event.pull_request.head.sha }} | |
tests: | |
timeout-minutes: 30 | |
strategy: | |
fail-fast: false | |
matrix: | |
python_version: | |
- "3.9" | |
- "3.10" | |
- "3.11" | |
- "3.12" | |
# note: srsly cannot be installed | |
# - "3.13" | |
os: | |
- "ubuntu" | |
- "macos" | |
- "windows" | |
exclude: | |
- os: windows | |
python_version: "3.9" | |
runs-on: ${{ matrix.os }}-latest | |
concurrency: | |
group: ci-tests-${{ matrix.os }}-${{ matrix.python_version }}-${{ github.ref }} | |
cancel-in-progress: true | |
defaults: | |
run: | |
shell: bash -l {0} | |
env: | |
OLLAMA_LLM_LIBRARY: cpu | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Cache ollama | |
uses: actions/cache@v4 | |
with: | |
path: ~/.ollama | |
key: ${{ matrix.os }}-ollama | |
- name: Setup ollama macos | |
if: ${{ matrix.os == 'macos' }} | |
uses: ai-action/setup-ollama@v1 | |
- uses: conda-incubator/setup-miniconda@v3 | |
with: | |
miniconda-version: latest | |
environment-file: conda/ci-ubuntu.yaml | |
channels: conda-forge,nodefaults | |
activate-environment: anamnesisai | |
auto-update-conda: true | |
conda-solver: libmamba | |
python-version: "${{ matrix.python_version }}" | |
- name: Create environment variables for tests | |
run: | | |
pushd tests | |
envsubst < .env.tpl > .env | |
popd | |
- name: Check Poetry lock | |
run: poetry check | |
- name: Install dependencies | |
run: | | |
poetry config virtualenvs.create false | |
poetry install | |
- name: Setup ollama linux/windows | |
if: ${{ matrix.os != 'macos' }} | |
run: | | |
ollama serve & | |
- name: Download llama model | |
run: | | |
sleep 20 | |
ollama pull llama3.2:1b | |
- name: Run unit tests (PR) | |
if: ${{ github.event_name == 'pull_request' }} | |
run: pytest -m "not skip_on_ci" -vvv | |
- name: Run unit tests (push) | |
if: ${{ github.event_name == 'push' }} | |
env: | |
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
run: makim tests.unit | |
- name: Test jupyter notebooks | |
run: makim tests.notebooks | |
linter: | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
defaults: | |
run: | |
shell: bash -l {0} | |
concurrency: | |
group: ci-linter-${{ matrix.os }}-${{ matrix.python_version }}-${{ github.ref }} | |
cancel-in-progress: true | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: conda-incubator/setup-miniconda@v3 | |
with: | |
miniforge-version: latest | |
environment-file: conda/ci-ubuntu.yaml | |
channels: conda-forge,nodefaults | |
activate-environment: anamnesisai | |
auto-update-conda: true | |
conda-solver: libmamba | |
python-version: "3.9" | |
- name: Install dependencies | |
run: | | |
poetry config virtualenvs.create false | |
poetry install | |
- name: Run style checks | |
if: success() || failure() | |
run: | | |
pre-commit install | |
makim tests.linter | |
- name: Setup tmate session | |
if: "${{ failure() && (contains(github.event.pull_request.labels.*.name, 'ci:enable-debugging')) }}" | |
uses: mxschmitt/action-tmate@v3 |