Skip to content

Commit

Permalink
Merge pull request #53 from CoLearn-Dev/support-macos
Browse files Browse the repository at this point in the history
Support macOS - instant server default redis, CI update
  • Loading branch information
stneng authored Feb 14, 2023
2 parents 6a129d7 + 3772403 commit b5b552e
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 26 deletions.
39 changes: 21 additions & 18 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,33 +8,33 @@ name: check

jobs:
check:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
strategy:
matrix:
mq: [standalone, rabbitmq, redis]
ci_image: [ubuntu-latest, macos-latest]
include:
- mq: rabbitmq
docker_image: "rabbitmq:3.8-management"
mq_uri: "amqp://guest:guest@localhost"
mq_api: "http://guest:guest@localhost:15672/api"
mq_uri: "amqp://guest:guest@127.0.0.1"
mq_api: "http://guest:guest@127.0.0.1:15672/api"
- mq: redis
docker_image: "redis"
mq_uri: "redis://localhost:16379"
services:
mq:
image: ${{ matrix.docker_image }}
ports:
- 5672:5672 # rabbitmq
- 15672:15672 # rabbitmq
- 16379:6379 # redis
redis: # for storage macro
image: redis
ports:
- 6379:6379
mq_uri: "redis://127.0.0.1:16379"
runs-on: ${{ matrix.ci_image }}
defaults:
run:
shell: bash
steps:
- name: Install docker
if: ${{ startsWith(matrix.ci_image, 'macos') }}
run: |
brew install docker
colima start
- name: Start container (mq)
if: ${{ matrix.mq != 'standalone' }}
run: docker run -d -p 5672:5672 -p 15672:15672 -p 16379:6379 ${{ matrix.docker_image }}
- name: Start container (redis) # for storage macro
run: docker run -d -p 6379:6379 redis
- name: Checkout
uses: actions/checkout@v3
with:
Expand All @@ -45,12 +45,15 @@ jobs:
toolchain: stable
components: rustfmt, clippy
- name: Check
if: ${{ startsWith(matrix.ci_image, 'ubuntu') }} # skip check in macos because it is slow
run: cargo check --release
- name: Build
run: cargo build --all-targets
- name: Format check
if: ${{ startsWith(matrix.ci_image, 'ubuntu') }}
run: cargo fmt --all -- --check
- name: Clippy test
if: ${{ startsWith(matrix.ci_image, 'ubuntu') }}
run: cargo clippy --profile test -- -D warnings -D clippy::dbg_macro
- name: Download Server
run: bash download-server.sh
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "colink"
version = "0.3.1"
version = "0.3.2"
edition = "2021"
description = "CoLink Rust SDK"
license = "MIT"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ CoLink SDK helps both application and protocol developers access the functionali
Add this to your Cargo.toml:
```toml
[dependencies]
colink = "0.3.1"
colink = "0.3.2"
```

## Getting Started
Expand Down
2 changes: 1 addition & 1 deletion src/extensions/instant_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ impl InstantServer {
.arg("bash -c \"$(curl -fsSL https://raw.githubusercontent.com/CoLearn-Dev/colinkctl/main/install_colink.sh)\"")
.env("COLINK_INSTALL_SERVER_ONLY", "true")
.env("COLINK_INSTALL_SILENT", "true")
.env("COLINK_SERVER_VERSION", "v0.3.1")
.env("COLINK_SERVER_VERSION", "v0.3.2")
.status()
.unwrap();
}
Expand Down
8 changes: 6 additions & 2 deletions tests/download-server.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
set -e
rm -rf colink-server
mkdir colink-server && cd colink-server
wget https://github.com/CoLearn-Dev/colink-server-dev/releases/download/v0.3.1/colink-server-linux-x86_64.tar.gz
tar -xzf colink-server-linux-x86_64.tar.gz
PACKAGE_NAME="colink-server-linux-x86_64.tar.gz"
if [ "$(uname)" == "Darwin" ]; then
PACKAGE_NAME="colink-server-macos-x86_64.tar.gz"
fi
wget https://github.com/CoLearn-Dev/colink-server-dev/releases/download/v0.3.2/$PACKAGE_NAME
tar -xzf $PACKAGE_NAME
touch user_init_config.toml # create an empty user init config to prevent automatically starting protocols when importing users.
cd ..
6 changes: 3 additions & 3 deletions tests/test_storage_macro.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ async fn test_storage_macro_redis() -> Result<(), Box<dyn std::error::Error + Se
{
let (_ir, _is, cl) = set_up_test_env_single_user().await?;

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

cl.create_entry(
"test_storage_macro_redis_append:redis_url",
b"redis://localhost",
b"redis://127.0.0.1",
)
.await?;
let key_name = "test_storage_macro_redis_append:$redis:redis_key";
Expand Down Expand Up @@ -122,7 +122,7 @@ async fn test_storage_macro_redis_chunk(

cl.create_entry(
"test_storage_macro_redis_chunk:redis_url",
b"redis://localhost",
b"redis://127.0.0.1",
)
.await?;
let key_name = "test_storage_macro_redis_chunk:$redis:redis_chunk:$chunk";
Expand Down

0 comments on commit b5b552e

Please sign in to comment.