Skip to content

Commit b5b552e

Browse files
authored
Merge pull request #53 from CoLearn-Dev/support-macos
Support macOS - instant server default redis, CI update
2 parents 6a129d7 + 3772403 commit b5b552e

File tree

6 files changed

+33
-26
lines changed

6 files changed

+33
-26
lines changed

.github/workflows/check.yml

+21-18
Original file line numberDiff line numberDiff line change
@@ -8,33 +8,33 @@ name: check
88

99
jobs:
1010
check:
11-
runs-on: ubuntu-latest
12-
defaults:
13-
run:
14-
shell: bash
1511
strategy:
1612
matrix:
1713
mq: [standalone, rabbitmq, redis]
14+
ci_image: [ubuntu-latest, macos-latest]
1815
include:
1916
- mq: rabbitmq
2017
docker_image: "rabbitmq:3.8-management"
21-
mq_uri: "amqp://guest:guest@localhost"
22-
mq_api: "http://guest:guest@localhost:15672/api"
18+
mq_uri: "amqp://guest:guest@127.0.0.1"
19+
mq_api: "http://guest:guest@127.0.0.1:15672/api"
2320
- mq: redis
2421
docker_image: "redis"
25-
mq_uri: "redis://localhost:16379"
26-
services:
27-
mq:
28-
image: ${{ matrix.docker_image }}
29-
ports:
30-
- 5672:5672 # rabbitmq
31-
- 15672:15672 # rabbitmq
32-
- 16379:6379 # redis
33-
redis: # for storage macro
34-
image: redis
35-
ports:
36-
- 6379:6379
22+
mq_uri: "redis://127.0.0.1:16379"
23+
runs-on: ${{ matrix.ci_image }}
24+
defaults:
25+
run:
26+
shell: bash
3727
steps:
28+
- name: Install docker
29+
if: ${{ startsWith(matrix.ci_image, 'macos') }}
30+
run: |
31+
brew install docker
32+
colima start
33+
- name: Start container (mq)
34+
if: ${{ matrix.mq != 'standalone' }}
35+
run: docker run -d -p 5672:5672 -p 15672:15672 -p 16379:6379 ${{ matrix.docker_image }}
36+
- name: Start container (redis) # for storage macro
37+
run: docker run -d -p 6379:6379 redis
3838
- name: Checkout
3939
uses: actions/checkout@v3
4040
with:
@@ -45,12 +45,15 @@ jobs:
4545
toolchain: stable
4646
components: rustfmt, clippy
4747
- name: Check
48+
if: ${{ startsWith(matrix.ci_image, 'ubuntu') }} # skip check in macos because it is slow
4849
run: cargo check --release
4950
- name: Build
5051
run: cargo build --all-targets
5152
- name: Format check
53+
if: ${{ startsWith(matrix.ci_image, 'ubuntu') }}
5254
run: cargo fmt --all -- --check
5355
- name: Clippy test
56+
if: ${{ startsWith(matrix.ci_image, 'ubuntu') }}
5457
run: cargo clippy --profile test -- -D warnings -D clippy::dbg_macro
5558
- name: Download Server
5659
run: bash download-server.sh

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "colink"
3-
version = "0.3.1"
3+
version = "0.3.2"
44
edition = "2021"
55
description = "CoLink Rust SDK"
66
license = "MIT"

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ CoLink SDK helps both application and protocol developers access the functionali
99
Add this to your Cargo.toml:
1010
```toml
1111
[dependencies]
12-
colink = "0.3.1"
12+
colink = "0.3.2"
1313
```
1414

1515
## Getting Started

src/extensions/instant_server.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ impl InstantServer {
4848
.arg("bash -c \"$(curl -fsSL https://raw.githubusercontent.com/CoLearn-Dev/colinkctl/main/install_colink.sh)\"")
4949
.env("COLINK_INSTALL_SERVER_ONLY", "true")
5050
.env("COLINK_INSTALL_SILENT", "true")
51-
.env("COLINK_SERVER_VERSION", "v0.3.1")
51+
.env("COLINK_SERVER_VERSION", "v0.3.2")
5252
.status()
5353
.unwrap();
5454
}

tests/download-server.sh

+6-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@
22
set -e
33
rm -rf colink-server
44
mkdir colink-server && cd colink-server
5-
wget https://github.com/CoLearn-Dev/colink-server-dev/releases/download/v0.3.1/colink-server-linux-x86_64.tar.gz
6-
tar -xzf colink-server-linux-x86_64.tar.gz
5+
PACKAGE_NAME="colink-server-linux-x86_64.tar.gz"
6+
if [ "$(uname)" == "Darwin" ]; then
7+
PACKAGE_NAME="colink-server-macos-x86_64.tar.gz"
8+
fi
9+
wget https://github.com/CoLearn-Dev/colink-server-dev/releases/download/v0.3.2/$PACKAGE_NAME
10+
tar -xzf $PACKAGE_NAME
711
touch user_init_config.toml # create an empty user init config to prevent automatically starting protocols when importing users.
812
cd ..

tests/test_storage_macro.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ async fn test_storage_macro_redis() -> Result<(), Box<dyn std::error::Error + Se
1919
{
2020
let (_ir, _is, cl) = set_up_test_env_single_user().await?;
2121

22-
cl.create_entry("storage_macro_test_redis:redis_url", b"redis://localhost")
22+
cl.create_entry("storage_macro_test_redis:redis_url", b"redis://127.0.0.1")
2323
.await?;
2424
let key_name = "storage_macro_test_redis:$redis:redis_key";
2525
test_crud(&cl, key_name).await?;
@@ -92,7 +92,7 @@ async fn test_storage_macro_redis_append(
9292

9393
cl.create_entry(
9494
"test_storage_macro_redis_append:redis_url",
95-
b"redis://localhost",
95+
b"redis://127.0.0.1",
9696
)
9797
.await?;
9898
let key_name = "test_storage_macro_redis_append:$redis:redis_key";
@@ -122,7 +122,7 @@ async fn test_storage_macro_redis_chunk(
122122

123123
cl.create_entry(
124124
"test_storage_macro_redis_chunk:redis_url",
125-
b"redis://localhost",
125+
b"redis://127.0.0.1",
126126
)
127127
.await?;
128128
let key_name = "test_storage_macro_redis_chunk:$redis:redis_chunk:$chunk";

0 commit comments

Comments
 (0)