Better caching #780
Workflow file for this run
This file contains 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: Run tests on pull requests | |
on: | |
pull_request: | |
branches: [main] | |
push: | |
branches: [main] | |
env: | |
OPENAI_API_KEY: dummy_key | |
jobs: | |
run-tests: | |
runs-on: ubuntu-latest | |
name: Run test suite (Python ${{ matrix.python-version }}) | |
strategy: | |
matrix: | |
python-version: [3.11, 3.12] | |
defaults: | |
run: | |
shell: bash -l {0} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Download Ollama | |
run: curl -fsSL https://ollama.com/install.sh | sh | |
- name: Pull Google's Gemma2 2B model | |
run: ollama pull gemma2:2b | |
- name: Setup Pixi Environment | |
uses: prefix-dev/setup-pixi@v0.8.1 | |
with: | |
pixi-version: latest | |
cache: true | |
cache-write: ${{ github.event_name == 'push' }} | |
- name: Run tests (pixi) | |
run: | | |
pixi run test | |
# https://github.com/codecov/codecov-action | |
- name: Upload code coverage | |
uses: codecov/codecov-action@v2 | |
with: | |
# fail_ci_if_error: true # optional (default = false) | |
verbose: true # optional (default = false) | |
smoke-tests: | |
runs-on: ubuntu-latest | |
name: Run smoke tests (Python ${{ matrix.python-version }}) | |
strategy: | |
matrix: | |
python-version: [3.11, 3.12] | |
environment-type: ['pixi', 'bare'] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup Pixi Environment | |
uses: prefix-dev/setup-pixi@v0.8.1 | |
if: ${{ matrix.environment-type == 'pixi' }} | |
with: | |
pixi-version: v0.25.0 | |
cache: true | |
cache-write: ${{ github.event_name == 'push' && github.ref_name == 'main' }} | |
- name: Setup uv | |
# Install latest uv version using the installer | |
run: curl -LsSf https://astral.sh/uv/install.sh | sh | |
- name: Set up Python | |
run: uv venv llamabot-env --python ${{ matrix.python-version }} | |
if: ${{ matrix.environment-type == 'bare' }} | |
- name: Test CLI (pixi) | |
if: matrix.environment-type == 'pixi' && github.repository_owner == 'ericmjl' | |
run: | | |
pixi run llamabot-cli | |
- name: Test CLI (bare) | |
if: matrix.environment-type == 'bare' && github.repository_owner == 'ericmjl' | |
run: | | |
source llamabot-env/bin/activate | |
uv pip install . | |
llamabot --help |