Skip to content

Commit 47b869c

Browse files
committed
Auto merge of #10212 - SamMorrowDrums:patch-1, r=alexcrichton
[docs] Adds basic CI yaml for GitHub Actions Currently there is no documentation for GitHub Actions, so I have attempted to add an Actions Workflow that is equivalent to the other CI snippets in the file. You can view a successful run of this Action in my repo for experimenting with this here: https://github.com/SamMorrowDrums/rust-action-test/actions/runs/1593666172 The Rust code I tested it with is just the boilerplate from `cargo init`.
2 parents 3787309 + deee87c commit 47b869c

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

src/doc/src/guide/continuous-integration.md

+34
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,40 @@ will not fail your overall build. Please see the [Travis CI Rust
2121
documentation](https://docs.travis-ci.com/user/languages/rust/) for more
2222
information.
2323
24+
### GitHub Actions
25+
26+
To test your package on GitHub Actions, here is a sample `.github/workflows/ci.yml` file:
27+
28+
```yaml
29+
name: Cargo Build & Test
30+
31+
on:
32+
push:
33+
pull_request:
34+
35+
env:
36+
CARGO_TERM_COLOR: always
37+
38+
jobs:
39+
build_and_test:
40+
name: Rust project - latest
41+
runs-on: ubuntu-latest
42+
strategy:
43+
matrix:
44+
toolchain:
45+
- stable
46+
- beta
47+
- nightly
48+
steps:
49+
- uses: actions/checkout@v2
50+
- run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}
51+
- run: cargo build --verbose
52+
- run: cargo test --verbose
53+
54+
```
55+
56+
This will test all three release channels (note a failure in any toolchain version will fail the entire job). You can also click `"Actions" > "new workflow"` in the GitHub UI and select Rust to add the [default configuration](https://github.com/actions/starter-workflows/blob/main/ci/rust.yml) to your repo. See [GitHub Actions documentation](https://docs.github.com/en/actions) for more information.
57+
2458
### GitLab CI
2559

2660
To test your package on GitLab CI, here is a sample `.gitlab-ci.yml` file:

0 commit comments

Comments
 (0)