torrust-index-backend 2.0.0-alpha.3

The backend (API) for the Torrust Index project.
Documentation
name: Publish Github Release

on:
  push:
    branches:
      - main

jobs:
  test:
    runs-on: ubuntu-latest
    env:
      CARGO_TERM_COLOR: always
    steps:
      - uses: actions/checkout@v2
      - uses: actions-rs/toolchain@v1
        with:
          profile: minimal
          toolchain: stable
      - name: Run databases
        working-directory: ./tests
        run: docker-compose up -d
      - name: Wait for databases to start
        run: sleep 15s
        shell: bash
      - uses: Swatinem/rust-cache@v1
      - name: Install torrent edition tool (needed for testing)
        run: cargo install imdl      
      - name: Run tests
        run: cargo test
      - name: Stop databases
        working-directory: ./tests
        run: docker-compose down

  tag:
    needs: test
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Determine tag
        id: tag
        run: echo "::set-output name=release_tag::v$(grep -m 1 'version' Cargo.toml | awk '{print $3}' | tr -d '/"')"
    outputs:
      release_tag: ${{ steps.tag.outputs.release_tag }}

  build:
    needs: tag
    name: Build ${{ matrix.target }}
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        include:
          - target: x86_64-pc-windows-gnu
            archive: zip
            name: ${{ github.event.repository.name }}_${{ needs.tag.outputs.release_tag }}_x86_64-pc-windows-gnu
          - target: x86_64-unknown-linux-musl
            archive: tar.gz tar.xz
            name: ${{ github.event.repository.name }}_${{ needs.tag.outputs.release_tag }}_x86_64-unknown-linux-musl
          - target: x86_64-apple-darwin
            archive: zip
            name: ${{ github.event.repository.name }}_${{ needs.tag.outputs.release_tag }}_x86_64-apple-darwin
    steps:
      - uses: actions/checkout@master
      - name: Compile builds
        id: compile
        uses: rust-build/rust-build.action@v1.3.2
        with:
          RUSTTARGET: ${{ matrix.target }}
          ARCHIVE_TYPES: ${{ matrix.archive }}
          ARCHIVE_NAME: ${{ matrix.name }}
          UPLOAD_MODE: none
      - name: Upload artifact
        uses: actions/upload-artifact@v3
        with:
          name: torrust-index-backend
          path: |
            ${{ steps.compile.outputs.BUILT_ARCHIVE }}
            ${{ steps.compile.outputs.BUILT_CHECKSUM }}

  release:
    needs: [tag, build]
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Download builds
        uses: actions/download-artifact@v2
        with:
          name: torrust-index-backend
          path: torrust-index-backend
      - name: Release
        uses: softprops/action-gh-release@v1
        with:
          generate_release_notes: true
          tag_name: ${{ needs.tag.outputs.release_tag }}
          files: |
            torrust-index-backend/*
            LICENSE