Skip to content

Commit

Permalink
chore(ribir): 🤖 update ci and fix doc test, close #523
Browse files Browse the repository at this point in the history
  • Loading branch information
M-Adoo authored and rchangelog[bot] committed Mar 27, 2024
1 parent 7d5f0a4 commit 319cbfe
Show file tree
Hide file tree
Showing 12 changed files with 64 additions and 55 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 }}
19 changes: 13 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
on:
merge_group:
pull_request:
types: [synchronize, labeled, reopened, ready_for_review]
push:
branches:
- master
Expand All @@ -14,25 +15,31 @@ env:
name: CI
jobs:
lint:
if: github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'B-test')
name: rust code lint
runs-on: ubuntu-latest
steps:
- name: Checkout sources
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
run: cargo fmt --all -- --check
- name: cargo clippy check
run: cargo clippy --all-targets --all-features -- -D warnings
- name: cargo check
run: cargo check
run: cargo clippy --all-targets --all-features -- -D warnings\
# Check with stable toolchain to ensure stable compilation
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- run: cargo check
self-host:
name: Test Suite
needs: lint
# Uses nightly toolchain to test all features, including nightly
uses: RibirX/share-workflows/.github/workflows/ribir-win-image-tests.yaml@main
doc-examples:
needs: lint
Expand All @@ -43,7 +50,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 +59,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 }}
6 changes: 6 additions & 0 deletions .github/pr-num.yml → .github/workflows/pr-num.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: pr number
permissions:
contents: write
pull-requests: write
on:
pull_request:
paths:
Expand Down Expand Up @@ -29,3 +30,8 @@ jobs:
git add .
git commit --amend --no-edit
git push -f
- run: gh pr edit "$NUMBER" --add-label "B-test"
env:
GH_TOKEN: ${{ secrets.RIBIR_RELEASE }}
GH_REPO: ${{ github.repository }}
NUMBER: ${{ github.event.pull_request.number }}
12 changes: 7 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,24 +25,26 @@ Please only add new entries below the [Unreleased](#unreleased---releasedate) he

## [@Unreleased] - @ReleaseDate

## [0.3.0-alpha.1](https://github.com/RibirX/Ribir/compare/ribir-v0.2.0-beta.1...ribir-v0.3.0-alpha.1) - 2024-03-27

### Features
- **ribir**: support stable Rust 1.77.0 (#552 @M-Adoo)


## [0.2.0-beta.1](https://github.com/RibirX/Ribir/compare/ribir-v0.1.0...ribir-v0.2.0-beta.1) - 2024-03-26

### 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.

### Documented

- fix broken links and format the example code (\#526 @M-Adoo)
- **ribir**: We no longer auto-generate the built-in list document, as `FatObj` lists all. Its API documentation is sufficient. (\#540 @M-Adoo)
- **Ribir**: Added guide "Using Ribir without 'DSL'" (\#545 @M-Adoo)
- **Ribir**: Added a roadmap. (\#550, @M-Adoo)
- **ribir**: Added guide "Using Ribir without 'DSL'" (\#545 @M-Adoo)
- **ribir**: Added a roadmap. (\#550, @M-Adoo)

### Breaking

Expand Down
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ keywords = ["gui", "ui", "declarative", "compose-ui"]
license = "MIT"
readme = "README.md"
version = "0.3.0-alpha.1"
package.rust-version = "1.77.0"

[workspace.dependencies]
ahash = "0.8.11"
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

0 comments on commit 319cbfe

Please sign in to comment.