Skip to content

Commit

Permalink
chore(ribir): 🤖 update ci and fix doc test
Browse files Browse the repository at this point in the history
  • Loading branch information
M-Adoo committed Mar 27, 2024
1 parent 7d5f0a4 commit 8eca98d
Show file tree
Hide file tree
Showing 11 changed files with 43 additions and 49 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/alpha-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
level: 'alpha'
ref: ${{ github.ref }}
merge_changelog: false
toolchain: nightly-2023-10-15
toolchain: stable
secrets:
CRATE_RELEASE_TOKEN: ${{ secrets.CRATE_RELEASE_TOKEN }}
GITHUB_RELEASE_TOKEN: ${{ secrets.RIBIR_RELEASE }}
7 changes: 4 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ jobs:
uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: nightly-2023-10-15
# we use nightly for clippy and rustfmt
toolchain: nightly-2024-03-25
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2
- name: format style check
Expand All @@ -43,7 +44,7 @@ jobs:
uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: nightly-2023-10-15
toolchain: stable
- uses: Swatinem/rust-cache@v2
- name: build ribir
run: cargo build
Expand All @@ -52,4 +53,4 @@ jobs:
{
echo ./README.md
find "./docs" -name "*.md"
} | xargs -I {} rustdoc -Z unstable-options --test --no-run {} -L target/debug/deps/ --edition 2018 --extern ribir=target/debug/libribir.rlib
} | xargs -I {} rustdoc --test {} -L target/debug/deps/ --edition 2018 --extern ribir=target/debug/libribir.rlib
2 changes: 1 addition & 1 deletion .github/workflows/new-dev-cycle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
level: 'beta'
ref: ${{ github.ref }}
merge_changelog: true
toolchain: nightly-2023-10-15
toolchain: stable
secrets:
CRATE_RELEASE_TOKEN: ${{ secrets.CRATE_RELEASE_TOKEN }}
GITHUB_RELEASE_TOKEN: ${{ secrets.RIBIR_RELEASE }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/patch-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
level: ${{ needs.release_level.outputs.level }}
ref: ${{ github.ref }}
merge_changelog: ${{ needs.release_level.outputs.level == 'patch' }}
toolchain: nightly-2023-10-15
toolchain: stable
secrets:
CRATE_RELEASE_TOKEN: ${{ secrets.CRATE_RELEASE_TOKEN }}
GITHUB_RELEASE_TOKEN: ${{ secrets.RIBIR_RELEASE }}
File renamed without changes.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ Please only add new entries below the [Unreleased](#unreleased---releasedate) he

### Features

- **macros**: Added a `include_crate_svg!` macro to include the svg relative to current crate. (#pr, @M-Adoo)
- **ribir**: Added a `nightly` feature to enable functionalities that require nightly Rust. (#pr, @M-Adoo)
- **macros**: Added a `include_crate_svg!` macro to include the svg relative to current crate. (#552, @M-Adoo)
- **ribir**: Added a `nightly` feature to enable functionalities that require nightly Rust. (#552, @M-Adoo)
- The `include_crates_svg!` macro can operate without the `nightly` feature.
- The `include_svg!` macro requires the `nightly` feature to be enabled.

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ A simple example of a counter:
<td style="padding:10px">
<div>

``` rust
``` rust no_run
use ribir::prelude::*;
fn main() {
let counter = fn_widget! {
Expand All @@ -66,7 +66,7 @@ fn main() {

**To use Ribir without DSL**:

```rust
```rust no_run
use ribir::prelude::*;

fn main() {
Expand Down
30 changes: 15 additions & 15 deletions docs/en/get_started/quick_start.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ A function widget is the simplest way to define a widget without external state

A function widget can be defined directly through a function:

```rust
```rust no_run
use ribir::prelude::*;

fn hello_world(ctx!(): &BuildCtx) -> Widget {
Expand Down Expand Up @@ -68,7 +68,7 @@ Finally, build `Text` into `Widget` through the `build` method as the return val

Because `hello_world` is not called by anyone else, you can rewrite it as a closure:

```rust
```rust no_run
use ribir::prelude::*;

fn main() {
Expand All @@ -94,7 +94,7 @@ move |ctx!(): &BuildCtx| -> Widget {
The `hello_world` example is rewritten with `fn_widget`!`:


```rust
```rust no_run
use ribir::prelude::*;

fn main() {
Expand Down Expand Up @@ -144,7 +144,7 @@ You already know how to create a widget, and now we will compose a simple counte
You can nest additional `rdl!` instances as children within the widget declared by the structure literal. Please note that child widgets must always be declared after the parent widget's properties. This is a formatting requirement of `rdl!`.


```rust
```rust no_run
use ribir::prelude::*;

fn main() {
Expand All @@ -167,7 +167,7 @@ In the above example, we created a `Row` with two child nodes, `FilledButton` an

`rdl!` also allows you to declare children for widgets that have already been created:

```rust
```rust no_run
use ribir::prelude::*;

fn main() {
Expand Down Expand Up @@ -221,7 +221,7 @@ let _ = fn_widget! {

At this point, let's review the previous example:

```rust
```rust no_run
use ribir::prelude::*;

fn main() {
Expand All @@ -245,7 +245,7 @@ Fortunately, Ribir offers a syntactic sugar, `@`, as an alternative to `rdl!`. I

Now let's rewrite the previous example of Counter using `@`:

```rust
```rust no_run
use ribir::prelude::*;

fn main() {
Expand Down Expand Up @@ -279,7 +279,7 @@ The complete life cycle of an interactive Ribir widget is as follows:

Now, let's improve our example by introducing the state.

```rust
```rust no_run
use ribir::prelude::*;

fn main() {
Expand Down Expand Up @@ -387,7 +387,7 @@ Suppose you have a counter that doesn't display the count with numbers, but inst

The code:

```rust
```rust no_run
use ribir::prelude::*;

fn main() {
Expand Down Expand Up @@ -452,7 +452,7 @@ The update push of the `Pipe` stream is built on top of the RxRust stream, so th

Let's say you have a simple auto-sum example:

```rust
```rust no_run
use ribir::prelude::*;

fn main() {
Expand Down Expand Up @@ -499,7 +499,7 @@ In short:

Of course, you can also use `watch!` to implement your counter:

```rust
```rust no_run
use ribir::prelude::*;

fn main() {
Expand Down Expand Up @@ -528,7 +528,7 @@ Typically, in complex real-world scenarios, you can't complete all development t

Using the `Compose` widget, the Counter example can be rewritten as:

```rust
```rust no_run
use ribir::prelude::*;

struct Counter(usize);
Expand Down Expand Up @@ -569,7 +569,7 @@ Ribir provides a set of built-in widgets that allow you to configure basic style
Let's take `Margin` as an example. Suppose you want to set a 10-pixel blank margin for a `Text`, the code is as follows:


```rust
```rust no_run
use ribir::prelude::*;

fn main() {
Expand All @@ -585,7 +585,7 @@ fn main() {

But you don't have to explicitly declare a `Margin`, you can write it directly as:

```rust
```rust no_run
use ribir::prelude::*;

fn main() {
Expand All @@ -601,7 +601,7 @@ fn main() {

When you create a widget declaratively, you can directly access the fields of the built-in widget, even if you don't explicitly declare them (if you use them in your code, the corresponding built-in widget will be created). For example:

```rust
```rust no_run
use ribir::prelude::*;

fn main() {
Expand Down
5 changes: 1 addition & 4 deletions docs/en/get_started/try_it.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ sidebar_position: 1

At first, you need to install Rust, you can reference the [official documentation](https://www.rust-lang.org/tools/install).

> Tips
>
> Currently Ribir only supports Rust nightly channel. You can use `rustup override set nightly` to switch to nightly channel. If you haven't installed nightly channel yet, you can check out [rustup Channels documentation](https://rust-lang.github.io/rustup/concepts/channels.html).

## Create a new Ribir project

Expand All @@ -39,7 +36,7 @@ Or you can directly run `cargo add --git "https://github.com/RibirX/Ribir" ribir

Open your editor and modify the `src/main.rs` file to:

```rust
```rust no_run
// main.rs
use ribir::prelude::*;

Expand Down
30 changes: 15 additions & 15 deletions docs/zh/get_started/quick_start.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ sidebar_position: 2

直接通过函数来定义 widget:

```rust
```rust no_run
use ribir::prelude::*;

fn hello_world(ctx!(): &BuildCtx) -> Widget {
Expand All @@ -67,7 +67,7 @@ fn main() {

因为 `hello_world` 并没有被其它人调用,所以你可以将它改写成一个闭包:

```rust
```rust no_run
use ribir::prelude::*;

fn main() {
Expand All @@ -93,7 +93,7 @@ move |ctx!(): &BuildCtx| -> Widget {
使用 `fn_widget!` 改写 `hello_world` 例子:


```rust
```rust no_run
use ribir::prelude::*;

fn main() {
Expand Down Expand Up @@ -143,7 +143,7 @@ fn use_rdl(ctx!(): &BuildCtx) {

你可以在结构体字面量声明的 widget 中嵌入其它 `rdl!` 作为孩子,注意孩子总是被要求声明在父 widget 属性的后面,这是 `rdl!` 对格式的强制要求。

```rust
```rust no_run
use ribir::prelude::*;

fn main() {
Expand All @@ -166,7 +166,7 @@ fn main() {

`rdl!` 也允许你为已创建好的 widget 声明孩子:

```rust
```rust no_run
use ribir::prelude::*;

fn main() {
Expand Down Expand Up @@ -220,7 +220,7 @@ let _ = fn_widget! {

到这里,回顾前文的例子:

```rust
```rust no_run
use ribir::prelude::*;

fn main() {
Expand All @@ -244,7 +244,7 @@ fn main() {

现在用 `@` 改写上面的计数器的例子:

```rust
```rust no_run
use ribir::prelude::*;

fn main() {
Expand Down Expand Up @@ -279,7 +279,7 @@ fn main() {

现在,让我们引入状态来改造我们的例子。

```rust
```rust no_run
use ribir::prelude::*;

fn main() {
Expand Down Expand Up @@ -388,7 +388,7 @@ let sum = pipe!(*$a + *$b);

代码:

```rust
```rust no_run
use ribir::prelude::*;

fn main() {
Expand Down Expand Up @@ -452,7 +452,7 @@ pipe!{

假设你有一个简单的自动求和例子:

```rust
```rust no_run
use ribir::prelude::*;

fn main() {
Expand Down Expand Up @@ -500,7 +500,7 @@ fn main() {

你也可以用 `watch!` 来手动实现你的计数器:

```rust
```rust no_run
use ribir::prelude::*;

fn main() {
Expand Down Expand Up @@ -529,7 +529,7 @@ fn main() {

将计数器的例子改写成使用 `Compose` widget 的形式:

```rust
```rust no_run
use ribir::prelude::*;

struct Counter(usize);
Expand Down Expand Up @@ -569,7 +569,7 @@ Ribir 提供了一组内建 widget,让你可以配置基础的样式、响应

`Margin` 举例,假设你要为一个 `Text` 设置 10 像素的空白边距,代码如下:

```rust
```rust no_run
use ribir::prelude::*;

fn main() {
Expand All @@ -585,7 +585,7 @@ fn main() {

你其实不必显示声明一个 `Margin`, 你可以直接写成:

```rust
```rust no_run
use ribir::prelude::*;

fn main() {
Expand All @@ -601,7 +601,7 @@ fn main() {

当你通过声明式创建了一个 widget 后,你可以直接访问内建 widget 的字段,即使你并没有显示声明它们(如果你在代码中用到它们,相应的内建 widget 会被创建)。比如:

```rust
```rust no_run
use ribir::prelude::*;

fn main() {
Expand Down
6 changes: 1 addition & 5 deletions docs/zh/get_started/try_it.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ sidebar_position: 1

首先, 你需要安装 Rust,你可以参考 [Rust 官方文档](https://www.rust-lang.org/tools/install).

> 提示
>
> 目前 Ribir 只支持 Rust nightly 版本。 你可以使用 `rustup override set nightly` 切换到 nightly 通道。如果你还没有安装 nightly 通道,可以查看 [rustup Channels 文档](https://rust-lang.github.io/rustup/concepts/channels.html)
## 新建 Ribir 项目

然后,打开你的终端,创建一个新的 Rust 项目:
Expand All @@ -41,7 +37,7 @@ ribir = "@RIBIR_VERSION"

打开编辑器, 将 `src/main.rs` 文件修改为:

```rust
```rust no_run
// main.rs
use ribir::prelude::*;

Expand Down

0 comments on commit 8eca98d

Please sign in to comment.