-
Notifications
You must be signed in to change notification settings - Fork 499
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Matheus C. França <[email protected]>
- Loading branch information
Showing
19 changed files
with
760 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
# 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: Bindings D CI | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
tags: | ||
- "*" | ||
pull_request: | ||
branches: | ||
- main | ||
paths: | ||
- "core/**" | ||
- "bindings/c/**" | ||
- "bindings/d/**" | ||
- ".github/workflows/ci_bindings_d.yml" | ||
workflow_dispatch: | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }} | ||
cancel-in-progress: true | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
test: | ||
strategy: | ||
matrix: | ||
dlang: ["ldc-latest", "dmd-latest"] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: dlang-community/setup-dlang@v2 | ||
with: | ||
compiler: ${{ matrix.dlang }} | ||
|
||
- name: Setup Rust toolchain | ||
uses: ./.github/actions/setup | ||
|
||
- name: Build D binding | ||
working-directory: bindings/d | ||
run: dub build | ||
|
||
- name: Check diff | ||
run: git diff --exit-code | ||
|
||
- name: Check | ||
working-directory: bindings/d | ||
run: dub lint | ||
|
||
- name: Run tests | ||
working-directory: bindings/d | ||
run: dub test && cd test && dub |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
.dub | ||
docs.json | ||
__dummy.html | ||
docs/ | ||
/d | ||
d.so | ||
d.dylib | ||
d.dll | ||
d.a | ||
d.lib | ||
d-test-* | ||
*.exe | ||
*.pdb | ||
*.o | ||
*.obj | ||
*.lst | ||
*.h | ||
*.a | ||
*.ninja_log | ||
tests* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# Contributing | ||
|
||
- [Contributing](#contributing) | ||
- [Setup](#setup) | ||
- [Using a dev container environment](#using-a-dev-container-environment) | ||
- [Bring your own toolbox](#bring-your-own-toolbox) | ||
- [Build](#build) | ||
- [Test](#test) | ||
|
||
## Setup | ||
|
||
### Using a dev container environment | ||
|
||
OpenDAL provides a pre-configured [dev container](https://containers.dev/) that could be used in [GitHub Codespaces](https://github.com/features/codespaces), [VSCode](https://code.visualstudio.com/), [JetBrains](https://www.jetbrains.com/remote-development/gateway/), [JupyterLab](https://jupyterlab.readthedocs.io/en/stable/). Please pick up your favourite runtime environment. | ||
|
||
The fastest way is: | ||
|
||
[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/apache/opendal?quickstart=1&machine=standardLinux32gb) | ||
|
||
### Bring your own toolbox | ||
|
||
To build OpenDAL D binding locally, you need: | ||
|
||
- [dmd/ldc/gdc](https://dlang.org/download) | ||
|
||
|
||
## Build | ||
|
||
First, build the C bindings: | ||
|
||
```shell | ||
dub build -b release | ||
``` | ||
|
||
> **Note**: | ||
> | ||
> - `dub build` adds the header file `opendal.h` under `../c/include` | ||
> - The library is under `../../target/debug` or `../../target/release` after building. | ||
## Test | ||
|
||
To build and run the tests. | ||
|
||
```shell | ||
$ dub test | ||
Generating test runner configuration 'opendal-test-unittest' for 'unittest' (library). | ||
Starting Performing "unittest" build using /usr/bin/ldc2 for x86_64. | ||
Building opendal ~master: building configuration [opendal-test-unittest] | ||
Pre-build Running commands | ||
Finished `release` profile [optimized] target(s) in 0.08s | ||
Cargo build completed successfully | ||
Linking opendal-test-unittest | ||
Running opendal-test-unittest | ||
Basic Operator creation and write test passed | ||
1 modules passed unittests | ||
``` | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Dependencies | ||
|
||
OpenDAL D Binding is based on the C Binding. | ||
There are no extra runtime dependencies except those conveyed from C Binding. |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Apache OpenDAL™ D Binding (WIP) | ||
|
||
![](https://img.shields.io/badge/status-unreleased-red) | ||
|
||
![](https://github.com/apache/opendal/assets/5351546/87bbf6e5-f19e-449a-b368-3e283016c887) | ||
|
||
## Build | ||
|
||
To compile OpenDAL from source code, you need: | ||
|
||
- [dmd/ldc/gdc](https://dlang.org/download) | ||
|
||
```bash | ||
# build libopendal_c (underneath call make -C ../c) | ||
dub build -b release | ||
# build and run unit tests | ||
dub test | ||
``` | ||
|
||
## License and Trademarks | ||
|
||
Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Apache OpenDAL, OpenDAL, and Apache are either registered trademarks or trademarks of the Apache Software Foundation. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
module build; | ||
import std.stdio: writeln; | ||
import std.path: buildPath; | ||
import std.process: spawnShell, wait; | ||
import std.exception; | ||
import std.file: copy, mkdir, exists; | ||
import std.conv: to; | ||
|
||
version (Windows) | ||
enum staticlib = "opendal_c.lib"; | ||
else | ||
enum staticlib = "libopendal_c.a"; | ||
|
||
void main (string[] args) | ||
{ | ||
bool isRelease = args.length > 1 && args[1] == "release"; | ||
string buildType = isRelease ? "release" : "debug"; | ||
|
||
// Run cargo build | ||
auto cargoCmd = "cargo build --manifest-path " ~ buildPath( | ||
"..", "c", "Cargo.toml") ~ (isRelease ? " --release" : ""); | ||
|
||
auto status = wait(spawnShell(cargoCmd)); | ||
if (status != 0) | ||
{ | ||
throw new Exception("Cargo build failed with status: " ~ status.to!string); | ||
} | ||
else | ||
{ | ||
writeln("Cargo build completed successfully"); | ||
} | ||
|
||
// Get opendal.h | ||
copy(buildPath("..", "c", "include", "opendal.h"), buildPath("source", "opendal", "opendal.h")); | ||
|
||
// Get libopendal_c.a | ||
auto libPath = buildPath("..", "c", "target", buildType, staticlib); | ||
writeln("Copying ", libPath, " to ", buildPath("lib", staticlib)); | ||
if (!exists("lib")) | ||
mkdir ("lib"); | ||
copy(libPath, buildPath("lib", staticlib)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
; Configure which static analysis checks are enabled | ||
[analysis.config.StaticAnalysisConfig] | ||
; Check variable, class, struct, interface, union, and function names against | ||
; the Phobos style guide | ||
style_check="disabled" | ||
; Check for array literals that cause unnecessary allocation | ||
enum_array_literal_check="enabled" | ||
; Check for poor exception handling practices | ||
exception_check="enabled" | ||
; Check for use of the deprecated 'delete' keyword | ||
delete_check="enabled" | ||
; Check for use of the deprecated floating point operators | ||
float_operator_check="enabled" | ||
; Check underscores to improve number constant readability | ||
number_style_check="enabled" | ||
; Checks that opEquals, opCmp, toHash, and toString are either const, immutable | ||
; , or inout. | ||
object_const_check="enabled" | ||
; Checks for .. expressions where the left side is larger than the right. | ||
backwards_range_check="enabled" | ||
; Checks for if statements whose 'then' block is the same as the 'else' block | ||
if_else_same_check="enabled" | ||
; Checks for some problems with constructors | ||
constructor_check="enabled" | ||
; Checks for unused function parameters | ||
unused_parameter_check="disabled" | ||
; Checks for unused variables | ||
unused_variable_check="enabled" | ||
; Checks for unused labels | ||
unused_label_check="enabled" | ||
; Checks for duplicate attributes | ||
duplicate_attribute="enabled" | ||
; Checks that opEquals and toHash are both defined or neither are defined | ||
opequals_tohash_check="disabled" | ||
; Checks for subtraction from .length properties | ||
length_subtraction_check="disabled" | ||
; Checks for methods or properties whose names conflict with built-in propertie | ||
; s | ||
builtin_property_names_check="enabled" | ||
; Checks for confusing code in inline asm statements | ||
asm_style_check="enabled" | ||
; Checks for confusing logical operator precedence | ||
logical_precedence_check="disabled" | ||
; Checks for undocumented public declarations | ||
undocumented_declaration_check="disabled" | ||
; Checks for poor placement of function attributes | ||
function_attribute_check="enabled" | ||
; Checks for use of the comma operator | ||
comma_expression_check="enabled" | ||
; Checks for local imports that are too broad | ||
local_import_check="disabled" | ||
; Checks for variables that could be declared immutable | ||
could_be_immutable_check="disabled" | ||
; Checks for redundant expressions in if statements | ||
redundant_if_check="enabled" | ||
; Checks for redundant parenthesis | ||
redundant_parens_check="disabled" | ||
; Checks for mismatched argument and parameter names | ||
mismatched_args_check="disabled" | ||
; Checks for labels with the same name as variables | ||
label_var_same_name_check="disabled" | ||
; Checks for lines longer than 120 characters | ||
long_line_check="disabled" | ||
; Checks for assignment to auto-ref function parameters | ||
auto_ref_assignment_check="disabled" | ||
; Checks for incorrect infinite range definitions | ||
incorrect_infinite_range_check="enabled" | ||
; Checks for asserts that are always true | ||
useless_assert_check="enabled" | ||
; Check for uses of the old-style alias syntax | ||
alias_syntax_check="enabled" | ||
; Checks for else if that should be else static if | ||
static_if_else_check="enabled" | ||
; Check for unclear lambda syntax | ||
lambda_return_check="enabled" | ||
; Check for auto function without return statement | ||
auto_function_check="enabled" | ||
; Check for sortedness of imports | ||
imports_sortedness="disabled" | ||
; Check for explicitly annotated unittests | ||
explicitly_annotated_unittests="disabled" | ||
; Check for properly documented public functions (Returns, Params) | ||
properly_documented_public_functions="disabled" | ||
; Check for useless usage of the final attribute | ||
final_attribute_check="enabled" | ||
; Check for virtual calls in the class constructors | ||
vcall_in_ctor="enabled" | ||
; Check for useless user defined initializers | ||
useless_initializer="disabled" | ||
; Check allman brace style | ||
allman_braces_check="disabled" | ||
; Check for redundant attributes | ||
redundant_attributes_check="disabled" | ||
; Check for public declarations without a documented unittest | ||
has_public_example="disabled" | ||
; Check for asserts without an explanatory message | ||
assert_without_msg="disabled" | ||
; Check indent of if constraints | ||
if_constraints_indent="enabled" | ||
; Check for @trusted applied to a bigger scope than a single function | ||
trust_too_much="disabled" | ||
; Check for redundant storage classes on variable declarations") | ||
redundant_storage_classes="enabled" | ||
; Check for unused function return values | ||
unused_result="disabled" |
Oops, something went wrong.