Giter Club home page Giter Club logo

Comments (6)

epage avatar epage commented on July 16, 2024 3

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.

deg4uss3r avatar deg4uss3r commented on July 16, 2024 1

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.

trevordmiller avatar trevordmiller commented on July 16, 2024 1

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.

jpmckinney avatar jpmckinney commented on July 16, 2024 1

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.

trevordmiller avatar trevordmiller commented on July 16, 2024

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.

trevordmiller avatar trevordmiller commented on July 16, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.