arloader 0.1.63

Command line application and library for uploading files to Arweave.
Documentation
name: build status
on:
  push:
    branches:
      - master
      - dev
    tags:
      - "v*.*.*"
  pull_request:
    branches:
      - master
      - dev
jobs:
  LinuxBuild:
    runs-on: ${{ matrix.host_os }}
    env:
      AR_BASE_URL: http://localhost:1984
      AR_KEYPAIR_PATH: tests/fixtures/arweave-keyfile-MlV6DeOtRmakDOf6vgOBlif795tcWimgyPsYYNQ8q1Y.json
      
    services:
      arlocal:
          image: calebeverett/arlocal
          ports:
            - 1984:1984
    strategy:
      matrix:
        target:
          - x86_64-unknown-linux-gnu
        include:
          - target: x86_64-unknown-linux-gnu
            host_os: ubuntu-18.04
    steps:
      - if: contains(matrix.host_os, 'ubuntu')
        run: sudo apt-get update -y

      - uses: actions/checkout@v2

      - if: ${{ !contains(matrix.host_os, 'windows') }}
        run: mk/install-build-tools.sh --target=${{ matrix.target }}

      - if: contains(matrix.host_os, 'windows')
        run: ./mk/install-build-tools.ps1

      - uses: actions-rs/toolchain@v1
        with:
          toolchain: nightly
          target: ${{ matrix.target }}
          override: true
      - uses: actions-rs/cargo@v1
        with:
          use-cross: false
          command: build
          args: --target ${{ matrix.target }} --release
      - uses: actions-rs/cargo@v1
        with:
          use-cross: false
          command: test
          args: --target ${{ matrix.target }} -- --nocapture
      - name: Commands
        run: |
          curl http://localhost:1984/mint/MlV6DeOtRmakDOf6vgOBlif795tcWimgyPsYYNQ8q1Y/100000000000000
          mkdir target/nfts
          mkdir target/nfts/status
          cp tests/fixtures/[0-9].* target/nfts/
          target/${{ matrix.target }}/release/arloader balance
          target/${{ matrix.target }}/release/arloader estimate target/nfts/*.png
          target/${{ matrix.target }}/release/arloader upload target/nfts/*.png --log-dir target/nfts/status
          target/${{ matrix.target }}/release/arloader list-status target/nfts/status
          target/${{ matrix.target }}/release/arloader update-status target/nfts/status
          target/${{ matrix.target }}/release/arloader upload-manifest target/nfts/status
          target/${{ matrix.target }}/release/arloader upload-nfts target/nfts/*.png
          target/${{ matrix.target }}/release/arloader upload target/nfts/*.png --log-dir target/nfts/status --no-bundle
          target/${{ matrix.target }}/release/arloader list-status target/nfts/status --file-paths target/nfts/*.png --no-bundle
          target/${{ matrix.target }}/release/arloader status-report target/nfts/status --file-paths target/nfts/*.png --no-bundle
          target/${{ matrix.target }}/release/arloader update-status target/nfts/status --file-paths target/nfts/*.png --no-bundle
      - name: Paths
        id: paths
        shell: bash
        if: startsWith(github.ref, 'refs/tags/')
        run: |
          extension=""
          if ${{ contains(matrix.host_os, 'windows') }}; then
            extension=".exe"
          fi
          build_path="target/${{ matrix.target }}/release/arloader${extension}"
          artifact_path="arloader-${GITHUB_REF#refs/tags/}-${{ matrix.target }}.zip"
          echo "::set-output name=build_path::${build_path}"
          echo "::set-output name=artifact_path::${artifact_path}"
      - name: Zip
        shell: bash
        if: startsWith(github.ref, 'refs/tags/')
        run: |
          if ${{ contains(matrix.host_os, 'windows') }}
          then
            7z a -tzip ${{ steps.paths.outputs.artifact_path }} ./${{ steps.paths.outputs.build_path }} README.md
          else
            zip ${{ steps.paths.outputs.artifact_path }} ${{ steps.paths.outputs.build_path }} README.md -j
          fi
      - name: Release
        uses: softprops/action-gh-release@v1
        if: startsWith(github.ref, 'refs/tags/')
        with:
          files: |
            ${{ steps.paths.outputs.artifact_path }}
            LICENSE
      - name: Publish
        uses: actions-rs/cargo@v1
        if: startsWith(github.ref, 'refs/tags/')
        with:
          use-cross: false
          command: publish
          args: --token ${{ secrets.CARGO_TOKEN }} 
  
  # Same job as above except:
  # - No service for arlocal integration tests - only supported on linux runners.
  # - Not published to crates.io.
  # - LICENSE not added to release artifacts since added above.
  MacWinBuild:
    runs-on: ${{ matrix.host_os }}
    strategy:
      matrix:
        target:
          - x86_64-apple-darwin
          # - x86_64-pc-windows-msvc
        include:
          - target: x86_64-apple-darwin
            host_os: macos-latest

          # - target: x86_64-pc-windows-msvc
          #   host_os: windows-latest

    steps:
      - if: contains(matrix.host_os, 'ubuntu')
        run: sudo apt-get update -y

      - uses: actions/checkout@v2

      - if: ${{ !contains(matrix.host_os, 'windows') }}
        run: mk/install-build-tools.sh --target=${{ matrix.target }}

      - if: contains(matrix.host_os, 'windows')
        run: ./mk/install-build-tools.ps1

      - uses: actions-rs/toolchain@v1
        with:
          toolchain: nightly
          target: ${{ matrix.target }}
          override: true
      - uses: actions-rs/cargo@v1
        with:
          use-cross: false
          command: build
          args: --target ${{ matrix.target }} --release
      - uses: actions-rs/cargo@v1
        with:
          use-cross: false
          command: test
          args: --target ${{ matrix.target }}
      - name: Paths
        id: paths
        shell: bash
        if: startsWith(github.ref, 'refs/tags/')
        run: |
          extension=""
          if ${{ contains(matrix.host_os, 'windows') }}; then
            extension=".exe"
          fi
          build_path="target/${{ matrix.target }}/release/arloader${extension}"
          artifact_path="arloader-${GITHUB_REF#refs/tags/}-${{ matrix.target }}.zip"
          echo "::set-output name=build_path::${build_path}"
          echo "::set-output name=artifact_path::${artifact_path}"
      - name: Zip
        shell: bash
        if: startsWith(github.ref, 'refs/tags/')
        run: |
          if ${{ contains(matrix.host_os, 'windows') }}
          then
            7z a -tzip ${{ steps.paths.outputs.artifact_path }} ./${{ steps.paths.outputs.build_path }} README.md
          else
            zip ${{ steps.paths.outputs.artifact_path }} ${{ steps.paths.outputs.build_path }} README.md -j
          fi
      - name: Release
        uses: softprops/action-gh-release@v1
        if: startsWith(github.ref, 'refs/tags/')
        with:
          files: |
            ${{ steps.paths.outputs.artifact_path }}