Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 85 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches: [main]
pull_request:
workflow_dispatch:

env:
CARGO_TERM_COLOR: always
Expand All @@ -20,25 +21,106 @@ jobs:
components: clippy
- uses: Swatinem/rust-cache@v2
- run: cargo clippy --workspace --all-targets -- -D warnings
- run: cargo clippy -p codegraph-graph --features postgres,mysql,redis --tests -- -D warnings

test:
name: test (${{ matrix.os }})
runs-on: ${{ matrix.os }}
services:
redis:
image: redis:7-alpine
ports: ["6379:6379"]
options: --health-cmd "redis-cli ping" --health-interval 10s --health-timeout 5s --health-retries 3
postgres:
image: postgres:16-alpine
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: codegraph
ports: ["5432:5432"]
options: --health-cmd "pg_isready -U postgres" --health-interval 10s --health-timeout 5s --health-retries 3
mysql:
image: mysql:8
env:
MYSQL_ROOT_PASSWORD: postgres
MYSQL_DATABASE: codegraph
ports: ["3306:3306"]
options: --health-cmd "mysqladmin ping -h 127.0.0.1 -u root -ppostgres" --health-interval 10s --health-timeout 5s --health-retries 3
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: llvm-tools-preview
- uses: Swatinem/rust-cache@v2
- run: cargo test --workspace --no-fail-fast
- name: Install DB clients
run: sudo apt-get update && sudo apt-get install -y postgresql-client mysql-client
- name: Apply schema (postgres)
run: |
psql "postgres://postgres:postgres@127.0.0.1:5432/codegraph" -f sql/postgres/001-initial-schema.sql
psql "postgres://postgres:postgres@127.0.0.1:5432/codegraph" -f sql/postgres/002-add-repos-registry.sql
- name: Apply schema (mysql)
run: |
mysql -h 127.0.0.1 -P 3306 -u root -ppostgres codegraph < sql/mysql/001-initial-schema.sql
mysql -h 127.0.0.1 -P 3306 -u root -ppostgres codegraph < sql/mysql/002-add-repos-registry.sql
- name: Install grcov
uses: taiki-e/install-action@grcov
- name: Run tests with coverage instrumentation
env:
RUSTFLAGS: "-Cinstrument-coverage"
LLVM_PROFILE_FILE: "codegraph-%p-%m.profraw"
run: cargo test --workspace --no-fail-fast
- name: Storage integration tests (postgres)
env:
RUSTFLAGS: "-Cinstrument-coverage"
LLVM_PROFILE_FILE: "codegraph-%p-%m.profraw"
TEST_RDBMS_DSN: "postgres://postgres:postgres@127.0.0.1:5432/codegraph"
TEST_RDBMS_REPO_ID: "1"
run: cargo test -p codegraph-graph --features postgres --test rdbms -- --ignored --nocapture --test-threads=1
- name: Storage integration tests (mysql)
env:
RUSTFLAGS: "-Cinstrument-coverage"
LLVM_PROFILE_FILE: "codegraph-%p-%m.profraw"
TEST_RDBMS_DSN: "mysql://root:postgres@127.0.0.1:3306/codegraph"
TEST_RDBMS_REPO_ID: "1"
run: cargo test -p codegraph-graph --features mysql --test rdbms -- --ignored --nocapture --test-threads=1
- name: Storage integration tests (redis)
env:
RUSTFLAGS: "-Cinstrument-coverage"
LLVM_PROFILE_FILE: "codegraph-%p-%m.profraw"
TEST_REDIS_DSN: "redis://127.0.0.1:6379"
run: cargo test -p codegraph-graph --features redis --test redis -- --ignored --nocapture
- name: Generate coverage report (lcov)
run: |
mkdir -p ./target/coverage
grcov . \
--binary-path ./target/debug/ \
--source-dir . \
--output-type lcov \
--branch \
--ignore-not-existing \
--ignore "/*" \
--ignore "*/tests/*" \
--ignore "*/benches/*" \
--output-path ./target/coverage/lcov.info

- name: Upload to Codecov
uses: codecov/codecov-action@v5
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
files: ./target/coverage/lcov.info
verbose: true
fail_ci_if_error: false

slim:
name: slim build (no visualize)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
Expand Down
124 changes: 0 additions & 124 deletions .github/workflows/integration.yml

This file was deleted.

Loading
Loading