Skip to content

Commit

Permalink
added test ci/cd
Browse files Browse the repository at this point in the history
  • Loading branch information
lvboudre committed Nov 21, 2024
1 parent d3bb446 commit 06db832
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 4 deletions.
32 changes: 29 additions & 3 deletions .github/workflows/release.yml → .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
name: Release worfklow
name: Test worfklow

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand All @@ -19,7 +19,7 @@ env:
CARGO_TERM_COLOR: always

jobs:
release:
check:
strategy:
matrix:
os: [ubuntu-22.04]
Expand Down Expand Up @@ -67,4 +67,30 @@ jobs:
run: cargo check --all-targets --tests --all-features

- name: Set PROTOC environment variable in order to build
run: echo "PROTOC=/usr/bin/protoc" >> $GITHUB_ENV
run: echo "PROTOC=/usr/bin/protoc" >> $GITHUB_ENV

test:
needs: check
runs-on: ubuntu-22.04
services:
etcd:
image: quay.io/coreos/etcd:v3.5.6
ports:
- 2379:2379
- 2380:2380
options: >-
--name test-etcd
--data-dir /etcd-data
--advertise-client-urls http://127.0.0.1:2379
--listen-client-urls http://0.0.0.0:2379
steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Set cargo
uses: dtolnay/[email protected]

- name: Run tests
env:
ETCD_TEST_URL: http://127.0.0.1:2379
run: cargo test --test -- --nocapture
4 changes: 3 additions & 1 deletion tests/common.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
pub async fn get_etcd_client() -> etcd_client::Client {
etcd_client::Client::connect(["http://localhost:2379"], None)

let url = option_env!("ETCD_TEST_URL").unwrap_or("http://localhost:2379");
etcd_client::Client::connect([url], None)
.await
.expect("failed to connect to etcd")
}
Expand Down

0 comments on commit 06db832

Please sign in to comment.