Skip to content

Commit

Permalink
feat: Rust (#380)
Browse files Browse the repository at this point in the history
  • Loading branch information
lemaitre-aneo authored Nov 6, 2024
2 parents c83398e + aa81f62 commit 3e97b32
Show file tree
Hide file tree
Showing 157 changed files with 12,779 additions and 5 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,43 @@ jobs:
- name: Check Diff
run: docker run --rm --volume "$(pwd)/Protos/V1:/workspace" --workdir /workspace bufbuild/buf:1.8.0 format -d --exit-code

format-rust:
name: Format and check Rust
strategy:
fail-fast: false
matrix:
toolchain:
- stable
- nightly
runs-on: ubuntu-latest
defaults:
run:
working-directory: packages/rust/armonik
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
with:
fetch-depth: 0
- uses: taiki-e/install-action@v2
with:
tool: protoc,sccache
- name: Install toolchain
if: ${{ !contains(matrix.toolchain, 'nightly') }}
uses: dtolnay/rust-toolchain@stable
with:
components: rust-src,rust-docs,rustfmt,clippy
- name: Build
run: |
cargo build --all --locked
- name: Format
run: |
cargo fmt --all --check
- name: Doc
run: |
RUSTDOCFLAGS="-Dwarnings" cargo doc
- name: Clippy
run: |
cargo clippy --all --no-deps -- -Dwarnings -Dunused-crate-dependencies
lint-js:
name: Lint JS
runs-on: ubuntu-latest
Expand Down
39 changes: 36 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,16 @@ jobs:
cmd: pytest tests --cov=armonik --cov-config=.coveragerc --cov-report=term-missing --cov-append --cov-report xml:coverage.xml --cov-report html:coverage_report
dir: python
env: {}
- lang: Rust
toolchain: stable
cmd: cargo test --locked
dir: rust/armonik
env: {}
- lang: Rust
toolchain: nightly
cmd: cargo test --locked
dir: rust/armonik
env: {}
plateform:
- os: ubuntu-latest
- os: windows-latest
Expand All @@ -78,6 +88,10 @@ jobs:
lang: Python
plateform:
os: windows-2019
- language:
lang: Rust
plateform:
os: windows-2019
- language:
lang: C#
dotnet: ''
Expand Down Expand Up @@ -123,18 +137,36 @@ jobs:
run: |
echo "Current language: ${{ matrix.language.lang }}"
# Prepare Python
- name: pip update and add build package
if: ${{ matrix.language.lang == 'Python' }}
working-directory: packages/python
run: bash proto2python.sh ~/pyvenv

- name: Install python dependencies
if: ${{ matrix.language.lang == 'Python' }}
working-directory: packages/python
run: |
pwd
pip install "$(echo pkg/armonik*.whl)[tests]"
# Prepare Rust
- uses: taiki-e/install-action@v2
if: ${{ matrix.language.lang == 'Rust' }}
with:
tool: protoc,sccache
- name: Install Rust toolchain
if: ${{ matrix.language.lang == 'Rust' }}
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ matrix.language.toolchain }}
components: rust-src,rust-docs,rustfmt${{contains(matrix.language.toolchain, 'nightly') && ',miri' || ''}}
- name: Build Rust package
if: ${{ matrix.language.lang == 'Rust' }}
working-directory: packages/rust/armonik
run: |
cargo build --locked --tests
# Prepare C++
- name: Build C++ package
if: ${{ matrix.language.lang == 'C++' }}
working-directory: packages/cpp
Expand All @@ -148,6 +180,7 @@ jobs:
dotnet publish -o ../out
[ -e ../out/ArmoniK.Api.Mock.exe ] || ln -s ArmoniK.Api.Mock ../out/ArmoniK.Api.Mock.exe
# Run tests
- name: noTLS
working-directory: packages/csharp/
shell: bash
Expand All @@ -161,7 +194,7 @@ jobs:
../../scripts/mock_test.sh ${{ matrix.language.dir }} '${{ matrix.language.cmd }}'
- name: TLS Insecure
if: ${{ matrix.language.lang == 'C#' }}
if: ${{ contains(fromJson('["C#", "Rust"]'), matrix.language.lang) }}
working-directory: packages/csharp/
shell: bash
run: |
Expand Down Expand Up @@ -211,7 +244,7 @@ jobs:
../../scripts/mock_test.sh ${{ matrix.language.dir }} '${{ matrix.language.cmd }}'
- name: mTLS Insecure
if: ${{ matrix.language.lang == 'C#' }}
if: ${{ contains(fromJson('["C#", "Rust"]'), matrix.language.lang) }}
working-directory: packages/csharp/
shell: bash
run: |
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -375,10 +375,14 @@ dist
*.pbconf.ts
*.pbsc.ts

# Rust
**/target

!packages/common
!packages/csharp
!packages/cpp
!packages/python
!packages/rust
!packages/angular
!packages/web
!packages/java
Expand Down
10 changes: 9 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@
]
},
"cSpell.words": [
"Armoni"
"Armoni",
"armonik"
],
"[rust]": {
"editor.tabSize": 4
},
"rust-analyzer.cachePriming.enable": true,
"rust-analyzer.linkedProjects": [
"./packages/rust/armonik/Cargo.toml"
]
}
2 changes: 1 addition & 1 deletion Protos/V1/results_common.proto
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ message CreateResultsMetaDataResponse {
}

/*
* Request for creating results without data
* Request for creating results with data
*/
message CreateResultsRequest {
/**
Expand Down
1 change: 1 addition & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export default antfu({
'.docs',
'packages/csharp',
'packages/cpp',
'packages/rust',
],
}).overrideRules({
'antfu/consistent-list-newline': 'off',
Expand Down
Loading

0 comments on commit 3e97b32

Please sign in to comment.