name: main-ci

on:
  push:
    branches:
      - master
  pull_request:
    branches:
      - master

jobs:
  build:
    runs-on: ubuntu-latest

    strategy:
      matrix:
        python: [py27, py36, py37, py38, py39]

    steps:
      # checkout v2, with recursive submodule update
      - uses: actions/checkout@v2
        with:
          submodules: recursive

      # build the Docker image we use to run the tests
      - name: test.sh
        run: TOX_ARGS='-e ${{ matrix.python }}' ./test.sh

      # upload-artifact to save the output wheels
      - uses: actions/upload-artifact@v1
        with:
          name: ${{ matrix.python }}-wheel-output
          path: .tox/${{ matrix.python }}/dist/

  manpage:
    runs-on: ubuntu-latest

    steps:
      # checkout v2, with recursive submodule update
      - uses: actions/checkout@v2
        with:
          submodules: recursive

      # build the Docker image we use to run the tests
      - name: test.sh
        run: RUN_JOB=rst2man ./test.sh

      # upload-artifact to save the output wheels
      - uses: actions/upload-artifact@v2
        with:
          name: manpage-output
          path: dtrx.1
