Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Merge java/python/nodejs setup into Setup CI #2675

Closed
wants to merge 2 commits into from
Closed
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
35 changes: 32 additions & 3 deletions .github/actions/setup/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.

name: Setup Rust Builder
name: Setup Builder
description: 'Prepare Rust Build Environment'
inputs:
need-rocksdb:
Expand All @@ -24,11 +24,17 @@ inputs:
description: "This setup needs nextest or not"
need-protoc:
description: "This setup needs protoc or not"
need-java:
description: "This setup needs java or not, the value is java version"
need-python:
description: "This setup needs python or not, the value is python version"
need-nodejs:
description: "This setup needs nodejs or not, the value is nodejs version"

runs:
using: "composite"
steps:
- name: Setup rust related environment variables
- name: Setup Rust
shell: bash
run: |
# Disable full debug symbol generation to speed up CI build and keep memory down
Expand All @@ -41,11 +47,33 @@ runs:
# Enable sparse index
echo "CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse" >> $GITHUB_ENV

- name: Setup Java
if: inputs.need-java
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: ${{ inputs.need-java }}
cache: 'maven'

- name: Setup Python
if: inputs.need-python
uses: actions/setup-python@v4
with:
python-version: ${{ inputs.need-python }}

- name: Setup Nodejs
if: inputs.need-nodejs
uses: actions/setup-nodejs@v4
with:
node-version: ${{ inputs.need-nodejs }}

# Setup protoc
- name: Setup protoc on linux
if: inputs.need-protoc == 'true' && runner.os == 'Linux'
shell: bash
run: sudo apt install -y protobuf-compiler

# Setup nextest
- name: Cache nextest on linux
id: cache-nextest
uses: actions/cache@v3
Expand All @@ -60,7 +88,8 @@ runs:
shell: bash
run: cargo install [email protected] --locked

- name: Setup rust on linux
# Setup rocksdb
- name: Setup rocksbd on linux
if: runner.os == 'Linux' && inputs.need-rocksdb == 'true'
shell: bash
run: |
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/bindings_c.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Setup CI
uses: ./.github/actions/setup

- name: Install gtest manually
run: |
sudo apt-get install libgtest-dev
Expand All @@ -53,9 +57,6 @@ jobs:
sudo ln -s /usr/lib/libgtest.a /usr/local/lib/libgtest.a
sudo ln -s /usr/lib/libgtest_main.a /usr/local/lib/libgtest_main.a

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

- name: Build C binding
working-directory: "bindings/c"
run: make build
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/bindings_haskell.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,16 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Setup CI
uses: ./.github/actions/setup

- name: Setup Haskell toolchain
run: |
sudo apt-get update
sudo apt-get install -y ghc cabal-install
cabal update
- name: Setup Rust toolchain
uses: ./.github/actions/setup

- name: Build & Test
working-directory: "bindings/haskell"
run: |
Expand Down
20 changes: 10 additions & 10 deletions .github/workflows/bindings_java.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3

- name: Setup CI
uses: ./.github/actions/setup
with:
distribution: 'temurin'
java-version: '17'
cache: 'maven'
need-java: 17

- name: Build and test
working-directory: bindings/java
run: mvn spotless:check
Expand All @@ -60,12 +60,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 8
uses: actions/setup-java@v3

- name: Setup CI
uses: ./.github/actions/setup
with:
distribution: 'temurin'
java-version: '8'
cache: 'maven'
need-java: 8

- name: Build and test
working-directory: bindings/java
run: mvn clean verify
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/bindings_lua.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup CI
uses: ./.github/actions/setup

- name: Setup lua toolchain
run: |
sudo apt-get update
sudo apt-get install -y lua-busted luarocks liblua5.2-dev
- name: Setup Rust toolchain
uses: ./.github/actions/setup
- name: Build & Test
working-directory: "bindings/lua"
run: |
Expand Down
8 changes: 2 additions & 6 deletions .github/workflows/bindings_nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,10 @@ jobs:

steps:
- uses: actions/checkout@v3
- name: Setup Rust toolchain
- name: Setup CI
uses: ./.github/actions/setup
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: '18'
cache: yarn
cache-dependency-path: "bindings/nodejs/yarn.lock"
need-nodejs: 18

- name: Corepack
run: corepack enable
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/bindings_python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Setup Rust toolchain
- name: Setup CI
uses: ./.github/actions/setup
with:
need-python: "3.11"

- name: Build with maturin
working-directory: "bindings/python"
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/bindings_ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ jobs:
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.1'
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- name: Setup Rust toolchain
bundler-cache: true
- name: Setup CI
uses: ./.github/actions/setup
- name: Bundle with rake
working-directory: "bindings/ruby"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/bindings_swift.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Setup Rust toolchain
- name: Setup CI
uses: ./.github/actions/setup

- name: Setup Swift toolchain
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/bindings_zig.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
zig-version: master # 0.11.0 (nightly/master)
#zig-version: 0.11.0 # TODO: replace to stable version - wait new zig release

- name: Setup Rust toolchain
- name: Setup CI
uses: ./.github/actions/setup

- name: Build Zig binding
Expand Down
61 changes: 15 additions & 46 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Setup Rust toolchain
- name: Setup CI
uses: ./.github/actions/setup

- name: Check license headers
Expand All @@ -55,22 +55,13 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Setup Rust toolchain
- name: Setup CI
uses: ./.github/actions/setup
with:
need-rocksdb: true
need-protoc: true

- name: Checkout python env
uses: actions/setup-python@v4
with:
python-version: "3.8"

- name: Checkout java env
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: "11"
need-python: "3.8"
need-java: "11"

- name: Cargo doc
run: cargo doc --lib --no-deps --all-features -p opendal
Expand All @@ -80,22 +71,13 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Setup Rust toolchain
- name: Setup CI
uses: ./.github/actions/setup
with:
need-rocksdb: true
need-protoc: true

- name: Checkout python env
uses: actions/setup-python@v4
with:
python-version: "3.8"

- name: Checkout java env
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: "11"
need-python: "3.8"
need-java: "11"

- name: Cargo clippy
run: cargo clippy --all-targets --all-features --workspace -- -D warnings
Expand Down Expand Up @@ -124,7 +106,7 @@ jobs:
- windows-latest
steps:
- uses: actions/checkout@v3
- name: Setup Rust toolchain
- name: Setup CI
uses: ./.github/actions/setup
- name: Build
run: cargo build -p opendal -p oli -p object_store_opendal
Expand All @@ -133,21 +115,14 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Checkout python env
uses: actions/setup-python@v4
with:
python-version: "3.8"
- name: Checkout java env
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: "11"

- name: Setup Rust toolchain
- name: Setup CI
uses: ./.github/actions/setup
with:
need-rocksdb: true
need-protoc: true
need-python: "3.8"
need-java: "11"

- name: Build
run: cargo build --all-features
Expand All @@ -156,20 +131,14 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Checkout python env
uses: actions/setup-python@v4
with:
python-version: "3.8"
- name: Checkout java env
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: "11"

- name: Setup Rust toolchain
- name: Setup CI
uses: ./.github/actions/setup
with:
need-nextest: true
need-python: "3.8"
need-java: "11"

- name: Test
run: cargo nextest run --no-fail-fast --features layers-all && cargo test --doc
env:
Expand Down
Loading
Loading