Skip to content

Commit

Permalink
CI: Create a github action which runs rust-tests (#1)
Browse files Browse the repository at this point in the history
This pipeline builds the packages and runs all rust-tests.
These are mainly unit-tests.

The `lsps-server` requires to have a dummy database for testing.
This database is created in the pipeline before running the tests
  • Loading branch information
ErikDeSmedt authored Mar 6, 2024
1 parent 2ec2d3a commit 421294c
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/test-rust.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: rust-unit-tests
run-name: $${ github.actor }} - Unit Tests
on: [push]
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: Create Sqlite database
uses: actions-rs/cargo@v1
with:
command: install
args: sqlx-cli
- run: make db
- uses: actions-rs/cargo@v1
with:
command: test
args: --workspace --all-features

2 changes: 0 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,5 @@ members = [
]

[dependencies]
lsps-client = { path = "plugins/lsps-client/" }
lsps-server = { path = "plugins/lsps-server/" }
lsp-primitives = {path = "libs/lsp-primitives"}
cln-lsps = {path = "libs/cln-lsps" }
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ all: lsps-server lsps-client
base:
mkdir -p build/plugins

# Initiates a database that is used for testing
db: plugins/lsps-server/data/lsp_server.db

plugins/lsps-server/data/lsp_server.db:
mkdir -p plugins/lsps-server/data
sqlx database create --database-url sqlite:plugins/lsps-server/data/lsp_server.db
Expand Down

0 comments on commit 421294c

Please sign in to comment.