You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opendal.apache.org by xu...@apache.org on 2023/03/19 06:29:17 UTC

[incubator-opendal] 01/01: infra: Introduce justfile for workflow

This is an automated email from the ASF dual-hosted git repository.

xuanwo pushed a commit to branch just
in repository https://gitbox.apache.org/repos/asf/incubator-opendal.git

commit baa540e96c5c6cb0ff4ad116245877cd43d6cde0
Author: Xuanwo <gi...@xuanwo.io>
AuthorDate: Sun Mar 19 14:28:59 2023 +0800

    infra: Introduce justfile for workflow
    
    Signed-off-by: Xuanwo <gi...@xuanwo.io>
---
 Justfile                   | 107 +++++++++++++++++++++++++++++++++++++++++++++
 bindings/python/.gitignore |   1 +
 website/.gitignore         |   3 ++
 3 files changed, 111 insertions(+)

diff --git a/Justfile b/Justfile
new file mode 100644
index 00000000..0edbff20
--- /dev/null
+++ b/Justfile
@@ -0,0 +1,107 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Load dotenv from .env file
+set dotenv-load := true
+
+export ROCKSDB_LIB_DIR := "/usr/lib"
+
+[private]
+default:
+    @just --list --unsorted
+
+# Check the whole project
+check:
+    cargo fmt --all -- --check
+    cargo doc --lib --no-deps --all-features -p opendal
+    cargo clippy --all-targets --all-features --workspace -- -D warnings
+
+# Build all components
+build_all:
+    just build_core
+    just build_bindings_python
+    just build_bindings_nodejs
+
+# Test all components
+test_all:
+    just test_core
+    just test_bindings_python
+    just test_bindings_nodejs
+
+# Build the core library
+build_core:
+    cargo build -p opendal
+
+# Test the core library
+test_core:
+    cargo nextest run --no-fail-fast --features layers-all && \
+        cargo test --doc
+
+[private]
+doc_core:
+    cargo doc --lib --no-deps --all-features -p opendal
+    cp -r ./target/doc ./website/static/docs/rust
+
+[private]
+prepare_bindings_python:
+    cd bindings/python && \
+        PYTHON_CONFIGURE_OPTS="--enable-shared" python -m venv venv
+
+# Build the bindings python library
+build_bindings_python: prepare_bindings_python
+    cd bindings/python && source venv/bin/activate && maturin develop
+
+# Test the bindings python library
+test_bindings_python: prepare_bindings_python
+    cd bindings/python && \
+        source venv/bin/activate && \
+        maturin develop -E test && \
+        behave tests
+
+[private]
+doc_bindings_python: prepare_bindings_python
+    cd bindings/python && \
+        source venv/bin/activate && \
+        python -m pip install pdoc && \
+        pdoc --output-dir ./docs opendal
+    cp -r ./bindings/python/docs ./website/static/docs/python
+
+[private]
+prepare_bindings_nodejs:
+    cd bindings/nodejs && yarn install
+
+# Build the bindings nodejs library
+build_bindings_nodejs: prepare_bindings_nodejs
+    cd bindings/nodejs && yarn build:debug
+
+# Test the bindings nodejs library
+test_bindings_nodejs: prepare_bindings_nodejs
+    cd bindings/nodejs && yarn test
+
+[private]
+doc_bindings_nodejs: prepare_bindings_nodejs
+    cd bindings/nodejs && yarn docs
+    cp -r ./bindings/nodejs/docs ./website/static/docs/nodejs
+
+# Build website
+build_website: doc_core doc_bindings_python doc_bindings_nodejs
+    cd website && yarn install && yarn build
+    cp .asf.yaml ./website/build/.asf.yaml
+
+# Preview website
+preview_website: doc_core doc_bindings_python doc_bindings_nodejs
+    cd website && yarn install && yarn start
diff --git a/bindings/python/.gitignore b/bindings/python/.gitignore
index 11af59c2..067db3d4 100644
--- a/bindings/python/.gitignore
+++ b/bindings/python/.gitignore
@@ -14,6 +14,7 @@ __pycache__/
 env/
 bin/
 build/
+docs/
 develop-eggs/
 dist/
 eggs/
diff --git a/website/.gitignore b/website/.gitignore
index b2d6de30..0a9ca2a7 100644
--- a/website/.gitignore
+++ b/website/.gitignore
@@ -18,3 +18,6 @@
 npm-debug.log*
 yarn-debug.log*
 yarn-error.log*
+
+# We will copy the generated files to the docs folder, leave them ignored.
+static/docs