Skip to content

Commit

Permalink
Remove protocol
Browse files Browse the repository at this point in the history
Simplify for PR.

Test field offset.

Test

Run tests again.

Test

t

File was not saved.

simple run

Check tests

Revert struct.

Fix tests.

Check some offset thing.

Array tests

More test fixes.

Fix tests

Fix check.

Fix build.

better result types.

Set environment variable.

Do not run arm tests.

Do not fail fast.

Test build.

Test linux.

Another test

Print out files.

Fix library name.

Cp

Fix path

Fix yaml

Try to run tests

Fix path

Another test

Fix pack?

Upload nuget packages.

Checkout everything.

Build props.

Remove patch.

Test

Fix sync.

Small fixes.

Fix To method.

Fixes

Several fixed and simplifications.

Setup to test more providers and authentication.

Extension project.

Fix project name.

Add support for MongoDB.

Simplified code.

Batching.

Fix deadlock and implement listener.

Styling.

Deadlock test

Temp.

Rename file.

Service extensions.

Test

Some improvements.

Just some progress.

Cache documents.

Server project.
  • Loading branch information
SebastianStehle committed Oct 7, 2023
1 parent e222d7a commit 8567f28
Show file tree
Hide file tree
Showing 43 changed files with 639 additions and 148 deletions.
11 changes: 11 additions & 0 deletions .cargo/config.github
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[target.aarch64-unknown-linux-gnu]
linker = "aarch64-linux-gnu-gcc"

[target.aarch64-unknown-linux-musl]
linker = "aarch64-linux-gnu-gcc"

[target.armv7-unknown-linux-gnueabihf]
linker = "arm-linux-gnueabihf-gcc"

[target.armv7-unknown-linux-musleabihf]
linker = "arm-linux-musleabihf-gcc"
137 changes: 137 additions & 0 deletions .github/workflows/build-binaries.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
name: Build Binaries

on:
push:
tags:
- 'binaries[0-9]'
env:
YRS_REPO: https://github.com/SebastianStehle/y-crdt
YRS_BRANCH: main
CARGO_TERM_COLOR: always

jobs:
# Based on https://www.rohanjain.in/cargo-cross/
build-native-binaries:
runs-on: ${{matrix.os}}
strategy:
matrix:
include:
# Windows
- build: win-x64
os: windows-latest
rust: stable
target: x86_64-pc-windows-msvc
linker: mingw-w64
cross: false

# Linux
- build: linux-x64
os: ubuntu-latest
rust: stable
target: x86_64-unknown-linux-gnu
cross: false

- build: linux-x64-musl
os: ubuntu-latest
rust: stable
target: x86_64-unknown-linux-musl
cross: false

- build: linux-armv7
os: ubuntu-latest
rust: stable
target: armv7-unknown-linux-gnueabihf
linker: gcc-arm-linux-gnueabihf
cross: true

- build: linux-armv7-musl
os: ubuntu-latest
rust: stable
target: armv7-unknown-linux-musleabihf
linker: gcc-arm-linux-gnueabihf
cross: true

- build: linux-arm64
os: ubuntu-latest
rust: stable
target: aarch64-unknown-linux-gnu
linker: gcc-aarch64-linux-gnu
cross: true

- build: linux-arm64-musl
os: ubuntu-latest
rust: stable
target: aarch64-unknown-linux-musl
linker: gcc-aarch64-linux-gnu
cross: true

# MacOS
- build: macos
os: macos-latest
rust: stable
target: x86_64-apple-darwin
cross: false

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Cache
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
~/.rustup
target
key: ${{ runner.os }}-${{ matrix.rust }}

- name: Install cross
if: matrix.cross
uses: taiki-e/install-action@v2
with:
tool: cross

- name: Add musl tools
run: sudo apt install -y musl musl-dev musl-tools
if: endsWith(matrix.build, '-musl')

- name: Install Linker
if: matrix.cross
run: |
sudo apt update
sudo apt install ${{ matrix.linker }}
cat .cargo/config.github >> .cargo/config
- name: Install Rust
run: |
rustup install ${{ matrix.rust }}
rustup target add ${{ matrix.target }}
rustup show
- name: Clone Yrs repo
run: |
git clone ${YRS_REPO} --branch ${YRS_BRANCH} --single-branch yrs
shell: bash

- name: Build (cargo)
if: "!matrix.cross"
run: |
cd yrs
RUSTFLAGS="-C target-feature=-crt-static" cargo build --release --target ${{ matrix.target }}
shell: bash

- name: Build (cross)
if: matrix.cross
run: |
cd yrs
RUSTFLAGS="-C target-feature=-crt-static" cross build --release --target ${{ matrix.target }}
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.build }}
path: |
yrs/target/${{ matrix.target }}/release/*yrs.dll
yrs/target/${{ matrix.target }}/release/*yrs.so
yrs/target/${{ matrix.target }}/release/*yrs.dylib
82 changes: 82 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: CI

on:
push:
branches:
- '*'

jobs:
test:
runs-on: ${{matrix.os}}
strategy:
fail-fast: false

matrix:
include:
# Windows
- build: win-x64
os: windows-latest

# Linux
- build: linux-x64
os: ubuntu-latest

- build: linux-x64-musl
os: ubuntu-latest

# macOS
- build: macos
os: macos-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Download artifacts
uses: dawidd6/action-download-artifact@v2
with:
path: ./output
workflow: build-binaries.yml
workflow_conclusion: success

- name: Build Test
run: |
cd T
dotnet build
- name: Copy to Test Folder
run: |
cp output/${{matrix.build}}/*.* T/bin/Debug/net7.0
ls output/${{matrix.build}}
ls T/bin/Debug/net7.0
- name: Test
run: |
cd T && dotnet run
env:
RUST_BACKTRACE: 1

pack-nuget:
runs-on: ubuntu-latest
needs: test

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Download artifacts
uses: dawidd6/action-download-artifact@v2
with:
path: ./output
workflow: build-binaries.yml
workflow_conclusion: success

- name: Nuget pack
run: |
dotnet pack -c Release
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
path: |
**/*.nupkg
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ bld/
[Bb]in/
[Oo]bj/
[Oo]ut/
[Oo]utput/
msbuild.log
msbuild.err
msbuild.wrn
Expand All @@ -39,3 +40,10 @@ msbuild.wrn
# Project-specific files
*.dll
*.dylib

# Node
node_modules

apSettings.Development.json

launchSettings.json
18 changes: 18 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Authors>lsvviana, sebastianstehle</Authors>
<Copyright>MIT</Copyright>
<Description>YDotNet provides cross=platform .Net bindings for the Yrs Rust port of Yjs.</Description>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<IncludeSymbols>true</IncludeSymbols>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageProjectUrl>https://github.com/LSViana/YDotNet</PackageProjectUrl>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<Version>0.1.0</Version>
</PropertyGroup>

<PropertyGroup Condition="'$(GITHUB_ACTIONS)' == 'true'">
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
</PropertyGroup>
</Project>
7 changes: 1 addition & 6 deletions Tests/YDotNet.Tests.Unit/Arrays/GetTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ public void GetAtBeginning()

// Assert
Assert.That(output, Is.Not.Null);
Assert.That(output.Boolean, Is.True);
Assert.That(output.Long, Is.Null);
Assert.That(output.Type, Is.EqualTo(OutputInputType.Bool));
}

[Test]
Expand All @@ -54,7 +53,6 @@ public void GetAtMiddle()
// Assert
Assert.That(output, Is.Not.Null);
Assert.That(output.Undefined, Is.True);
Assert.That(output.Long, Is.Null);
}

[Test]
Expand All @@ -71,7 +69,6 @@ public void GetAtEnding()
// Assert
Assert.That(output, Is.Not.Null);
Assert.That(output.String, Is.EqualTo("Lucas"));
Assert.That(output.Long, Is.Null);
}

[Test]
Expand All @@ -89,11 +86,9 @@ public void GetMultipleTimesAtSameIndex()
// Assert
Assert.That(output1, Is.Not.Null);
Assert.That(output1.Boolean, Is.True);
Assert.That(output1.Long, Is.Null);

Assert.That(output2, Is.Not.Null);
Assert.That(output2.Boolean, Is.True);
Assert.That(output2.Long, Is.Null);
}

[Test]
Expand Down
3 changes: 0 additions & 3 deletions Tests/YDotNet.Tests.Unit/Arrays/IterateTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,7 @@ public void IteratesOnMultiItem()
// Assert
Assert.That(values.Length, Is.EqualTo(expected: 3));
Assert.That(values[0].Long, Is.EqualTo(expected: 2469L));
Assert.That(values[0].Double, Is.Null);
Assert.That(values[1].Boolean, Is.False);
Assert.That(values[1].Double, Is.Null);
Assert.That(values[2].Undefined, Is.True);
Assert.That(values[2].Double, Is.Null);
}
}
2 changes: 0 additions & 2 deletions Tests/YDotNet.Tests.Unit/Arrays/ObserveTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ public void ObserveHasDeltasWhenAdded()
Assert.That(eventChanges.First().Tag, Is.EqualTo(EventChangeTag.Add));
Assert.That(eventChanges.First().Length, Is.EqualTo(expected: 1));
Assert.That(eventChanges.First().Values.First().Long, Is.EqualTo(expected: 2469L));
Assert.That(eventChanges.First().Values.First().Double, Is.Null);
}

[Test]
Expand Down Expand Up @@ -118,7 +117,6 @@ public void ObserveHasDeltasWhenMoved()
Assert.That(eventChanges.ElementAt(index: 0).Tag, Is.EqualTo(EventChangeTag.Add));
Assert.That(eventChanges.ElementAt(index: 0).Length, Is.EqualTo(expected: 1));
Assert.That(eventChanges.ElementAt(index: 0).Values.First().Undefined, Is.True);
Assert.That(eventChanges.ElementAt(index: 0).Values.First().Double, Is.Null);

Assert.That(eventChanges.ElementAt(index: 1).Tag, Is.EqualTo(EventChangeTag.Retain));
Assert.That(eventChanges.ElementAt(index: 1).Length, Is.EqualTo(expected: 2));
Expand Down
4 changes: 2 additions & 2 deletions Tests/YDotNet.Tests.Unit/Document/UpdatesV1Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public void TriggersWhenTransactionIsCommittedUntilUnobserve()
// Assert
Assert.That(called, Is.EqualTo(expected: 1));
Assert.That(data, Is.Not.Null);
Assert.That(data, Has.Length.InRange(from: 25, to: 30));
Assert.That(data, Has.Length.InRange(from: 20, to: 30));

// Act
data = null;
Expand All @@ -41,7 +41,7 @@ public void TriggersWhenTransactionIsCommittedUntilUnobserve()
// Assert
Assert.That(called, Is.EqualTo(expected: 2));
Assert.That(data, Is.Not.Null);
Assert.That(data, Has.Length.InRange(from: 25, to: 31));
Assert.That(data, Has.Length.InRange(from: 20, to: 31));

// Act
data = null;
Expand Down
Loading

0 comments on commit 8567f28

Please sign in to comment.