Skip to content

Commit 115b616

Browse files
committed
Fix liquid linting errors
1 parent 9137ccf commit 115b616

File tree

1 file changed

+11
-14
lines changed

1 file changed

+11
-14
lines changed

content/actions/use-cases-and-examples/building-and-testing/building-and-testing-rust.md

+11-14
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ We recommend that you have a basic understanding of the Rust language. For more
4646

4747
## Specifying a Rust version
4848

49-
At the time of writing, the default rust compiler version is 1.83.0 rustup is available and can be used to install additional toolchains. For example, the following workflow temporarily sets the toolchain to nightly:
49+
At the time of writing, the default rust compiler version is 1.83.0 rustup is available and can be used to install additional toolchains.
5050

5151
```yaml copy
5252
- name: Temporarily modify the rust toolchain version
@@ -61,21 +61,22 @@ You can cache and restore dependencies using the following example below. Note t
6161
6262
```yaml copy
6363
- name: ⚡ Cache
64-
uses: actions/cache@v4
64+
- uses: {% data reusables.actions.action-cache %}
6565
with:
6666
path: |
6767
~/.cargo/registry
6868
~/.cargo/git
6969
target
70-
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
70+
key: {% raw %} ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
71+
{% endraw %}
7172
```
73+
7274
If you have a custom requirement or need finer controls for caching, you can take a look at the [`cache` action](https://github.com/marketplace/actions/cache). For more information, see [AUTOTITLE](/actions/using-workflows/caching-dependencies-to-speed-up-workflows).
7375

7476
## Building and testing your code
7577

7678
You can use the same commands that you use locally to build and test your code. This example workflow demonstrates how to use `cargo build` and `cargo test` in a job:
7779

78-
7980
```yaml copy
8081
jobs:
8182
build:
@@ -86,36 +87,32 @@ jobs:
8687
outputs:
8788
release_built: ${{ steps.set-output.outputs.release_built }}
8889
steps:
89-
- uses: actions/checkout@v4
90+
- uses: {% data reusables.actions.action-checkout %}
9091
- name: Build binaries in "${{ matrix.BUILD_TARGET }}" mode
9192
run: cargo build --profile ${{ matrix.BUILD_TARGET }}
9293
- name: Run tests in "${{ matrix.BUILD_TARGET }}" mode
9394
run: cargo test --profile ${{ matrix.BUILD_TARGET }}
9495
```
96+
9597
Note that the `release` keyword used above, corresponds to a cargo profile. You can use any [profile](https://doc.rust-lang.org/cargo/reference/profiles.html) you have defined in your `Cargo.toml` file.
9698

9799
## Upload artifacts
98100

99101
In case publishing artifacts is needed, but not to crates.io, the following example demonstrates how to upload artifacts to the workflow run:
102+
100103
```yaml copy
101-
- name: Upload Telegram Bot
102-
uses: actions/upload-artifact@v4
103-
with:
104-
name: cndk8-telegram-bot
105-
path: target/${{ matrix.BUILD_TARGET }}/telegram
106104
- name: Upload hello app
107-
uses: actions/upload-artifact@v4
105+
uses: {% data reusables.actions.action-upload-artifact %}
108106
with:
109107
name: cndk8-hello
110108
path: target/${{ matrix.BUILD_TARGET }}/cndk8
111109
```
112110

113111
And to use them on a different job, i.e publishing:
114112

115-
116113
```yaml copy
117114
- name: Download hello app
118-
uses: actions/download-artifact@v4
115+
uses: {% data reusables.actions.action-download-artifact %}
119116
with:
120117
name: cndk8-hello
121118
path: ./cndk8-hello
@@ -132,7 +129,6 @@ And to use them on a different job, i.e publishing:
132129
Once you have setup your workflow to build and test your code, you can alternatively use a secret to login to crates.io and publish your package.
133130

134131
```yaml copy
135-
- uses: actions/checkout@v4
136132
- name: login into crates.io
137133
run: cargo login ${{ secrets.CRATES_IO }}
138134
- name: Build binaries in "release" mode
@@ -142,5 +138,6 @@ Once you have setup your workflow to build and test your code, you can alternati
142138
- name: "Publish to crates.io"
143139
run: cargo publish # publishes your crate as a library that can be added as a dependency
144140
```
141+
145142
As an example of how packages are published, see the [cndk8 0.1.0](https://crates.io/crates/cndk8/0.1.0). In the case that there are errors with Metadata check
146143
your [manifest](https://doc.rust-lang.org/cargo/reference/manifest.html) Cargo.toml, when its about dirty directory check your Cargo.lock, and read the corresponding documentation.

0 commit comments

Comments
 (0)