From e19fd9fa5ccaabe43e7315da67ccfe2045cba6a3 Mon Sep 17 00:00:00 2001 From: stneng Date: Sat, 11 Feb 2023 15:27:59 +0000 Subject: [PATCH 01/13] add CI for macos --- .github/workflows/check.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 1fbd7ab..5b5dbaf 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -8,13 +8,10 @@ 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" @@ -23,6 +20,10 @@ jobs: - mq: redis docker_image: "redis" mq_uri: "redis://localhost:16379" + runs-on: ${{ matrix.ci_image }} + defaults: + run: + shell: bash services: mq: image: ${{ matrix.docker_image }} From bcaa8f130249eb8c4c7b8455a818374e3e14d434 Mon Sep 17 00:00:00 2001 From: stneng Date: Sat, 11 Feb 2023 15:28:33 +0000 Subject: [PATCH 02/13] bump server version to 0.3.2 --- src/extensions/instant_server.rs | 2 +- tests/download-server.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/extensions/instant_server.rs b/src/extensions/instant_server.rs index bf26b0f..ff3de6d 100644 --- a/src/extensions/instant_server.rs +++ b/src/extensions/instant_server.rs @@ -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(); } diff --git a/tests/download-server.sh b/tests/download-server.sh index cdb34d8..8994ae3 100755 --- a/tests/download-server.sh +++ b/tests/download-server.sh @@ -2,7 +2,7 @@ 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 +wget https://github.com/CoLearn-Dev/colink-server-dev/releases/download/v0.3.2/colink-server-linux-x86_64.tar.gz tar -xzf colink-server-linux-x86_64.tar.gz touch user_init_config.toml # create an empty user init config to prevent automatically starting protocols when importing users. cd .. From cd5242d4ed78c5616148c93c8bce886306fb6449 Mon Sep 17 00:00:00 2001 From: stneng Date: Sun, 12 Feb 2023 02:02:55 +0000 Subject: [PATCH 03/13] fix CI workflow --- .github/workflows/check.yml | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 5b5dbaf..3aaee16 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -24,18 +24,17 @@ jobs: defaults: run: shell: bash - 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 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 -p 5672:5672 -p 15672:15672 -p 16379:6379 ${{ matrix.docker_image }} + - name: Start container (redis) # for storage macro + run: docker run -p 6379:6379 redis - name: Checkout uses: actions/checkout@v3 with: From f4bd56c4f210859e03df0587bddb0921efdb3b12 Mon Sep 17 00:00:00 2001 From: stneng Date: Sun, 12 Feb 2023 02:04:27 +0000 Subject: [PATCH 04/13] fix CI workflow --- .github/workflows/check.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 3aaee16..c89e933 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -32,9 +32,9 @@ jobs: colima start - name: Start container (mq) if: ${{ matrix.mq != 'standalone' }} - run: docker run -p 5672:5672 -p 15672:15672 -p 16379:6379 ${{ matrix.docker_image }} + 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 -p 6379:6379 redis + run: docker run -d -p 6379:6379 redis - name: Checkout uses: actions/checkout@v3 with: From fca60913df0e57d52b56c2ddc6099e6ed0d150fc Mon Sep 17 00:00:00 2001 From: stneng Date: Sun, 12 Feb 2023 02:09:27 +0000 Subject: [PATCH 05/13] bump version to 0.3.2 --- Cargo.toml | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 872129a..e7e030e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "colink" -version = "0.3.1" +version = "0.3.2" edition = "2021" description = "CoLink Rust SDK" license = "MIT" diff --git a/README.md b/README.md index e2e29e8..b01da17 100644 --- a/README.md +++ b/README.md @@ -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 From 3496070f054fd385e60fa0c7bb386570e70acd72 Mon Sep 17 00:00:00 2001 From: stneng Date: Sun, 12 Feb 2023 02:19:25 +0000 Subject: [PATCH 06/13] update CI workflow --- .github/workflows/check.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index c89e933..b8c84de 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -45,12 +45,15 @@ jobs: toolchain: stable components: rustfmt, clippy - name: Check + if: ${{ startsWith(matrix.ci_image, 'ubuntu') }} 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 From 5e935d7be0e5d882fbd461d16f5ef9d31e2b50a3 Mon Sep 17 00:00:00 2001 From: stneng Date: Sun, 12 Feb 2023 02:35:14 +0000 Subject: [PATCH 07/13] try --- .github/workflows/check.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index b8c84de..10c7eae 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -30,11 +30,6 @@ jobs: 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: @@ -58,6 +53,11 @@ jobs: - name: Download Server run: bash download-server.sh working-directory: tests + - 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: Run tests if: ${{ matrix.mq != 'standalone' }} env: From 2c8d982c992340c9fdb59a0d4f28a74d479f9a23 Mon Sep 17 00:00:00 2001 From: stneng Date: Sun, 12 Feb 2023 02:53:44 +0000 Subject: [PATCH 08/13] debug --- .github/workflows/check.yml | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 10c7eae..3410764 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -30,6 +30,11 @@ jobs: 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: @@ -53,11 +58,11 @@ jobs: - name: Download Server run: bash download-server.sh working-directory: tests - - 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: debug + run: | + lsof -i:16379 + lsof -i:6379 + lsof -i:15672 - name: Run tests if: ${{ matrix.mq != 'standalone' }} env: From 893ff7d3367fc7b6c4dca04cc36632a4f5385793 Mon Sep 17 00:00:00 2001 From: stneng Date: Sun, 12 Feb 2023 03:06:34 +0000 Subject: [PATCH 09/13] . --- .github/workflows/check.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 3410764..4dc6fd4 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -59,6 +59,7 @@ jobs: run: bash download-server.sh working-directory: tests - name: debug + if: ${{ startsWith(matrix.ci_image, 'macos') }} run: | lsof -i:16379 lsof -i:6379 From bd74063971756d40b9fe956636a821e9c37eddbc Mon Sep 17 00:00:00 2001 From: stneng Date: Mon, 13 Feb 2023 01:45:41 +0000 Subject: [PATCH 10/13] fix --- tests/download-server.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/download-server.sh b/tests/download-server.sh index 8994ae3..ce00e99 100755 --- a/tests/download-server.sh +++ b/tests/download-server.sh @@ -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.2/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 .. From 7a029b1e225b32e5e63c106d0c27c660fa7c8058 Mon Sep 17 00:00:00 2001 From: stneng Date: Mon, 13 Feb 2023 01:47:55 +0000 Subject: [PATCH 11/13] fix --- .github/workflows/check.yml | 6 +++--- tests/test_storage_macro.rs | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 4dc6fd4..eeb0ff1 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -15,11 +15,11 @@ jobs: 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" + mq_uri: "redis://127.0.0.1:16379" runs-on: ${{ matrix.ci_image }} defaults: run: diff --git a/tests/test_storage_macro.rs b/tests/test_storage_macro.rs index c1db619..703dd96 100644 --- a/tests/test_storage_macro.rs +++ b/tests/test_storage_macro.rs @@ -19,7 +19,7 @@ async fn test_storage_macro_redis() -> Result<(), Box Date: Mon, 13 Feb 2023 02:06:31 +0000 Subject: [PATCH 12/13] remove debug --- .github/workflows/check.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index eeb0ff1..4e95992 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -58,12 +58,6 @@ jobs: - name: Download Server run: bash download-server.sh working-directory: tests - - name: debug - if: ${{ startsWith(matrix.ci_image, 'macos') }} - run: | - lsof -i:16379 - lsof -i:6379 - lsof -i:15672 - name: Run tests if: ${{ matrix.mq != 'standalone' }} env: From 377240392bdaa561f27f89866418931e7ad95de2 Mon Sep 17 00:00:00 2001 From: stneng Date: Tue, 14 Feb 2023 01:34:22 +0000 Subject: [PATCH 13/13] update comment --- .github/workflows/check.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 4e95992..911c6c2 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -45,7 +45,7 @@ jobs: toolchain: stable components: rustfmt, clippy - name: Check - if: ${{ startsWith(matrix.ci_image, 'ubuntu') }} + 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