tinyget 1.0.1

Tiny HTTP(S) GET
Documentation
name: ci

on: [push, pull_request]

jobs:
  build:
    name: ${{ matrix.kind }} ${{ matrix.os }}
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [macOS-latest, ubuntu-latest, windows-latest]

      # Always run main branch builds to completion. This allows the cache to
      # stay mostly up-to-date in situations where a single job fails due to
      # e.g. a flaky test.
      # Don't fast-fail on tag build because publishing binaries shouldn't be
      # prevented if 'cargo publish' fails (which can be a false negative).
      fail-fast:
        ${{ github.event_name == 'pull_request' || (github.ref !=
        'refs/heads/main' && !startsWith(github.ref, 'refs/tags/')) }}

    env:
      CARGO_INCREMENTAL: 0
      RUST_BACKTRACE: full
      CARGO_TERM_COLOR: always

    steps:
      - name: Clone repository
        uses: actions/checkout@v2

      - name: Install stable toolchain
        uses: actions-rs/toolchain@v1
        with:
          profile: minimal
          toolchain: stable
          override: true
          components: rustfmt, clippy

      - name: Install rust
        uses: hecrj/setup-rust-action@v1

      - name: Install clippy and rustfmt
        run: |
          rustup component add clippy
          rustup component add rustfmt

      - name: Log versions
        run: |
          rustc --version
          cargo --version

      - name: Configure cargo data directory
        # After this point, all cargo registry and crate data is stored in
        # $GITHUB_WORKSPACE/.cargo_home. This allows us to cache only the files
        # that are needed during the build process. Additionally, this works
        # around a bug in the 'cache' action that causes directories outside of
        # the workspace dir to be saved/restored incorrectly.
        run: |
          echo "CARGO_HOME=$(pwd)/.cargo_home" >> $GITHUB_ENV

      - name: Run cargo fmt
        run: cargo fmt -- --check

      - name: Run cargo clippy
        run: cargo clippy -- -D warnings

      - name: Run cargo test
        run: cargo test

      - name: Run cargo test with feature https
        run: cargo test --features "https"

      - name: Build release
        run: cargo build --release

      - name: Build release with feature https
        run: cargo build --release --features "https"

      - name: Publish
        if: |
          startsWith(matrix.os, 'ubuntu') &&
          startsWith(github.repository, 'justjavac') &&
          startsWith(github.ref, 'refs/tags/')
        env:
          CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
        run: |
          cargo publish