Skip to content

Commit

Permalink
cache model files for CI tests
Browse files Browse the repository at this point in the history
  • Loading branch information
var77 committed Oct 9, 2024
1 parent 19ff9c1 commit ad4c691
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
18 changes: 18 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -189,12 +189,30 @@ jobs:
run: |
sudo chmod 777 -R /usr/lib/postgresql/15/lib/
sudo chmod 777 -R /usr/share/postgresql/15/extension/
- name: Load model files from cache
id: cache-models
uses: actions/cache@v4
with:
path: "/tmp/lantern-embeddings-core-test"
key: "embedding-models-v1"
- name: Copy model files to necessarry locations
if: steps.cache-models.outputs.cache-hit == 'true'
run: |
sudo ln -S /tmp/lantern-embeddings-core-test "/etc/postgresql/${{ matrix.postgres }}/main/.ldb_extras_data"
sudo ln -S /tmp/lantern-embeddings-core-test "/var/lib/lantern-daemon"
sudo chown -R postgres:postgres "/etc/postgresql/${{ matrix.postgres }}/main/.ldb_extras_data"
- name: Run tests
run: cargo llvm-cov --workspace --lcov --output-path lantern-extras-lcov.info
env:
OPENAI_TOKEN: ${{ secrets.OPENAI_TOKEN }}
COHERE_TOKEN: ${{ secrets.COHERE_TOKEN }}
DB_URL: "postgres://[email protected]:5432/postgres"
- name: Save model files to cache
if: steps.cache-models.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: "/tmp/lantern-embeddings-core-test"
key: "embedding-models-v1"
- name: Upload lantern_extras coverage
uses: actions/upload-artifact@v4
if: ${{ startsWith(matrix.os, 'ubuntu') }}
Expand Down
2 changes: 1 addition & 1 deletion lantern_cli/src/embeddings/core/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ type GetResponseFn = Box<dyn Fn(Vec<u8>) -> Result<EmbeddingResult, anyhow::Erro

pub async fn download_file(url: &str, path: &PathBuf) -> Result<(), anyhow::Error> {
let client = reqwest::Client::builder()
.timeout(Duration::from_secs(300))
.timeout(Duration::from_secs(900))
.redirect(Policy::limited(2))
.build()?;

Expand Down

0 comments on commit ad4c691

Please sign in to comment.