credstash 0.9.2

Credstash is a utility for managing credentials in the AWS cloud
Documentation
name: Rust

on:
  push:
    branches: [main]
    tags:
      - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
  pull_request:

env:
  CARGO_TERM_COLOR: always
  CARGO_INCREMENTAL: 0
  CARGO_NET_RETRY: 10
  RUST_BACKTRACE: short
  RUSTUP_MAX_RETRIES: 10

jobs:
  checks:
    runs-on: ${{ matrix.os }}

    strategy:
      fail-fast: false
      matrix:
        os:
        - ubuntu-latest
        - macos-latest
        - windows-latest

        toolchain:
        - 1.70.0
        - stable

    steps:
    - uses: actions/checkout@v2
    - uses: actions-rs/toolchain@v1
      with:
        toolchain: ${{ matrix.toolchain }}
        profile: minimal
        override: true
        components: rustfmt, clippy
    - uses: Swatinem/rust-cache@v2
      with:
        key: ${{ runner.os }}-${{ hashFiles('Cargo.lock') }}-${{ matrix.toolchain }}
    - name: Build
      run: cargo build --tests
    - name: Run tests
      run: |
        cargo test --lib
        cargo test --doc
    - name: clippy
      run: cargo clippy -- --deny "warnings"
    - name: fmt
      run: cargo fmt -- --check

  linux-binary:
    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v2
    - uses: actions-rs/toolchain@v1
      with:
        toolchain: 1.70.0
        target: x86_64-unknown-linux-musl
        profile: minimal
        override: true
    - uses: Swatinem/rust-cache@v2
      with:
        key: ${{ runner.os }}-${{ hashFiles('Cargo.lock') }}-1.70.0-binary
        workspaces: |
          .
    - name: Install musl tools
      run: sudo apt-get update -y && sudo apt-get install -y musl-tools
    - name: Build
      run: |
        cargo build --release --target x86_64-unknown-linux-musl
        strip target/x86_64-unknown-linux-musl/release/rucredstash
    - name: Rename
      run: |
        mkdir artifacts
        cp target/x86_64-unknown-linux-musl/release/rucredstash artifacts/rucredstash-x86_64-unknown-linux-musl
    - uses: actions/upload-artifact@v2
      with:
        name: binaries
        path: artifacts/*
    - name: Release
      uses: softprops/action-gh-release@v1
      if: startsWith(github.ref, 'refs/tags/')
      with:
        files: artifacts/rucredstash-x86_64-unknown-linux-musl
        generate_release_notes: true

  macos-binary:
    runs-on: macos-latest

    steps:
    - uses: actions/checkout@v2
    - uses: actions-rs/toolchain@v1
      with:
        toolchain: 1.70.0
        profile: minimal
        override: true
    - uses: Swatinem/rust-cache@v2
      with:
        key: ${{ runner.os }}-${{ hashFiles('Cargo.lock') }}-1.70.0-binary
    - name: Build
      run: cargo build --release
    - name: Rename
      run: |
        mkdir artifacts
        cp target/release/rucredstash artifacts/rucredstash-x86_64-apple-darwin
    - uses: actions/upload-artifact@v2
      with:
        name: binaries
        path: artifacts/*
    - name: Release
      uses: softprops/action-gh-release@v1
      if: startsWith(github.ref, 'refs/tags/')
      with:
        files: artifacts/rucredstash-x86_64-apple-darwin
        generate_release_notes: true

  windows-binary:
    runs-on: windows-latest

    steps:
    - uses: actions/checkout@v2
    - uses: actions-rs/toolchain@v1
      with:
        toolchain: 1.70.0
        profile: minimal
        override: true
    - uses: Swatinem/rust-cache@v2
      with:
        key: ${{ runner.os }}-${{ hashFiles('Cargo.lock') }}-1.70.0-binary
    - name: Build
      run: cargo build --release
    - name: Rename
      run: |
        mkdir artifacts
        cp target/release/rucredstash.exe artifacts/rucredstash-x86_64-pc-windows-gnu.exe
    - uses: actions/upload-artifact@v2
      with:
        name: binaries
        path: artifacts/*
    - name: Release
      uses: softprops/action-gh-release@v1
      if: startsWith(github.ref, 'refs/tags/')
      with:
        files: artifacts/rucredstash-x86_64-pc-windows-gnu.exe
        generate_release_notes: true