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-oli.git
The following commit(s) were added to refs/heads/main by this push:
new 9521f3e build(ci): setup GitHub Action CI (#3)
9521f3e is described below
commit 9521f3ebc1c185f9e1cac789430d0063fab20237
Author: Ruihang Xia <[email protected]>
AuthorDate: Mon Nov 10 17:13:49 2025 +0800
build(ci): setup GitHub Action CI (#3)
Signed-off-by: Ruihang Xia <[email protected]>
---
.github/actions/setup/action.yml | 93 ++++++++++++++++++++++++++++++++++++++++
.github/workflows/ci.yml | 55 ++++++++++++++++++++++++
README.md | 4 +-
3 files changed, 150 insertions(+), 2 deletions(-)
diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml
new file mode 100644
index 0000000..0337e91
--- /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..2de5fdb
--- /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: Oli 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/README.md b/README.md
index 068a86a..fd067eb 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_oli.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-oli/ci.yml?branch=main
+[actions]: https://github.com/apache/opendal-oli/actions?query=branch%3Amain
[latest version]: https://img.shields.io/crates/v/oli.svg
[crates.io]: https://crates.io/crates/oli
[crate downloads]: https://img.shields.io/crates/d/oli.svg