Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 1 addition & 42 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,9 @@
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"
default: "false"
github-token:
description: "Github Token"
default: ""
Expand All @@ -45,49 +44,9 @@ runs:
# 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
7 changes: 0 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ on:
pull_request:
branches:
- main
paths:
- "src/**"
- ".github/workflows/ci.yml"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
Expand All @@ -40,10 +37,6 @@ jobs:

- 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
Expand Down
113 changes: 113 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
# 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 Release

on:
push:
tags:
- "v*"
workflow_dispatch:

permissions:
contents: write

env:
CARGO_TERM_COLOR: always
BIN_NAME: ofs

jobs:
build:
name: Build ${{ matrix.target }}
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
use-cross: false
- os: ubuntu-latest
target: aarch64-unknown-linux-gnu
use-cross: true
steps:
- uses: actions/checkout@v5

- name: Setup Rust builder
uses: ./.github/actions/setup

- name: Build target
uses: ClementTsang/cargo-action@v0.0.7
with:
use-cross: ${{ !!matrix.use-cross }}
command: build
args: --locked --release --target ${{ matrix.target }}
env:
CARGO_PROFILE_RELEASE_LTO: true

- name: Package artifact (Unix)
if: runner.os != 'Windows'
env:
TARGET: ${{ matrix.target }}
run: |
set -euo pipefail
ARCHIVE_NAME="ofs-${GITHUB_REF_NAME}-${TARGET}"
PACKAGE_DIR="${ARCHIVE_NAME}"
mkdir -p "${PACKAGE_DIR}"
cp "target/${TARGET}/release/${BIN_NAME}" "${PACKAGE_DIR}/"
cp LICENSE NOTICE "${PACKAGE_DIR}/"
mkdir -p dist
tar -czf "dist/${ARCHIVE_NAME}.tar.gz" -C "${PACKAGE_DIR}" .
rm -rf "${PACKAGE_DIR}"

- name: Upload artifact
uses: actions/upload-artifact@v5
with:
name: ofs-${{ github.ref_name }}-${{ matrix.target }}
path: dist/ofs-*
if-no-files-found: error

release:
name: Publish release
needs: build
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5

- name: Download all artifacts
uses: actions/download-artifact@v7
with:
path: dist
merge-multiple: true

- name: Publish GitHub release
uses: softprops/action-gh-release@v2
with:
files: |
dist/*.tar.gz
name: ${{ github.ref_name }}
tag_name: ${{ github.ref_name }}
generate_release_notes: true

- name: Publish to crates.io
run: cargo publish --locked --no-verify
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
Loading