Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/pub/lints-3.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
brunoocasali authored Dec 14, 2023
2 parents 7e2d1d1 + ef898fa commit ce379ee
Show file tree
Hide file tree
Showing 25 changed files with 1,758 additions and 397 deletions.
467 changes: 82 additions & 385 deletions .code-samples.meilisearch.yaml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .github/workflows/pre-release-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ jobs:
- name: Meilisearch (${{ env.MEILISEARCH_VERSION }}) setup with Docker
run: docker run -d -p 7700:7700 getmeili/meilisearch:${{ env.MEILISEARCH_VERSION }} meilisearch --master-key=masterKey --no-analytics
- name: Run integration tests
run: docker run --net="host" -v $PWD:/package -w /package dart:${{ matrix.version }} /bin/sh -c 'dart pub get && dart run test'
run: docker run --net="host" -v $PWD:/package -w /package dart:${{ matrix.version }} /bin/sh -c 'dart pub get && dart pub get -C tool && dart run test'
18 changes: 17 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ jobs:
- name: Install dependencies
run: |
dart pub get
dart pub get -C tool
dart pub global activate coverage
- name: Run integration tests
run: dart test --concurrency=4 --reporter=github --coverage=./coverage/reports
Expand All @@ -61,7 +62,9 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Install dependencies
run: dart pub get
run: |
dart pub get
dart pub get -C tool
- name: Run linter
run: dart analyze --fatal-infos && dart format . --set-exit-if-changed

Expand All @@ -75,6 +78,19 @@ jobs:
with:
config_file: .yamllint.yml

check-code-samples:
name: check .code-samples.meilisearch.yaml
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dart-lang/setup-dart@v1
with:
sdk: '3.0.0'
- name: check if samples changed
run: |
dart pub get
dart pub get -C tool
dart run ./tool/bin/meili.dart update-samples --fail-on-change
pana:
runs-on: ubuntu-latest
timeout-minutes: 10
Expand Down
26 changes: 26 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ First of all, thank you for contributing to Meilisearch! The goal of this docume
- [Requirements ](#requirements-)
- [Setup ](#setup-)
- [Tests and Linter ](#tests-and-linter-)
- [Updating code samples](#updating-code-samples)
- [Git Guidelines](#git-guidelines)
- [Git Branches ](#git-branches-)
- [Git Commits ](#git-commits-)
Expand Down Expand Up @@ -76,6 +77,31 @@ dart test
dart analyze
```

### Updating code samples

Some PRs require updating the code samples (found in `.code-samples.meilisearch.yaml`), this is done automatically using code excerpts, which are actual pieces of code subject to testing and linting.

A lot of them are placed in `test/code_samples.dart`.

Also most of the tests in that file are skipped, since they are mostly duplicated in other test files.

The process to define a new code sample is as follows:
1. Add the piece of code in `test/code_samples.dart`
2. surround it with `#docregion key` and `#enddocregion`, e.g.
```
// #docregion meilisearch_contributing_1
final client = MeilisearchClient();
anything();
// #enddocregion
```
3. run this command to update the code samples
```bash
dart run ./tool/bin/meili.dart update-samples
```
4. to test if the code samples are updated correctly, run:
```bash
dart run ./tool/bin/meili.dart update-samples --fail-on-change
```
## Git Guidelines

### Git Branches <!-- omit in TOC -->
Expand Down
8 changes: 1 addition & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,7 @@

**Meilisearch** is an open-source search engine. [Learn more about Meilisearch.](https://github.com/meilisearch/meilisearch)

---

### 🔥 On November 2nd, we are hosting our first-ever live demo and product updates for [Meilisearch Cloud](https://www.meilisearch.com/cloud?utm_campaign=oss&utm_source=github&utm_medium=meilisearch). Make sure to [register here](https://us06web.zoom.us/meeting/register/tZMlc-mqrjIsH912-HTRe-AaT-pp41bDe81a#/registration) and bring your questions for live Q&A!

---

## Table of Contents <!-- omit in toc -->
## Table of Contents <!-- omit in TOC -->

- [📖 Documentation](#-documentation)
- [⚡ Supercharge your Meilisearch experience](#-supercharge-your-meilisearch-experience)
Expand Down
4 changes: 3 additions & 1 deletion lib/src/filter_builder/values.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@ class MeiliDateTimeValueExpression extends MeiliValueExpressionBase {
"DateTime passed to Meili must be in UTC to avoid inconsistency accross multiple devices",
);

/// Unix epoch time is seconds since epoch
@override
String transform() => value.millisecondsSinceEpoch.toString();
String transform() =>
(value.millisecondsSinceEpoch / 1000).floor().toString();

@override
bool operator ==(Object other) {
Expand Down
Loading

0 comments on commit ce379ee

Please sign in to comment.