Skip to content

Commit

Permalink
Auto merge of rust-lang#10212 - SamMorrowDrums:patch-1, r=alexcrichton
Browse files Browse the repository at this point in the history
[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`.
  • Loading branch information
bors committed Dec 20, 2021
2 parents 3787309 + deee87c commit 47b869c
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions src/doc/src/guide/continuous-integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,40 @@ will not fail your overall build. Please see the [Travis CI Rust
documentation](https://docs.travis-ci.com/user/languages/rust/) for more
information.
### GitHub Actions
To test your package on GitHub Actions, here is a sample `.github/workflows/ci.yml` file:

```yaml
name: Cargo Build & Test
on:
push:
pull_request:
env:
CARGO_TERM_COLOR: always
jobs:
build_and_test:
name: Rust project - latest
runs-on: ubuntu-latest
strategy:
matrix:
toolchain:
- stable
- beta
- nightly
steps:
- uses: actions/checkout@v2
- run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}
- run: cargo build --verbose
- run: cargo test --verbose
```

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.

### GitLab CI

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

0 comments on commit 47b869c

Please sign in to comment.