cloud-copy 0.8.0

A library for copying files to and from cloud storage.
name: CI

on:
  push:
    branches:
      - main
  pull_request:

jobs:
  format:
    runs-on: ubuntu-22.04
    steps:
      - uses: actions/checkout@v4
      - name: Update Rust
        run: rustup update nightly && rustup default nightly
      - name: Install rustfmt
        run: rustup component add rustfmt
      - run: cargo fmt -- --check

  lint:
    runs-on: ubuntu-22.04
    steps:
      - uses: actions/checkout@v4
      - name: Update Rust
        run: rustup update stable && rustup default stable
      - name: Install clippy
        run: rustup component add clippy
      - run: cargo clippy --locked --all-features -- --deny warnings

  build:
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [ubuntu-latest, macos-latest, windows-latest]
    steps:
      - uses: actions/checkout@v4
      - name: Update Rust
        run: rustup update stable && rustup default stable
      - run: cargo build --locked --all --all-features

  test:
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [ubuntu-latest]
    steps:
      - uses: actions/checkout@v4
      - name: Install Azure CLI
        run: curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
      - name: Start LocalStack (AWS S3)
        run: |
          container=$(docker create -p 4566:4566 localstack/localstack:s3-latest)
          docker start $container
          sleep 5
          docker logs $container
      - name: Start Azurite (Azure Storage)
        run: |
          container=$(docker create -p 10000:10000 mcr.microsoft.com/azure-storage/azurite azurite -l /data --blobHost 0.0.0.0 --loose --skipApiVersionCheck)
          docker start $container
          sleep 5
          docker logs $container
      - name: Create test AWS S3 bucket
        run: |
          AWS_ACCESS_KEY_ID=test AWS_SECRET_ACCESS_KEY=test AWS_DEFAULT_REGION=${DEFAULT_REGION:-$AWS_DEFAULT_REGION} aws --endpoint-url=http://localhost:4566 s3api create-bucket --bucket cloud-copy-test
      - name: Create test Azure Storage container
        run: |
          az storage container create --name cloud-copy-test --connection-string "DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://localhost:10000/devstoreaccount1"
      - name: Update Rust
        run: rustup update stable && rustup default stable
      - run: cargo test --locked --all-features

  test-examples:
    runs-on: ubuntu-22.04
    steps:
      - uses: actions/checkout@v4
      - name: Update Rust
        run: rustup update stable && rustup default stable
      - run: cargo test --locked --all-features --examples

  docs:
    runs-on: ubuntu-22.04
    steps:
      - uses: actions/checkout@v4
      - name: Update Rust
        run: rustup update stable && rustup default stable
      - run: cargo doc --locked --all-features

  msrv:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Update Rust
        run: rustup update stable && rustup default stable
      - name: Install cargo-binstall
        run: curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
      - name: Install cargo-msrv
        run: cargo binstall -y --version 0.16.0-beta.23 cargo-msrv
      - name: Verify the MSRV
        run: cargo msrv verify --output-format minimal --all-features