Comments (6)
My recommendation has been that solving these types of problems are best handled in a dedicated resource, like crate-ci. I've not had much time for updating it lately. Though the crate-ci book doesn't reference Azure Pipelines, we have a separate page for azure pipelines and azure pipeline templates. I do need to link out to uploading tarballs to Github Releases.
i see it natural to also consolidate Github Action templates and documentation over there as well.
from book.
I think this is more for a "Rust CI book" rather than the CLI WG. Since if we did an example for GitHub Actions we would probably need to have one for Jenkins, Travis, Appveyor, and so on.
I do like the idea of a Rust CI book though, that would be really helpful!
from book.
Here is what I ended up with, in case it is helpful:
Run CI when pushing to branches for pull requeests
name: Pull request
on:
push:
branches-ignore:
- master
jobs:
verify:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Check
run: cargo check
- name: Test
run: cargo test
- name: Lint
run: cargo clippy --all-targets -- -D warnings
- name: Format
run: cargo fmt -- --check
- name: Publish
run: cargo publish --dry-run
Run CI and CD when merging pull requests to master
name: Merge
on:
push:
branches:
- master
jobs:
verify:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Check
run: cargo check
- name: Test
run: cargo test
- name: Lint
run: cargo clippy --all-targets -- -D warnings
- name: Format
run: cargo fmt -- --check
executable:
runs-on: ubuntu-latest
needs: [verify]
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Login
run: cargo login ${{ secrets.CRATE_REGISTRY_PAT }}
- name: Publish
if: success()
run: cargo publish
from book.
The documentation already has links to projects that contain GitHub Actions examples, but they are all deprecated or abandoned.
- trust is abandoned and doesn't work on GitHub Actions.
- wasm-pack (there are links to its Travis and Appveyor files, but it also uses GitHub Actions now) uses set-output, which is deprecated, uses actions-rs/toolchain, which is unmaintained (use dtolnay/rust-toolchain instead), and uses actions/create-release and actions/upload-release-asset, which are archived and use set-output.
- ripgrep (uses GitHub Actions now) uses an old, strange GITHUB_REF workaround (use github.ref_name or GITHUB_REF_NAME), and uses actions/create-release and actions/upload-release-asset (see above).
The best way to do things now on GitHub Actions is very simple:
- Use
${{ github.ref_name }}
(or$GITHUB_REF_NAME
) - Use cross
- Use the GitHub CLI in GitHub Actions workflows
Example: https://github.com/open-contracting/cardinal-rs/blob/main/.github/workflows/release.yml
from book.
I'd be willing to submit a pull request for this, but as a new Rust developer, I've been trying to find this information myself and am not sure how to do it.
from book.
It seems to me that CI could do something like:
cargo check
cargo test
cargo clippy
cargo fmt
cargo audit
And CD something like:
cargo doc
cargo build --release
# how to share executables to GitHub releases / packages?
But perhaps this would be better to put in the cargo book, not specific to Command Line apps?
rust-lang/cargo#7664
from book.
Related Issues (20)
- References to Cargo.toml in Testing chapter are wrong HOT 1
- Error expectation in "Testing CLI applications by running them" is slightly wrong. HOT 2
- Writeln! causes book code not to compile HOT 3
- Exercise solutions HOT 3
- Book: Section on autocompletion
- It isn't clear how to make subcommands that have subcommands. HOT 2
- Initial example Clap implementation has deprecation warnings - Command Line Applications In Rust HOT 2
- Remove cargo-rpm from reccommended packagers
- how to talk about relevant crates HOT 1
- Book: Section on config-description HOT 1
- TIP: new version of clap HOT 1
- Migrate away from exitcode HOT 9
- Recommend error_stack instead of anyhow HOT 2
- Testing section - cargo_bin no longer available HOT 1
- 2.2. Using config files feedback HOT 1
- Misunderstanding Jump from 1.4->1.5+ HOT 4
- First implementation of grrs fails with error[E0599] HOT 1
- Book section 1.6 testing does not work HOT 2
- 1.6 Testing : Test should pass rather than fail HOT 1
- Book: Testing.md code block not updated HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from book.