-
Notifications
You must be signed in to change notification settings - Fork 4
72 lines (72 loc) · 2.44 KB
/
test.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
name: test
on:
push:
branches:
- main
- dev
pull_request:
branches:
- main
- dev
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, ubicloud-standard-2-arm]
postgres: [15]
steps:
- uses: actions/checkout@v4
with:
submodules: "recursive"
- name: Setup Rust
run: rustup toolchain install stable --profile minimal --no-self-update
- name: Configure sccache
run: |
echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV
echo "SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV
- name: Run sccache-cache
uses: mozilla-actions/[email protected]
- name: Cache cargo deps
uses: Swatinem/rust-cache@v2
with:
workspaces: |
lantern_cli
lantern_extras
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Setup test env
run: sudo su -c "PG_VERSION=$PG_VERSION SETUP_POSTGRES=1 SETUP_TESTS=1 ./ci/scripts/build.sh"
env:
PG_VERSION: ${{ matrix.postgres }}
- name: Install extension
run: |
cargo install cargo-pgrx --version 0.11.3
cargo pgrx init "--pg$PG_VERSION" /usr/bin/pg_config
RUSTFLAGS="--cfg profile=\"ci-build\"" cargo pgrx install --sudo --pg-config /usr/bin/pg_config --package lantern_extras
env:
PG_VERSION: ${{ matrix.postgres }}
- name: Run postgres
run: RUN_POSTGRES=1 ./ci/scripts/build.sh
env:
PG_VERSION: ${{ matrix.postgres }}
- name: Setup permissions
run: |
sudo chmod 777 -R /usr/lib/postgresql/15/lib/
sudo chmod 777 -R /usr/share/postgresql/15/extension/
- name: Run tests
run: cargo llvm-cov --workspace --lcov --output-path lcov.info
env:
OPENAI_TOKEN: ${{ secrets.OPENAI_TOKEN }}
COHERE_TOKEN: ${{ secrets.COHERE_TOKEN }}
DB_URL: "postgres://[email protected]:5432/postgres"
- name: Upload coverage to Codecov
env:
codecov_token: ${{ secrets.CODECOV_TOKEN }}
uses: codecov/[email protected]
if: ${{ env.codecov_token != '' && startsWith(matrix.os, 'ubuntu') }} # for now run only on once
with:
token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos
files: lcov.info
fail_ci_if_error: true