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

psiace pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/opendal-ofs.git


The following commit(s) were added to refs/heads/main by this push:
     new 9716025  chore(ci): add basic workflow back (#6)
9716025 is described below

commit 9716025a4bdf8bf57c4ecb022302d745b3eee57c
Author: Chojan Shang <[email protected]>
AuthorDate: Thu Nov 20 11:37:30 2025 +0800

    chore(ci): add basic workflow back (#6)
    
    * chore(ci): add basic workflow back
    
    Signed-off-by: Chojan Shang <[email protected]>
    
    * test: add local fs fallback and basic gitignore
    
    Signed-off-by: Chojan Shang <[email protected]>
    
    ---------
    
    Signed-off-by: Chojan Shang <[email protected]>
---
 .github/actions/setup/action.yml | 93 ++++++++++++++++++++++++++++++++++++++++
 .github/workflows/ci.yml         | 55 ++++++++++++++++++++++++
 .gitignore                       |  8 ++++
 Cargo.lock                       |  4 +-
 README.md                        |  4 +-
 tests/common/mod.rs              | 20 ++++++++-
 6 files changed, 179 insertions(+), 5 deletions(-)

diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml
new file mode 100644
index 0000000..b9813e3
--- /dev/null
+++ b/.github/actions/setup/action.yml
@@ -0,0 +1,93 @@
+# 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.
+
+name: Setup Rust Builder
+description: "Prepare Rust Build Environment"
+inputs:
+  need-rocksdb:
+    description: "This setup needs rocksdb or not"
+  need-protoc:
+    description: "This setup needs protoc or not"
+  github-token:
+    description: "Github Token"
+    default: ""
+
+runs:
+  using: "composite"
+  steps:
+    - name: Setup rust related environment variables
+      shell: bash
+      run: |
+        # Disable full debug symbol generation to speed up CI build and keep 
memory down
+        # "1" means line tables only, which is useful for panic tracebacks.
+        # About `force-frame-pointers`, here's the discussion history: 
https://github.com/apache/opendal/issues/3756
+        echo "RUSTFLAGS=-C force-frame-pointers=yes -C debuginfo=1" >> 
$GITHUB_ENV
+        # Enable backtraces
+        echo "RUST_BACKTRACE=1" >> $GITHUB_ENV
+        # Enable logging
+        echo "RUST_LOG=opendal=trace" >> $GITHUB_ENV
+        # Enable sparse index
+        echo "CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse" >> $GITHUB_ENV
+        # Make sure rust has been setup
+        cargo version
+
+    # Make sure all required lib has been installed.
+    - name: Setup Linux
+      if: runner.os == 'Linux'
+      shell: bash
+      run: sudo apt-get install libgflags-dev libsnappy-dev zlib1g-dev 
libbz2-dev liblz4-dev libzstd-dev
+
+    - name: Setup Protoc
+      if: inputs.need-protoc == 'true'
+      uses: arduino/setup-protoc@v3
+      with:
+        version: "23.4"
+        repo-token: ${{ inputs.github-token }}
+
+    - name: Setup rocksdb on linux
+      if: runner.os == 'Linux' && inputs.need-rocksdb == 'true'
+      shell: bash
+      run: |
+        # Set rocksdb lib path
+        echo "ROCKSDB_LIB_DIR=/tmp/rocksdb/lib" >> $GITHUB_ENV
+
+    - name: Cache rocksdb
+      id: cache-rocksdb
+      uses: actions/cache@v4
+      if: runner.os == 'Linux' && inputs.need-rocksdb == 'true'
+      with:
+        path: /tmp/rocksdb
+        key: r2-rocksdb-8.1.1
+
+    - name: Build rocksdb if not cached
+      if: steps.cache-rocksdb.outputs.cache-hit != 'true' && runner.os == 
'Linux' && inputs.need-rocksdb == 'true'
+      shell: bash
+      run: |
+        set -e
+
+        cd /tmp
+        curl 
https://github.com/facebook/rocksdb/archive/refs/tags/v8.1.1.tar.gz -L -o 
rocksdb.tar.gz
+        tar -xzf rocksdb.tar.gz
+        cd rocksdb-8.1.1
+
+        mkdir /tmp/rocksdb
+        cmake -DCMAKE_INSTALL_PREFIX=/tmp/rocksdb -DPORTABLE=1
+        make -j$(nproc)
+        make install
+
+        cd ..
+        rm -rf /tmp/rocksdb-8.1.1
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
new file mode 100644
index 0000000..3e03a0c
--- /dev/null
+++ b/.github/workflows/ci.yml
@@ -0,0 +1,55 @@
+# 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.
+
+name: Ofs CI
+
+on:
+  push:
+    branches:
+      - main
+  pull_request:
+    branches:
+      - main
+    paths:
+      - "src/**"
+      - ".github/workflows/ci.yml"
+
+concurrency:
+  group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
+  cancel-in-progress: true
+
+jobs:
+  check_clippy_and_test:
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v5
+
+      - name: Setup Rust toolchain
+        uses: ./.github/actions/setup
+        with:
+          need-rocksdb: true
+          need-protoc: true
+          github-token: ${{ secrets.GITHUB_TOKEN }}
+      - name: Run sccache-cache
+        uses: 
mozilla-actions/sccache-action@7d986dd989559c6ecdb630a3fd2557667be217ad
+      - name: Cargo clippy && test
+        env:
+          SCCACHE_GHA_ENABLED: "true"
+          RUSTC_WRAPPER: "sccache"
+        run: |
+          cargo clippy --all-targets --all-features -- -D warnings
+          cargo test --all-targets --all-features
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..f0a38f1
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,8 @@
+# Build artifacts
+/target
+
+# Editor or OS clutter
+.DS_Store
+
+# Backup files created by rustfmt or editors
+**/*.rs.bk
diff --git a/Cargo.lock b/Cargo.lock
index ac86329..a0ecba5 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1291,18 +1291,20 @@ checksum = 
"a4895175b425cb1f87721b59f0f286c2092bd4af812243672510e1ac53e2e0ad"
 [[package]]
 name = "opendal"
 version = "0.54.1"
+source = "registry+https://github.com/rust-lang/crates.io-index";
+checksum = "42afda58fa2cf50914402d132cc1caacff116a85d10c72ab2082bb7c50021754"
 dependencies = [
  "anyhow",
  "backon",
  "base64",
  "bytes",
+ "chrono",
  "crc32c",
  "dotenvy",
  "futures",
  "getrandom 0.2.16",
  "http",
  "http-body",
- "jiff",
  "log",
  "md-5",
  "percent-encoding",
diff --git a/README.md b/README.md
index 293e496..77bb463 100644
--- a/README.md
+++ b/README.md
@@ -2,8 +2,8 @@
 
 [![Build Status]][actions] [![Latest Version]][crates.io] [![Crate 
Downloads]][crates.io] [![chat]][discord]
 
-[build status]: 
https://img.shields.io/github/actions/workflow/status/apache/opendal/ci_bin_ofs.yml?branch=main
-[actions]: https://github.com/apache/opendal/actions?query=branch%3Amain
+[build status]: 
https://img.shields.io/github/actions/workflow/status/apache/opendal-ofs/ci.yml?branch=main
+[actions]: https://github.com/apache/opendal-ofs/actions?query=branch%3Amain
 [latest version]: https://img.shields.io/crates/v/ofs.svg
 [crates.io]: https://crates.io/crates/ofs
 [crate downloads]: https://img.shields.io/crates/d/ofs.svg
diff --git a/tests/common/mod.rs b/tests/common/mod.rs
index e6d4d1e..4a1a4f2 100644
--- a/tests/common/mod.rs
+++ b/tests/common/mod.rs
@@ -17,8 +17,10 @@
 
 use std::sync::OnceLock;
 
-use opendal::Capability;
 use opendal::raw::tests;
+use opendal::services;
+use opendal::Capability;
+use opendal::Operator;
 use tempfile::TempDir;
 use test_context::TestContext;
 use tokio::runtime::Runtime;
@@ -30,6 +32,9 @@ static RUNTIME: OnceLock<Runtime> = OnceLock::new();
 #[cfg(any(target_os = "linux", target_os = "freebsd"))]
 pub struct OfsTestContext {
     pub mount_point: TempDir,
+    // Keep backend root alive for the fs-based fallback backend.
+    #[allow(dead_code)]
+    backend_root: Option<TempDir>,
     // This is a false positive, the field is used in the test.
     #[allow(dead_code)]
     pub capability: Capability,
@@ -39,9 +44,19 @@ pub struct OfsTestContext {
 #[cfg(any(target_os = "linux", target_os = "freebsd"))]
 impl TestContext for OfsTestContext {
     fn setup() -> Self {
+        let mut backend_root = None;
         let backend = tests::init_test_service()
             .expect("init test services failed")
-            .expect("no test services has been configured");
+            .unwrap_or_else(|| {
+                let tmp_root = tempfile::tempdir().expect("create temporary 
backend root");
+                let root_path = tmp_root.path().to_string_lossy().to_string();
+                let fs = services::Fs::default().root(&root_path);
+                let backend = Operator::new(fs)
+                    .expect("build fallback fs operator")
+                    .finish();
+                backend_root = Some(tmp_root);
+                backend
+            });
         let capability = backend.info().full_capability();
 
         INIT_LOGGER.get_or_init(|| logforth::starter_log::stderr().apply());
@@ -74,6 +89,7 @@ impl TestContext for OfsTestContext {
 
         OfsTestContext {
             mount_point,
+            backend_root,
             capability,
             mount_handle,
         }

Reply via email to