actions-rs / meta

🦀 GitHub Actions for Rust - recipes, discussions, questions and ideas
https://github.com/actions-rs
Creative Commons Zero v1.0 Universal
353 stars 15 forks source link

[question] How to use different features on different toolchains? #18

Closed WaffleLapkin closed 4 years ago

WaffleLapkin commented 4 years ago

I was trying to setup CI using gt actions (for the start I copy-pasted matrix example) and ran into a problem.

For my nightly and stable build I need different cargo-features (like --features "a" and --features "stable a") for all commands (build, test, fmt, clippy).

How can I do that? Maybe it's possible to change env depending on toolchain and then use paste env into commands?

svartalf commented 4 years ago

From my understanding, the only reasonable option for now is to use two different steps with if directive, sort of:

steps:
  - name: stable build 
    uses: actions-rs/cargo@v1
    if: matrix.rust == 'stable'
    with:
      args: --features "stable a" 
  - name: nightl build 
    uses: actions-rs/cargo@v1
    if: matrix.rust == 'nightly'
    with:
      args: --features "a" 

Also, consider using the GitHub community forum, please, as this question seems to be unrelated to the Rust Actions, but mostly related to Actions workflow syntax in a whole.