|
| 1 | +name: Run Tests |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - "main" |
| 7 | + tags: |
| 8 | + - "v*.*.*" |
| 9 | + pull_request: |
| 10 | + workflow_dispatch: |
| 11 | + |
| 12 | +jobs: |
| 13 | + tests: |
| 14 | + name: Python ${{ matrix.python-version }} • ${{ matrix.os }} |
| 15 | + runs-on: ${{ matrix.os }} |
| 16 | + strategy: |
| 17 | + matrix: |
| 18 | + python-version: [3.7, 3.8, 3.9, "3.10"] |
| 19 | + os: [ubuntu-latest, macos-latest, windows-latest] |
| 20 | + # python-version: [3.7, 3.8, 3.9] |
| 21 | + # os: [windows-latest] |
| 22 | + exclude: |
| 23 | + - os: macos-latest |
| 24 | + python-version: 3.7 |
| 25 | + - os: windows-latest |
| 26 | + python-version: 3.7 |
| 27 | + - os: macos-latest |
| 28 | + python-version: 3.8 |
| 29 | + - os: windows-latest |
| 30 | + python-version: 3.8 |
| 31 | + - os: macos-latest |
| 32 | + python-version: 3.9 |
| 33 | + - os: windows-latest |
| 34 | + python-version: 3.9 |
| 35 | + |
| 36 | + steps: |
| 37 | + - run: echo ${{github.ref}} |
| 38 | + |
| 39 | + - uses: actions/checkout@v2 |
| 40 | + |
| 41 | + - name: Set up FFmpeg |
| 42 | + uses: FedericoCarboni/setup-ffmpeg@v1 |
| 43 | + with: |
| 44 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 45 | + |
| 46 | + - name: Setup Python ${{ matrix.python-version }} |
| 47 | + uses: actions/setup-python@v2 |
| 48 | + with: |
| 49 | + python-version: ${{ matrix.python-version }} |
| 50 | + architecture: ${{ matrix.arch }} |
| 51 | + |
| 52 | + - name: Setup Python dependencies |
| 53 | + run: | |
| 54 | + python -m pip install -U pip setuptools wheel |
| 55 | + pip install -r tests/requirements.txt pytest-github-actions-annotate-failures |
| 56 | + pip install pytest-github-actions-annotate-failures |
| 57 | +
|
| 58 | + - name: Install ffmpegio package |
| 59 | + run: pip install -q . |
| 60 | + |
| 61 | + - name: Run tests |
| 62 | + run: pytest -vv |
| 63 | + |
| 64 | + distribute: |
| 65 | + name: Distribution |
| 66 | + runs-on: ubuntu-latest |
| 67 | + needs: tests |
| 68 | + if: startsWith(github.ref, 'refs/tags') |
| 69 | + steps: |
| 70 | + - uses: actions/checkout@v2 |
| 71 | + |
| 72 | + - name: Setup Python |
| 73 | + uses: actions/setup-python@v2 |
| 74 | + with: |
| 75 | + python-version: "3.x" # Version range or exact version of a Python version to use, using SemVer's version range syntax |
| 76 | + |
| 77 | + - name: Setup Python dependencies |
| 78 | + run: | |
| 79 | + python -m pip install -U pip setuptools |
| 80 | + pip install -U build |
| 81 | +
|
| 82 | + - name: Build a binary wheel and a source tarball |
| 83 | + run: python -m build --sdist --wheel --outdir dist/ . |
| 84 | + |
| 85 | + - name: add python distribution files to release |
| 86 | + uses: softprops/action-gh-release@v1 |
| 87 | + with: |
| 88 | + files: dist/* |
| 89 | + env: |
| 90 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 91 | + |
| 92 | + # - name: Publish distribution 📦 to Test PyPI |
| 93 | + # uses: pypa/gh-action-pypi-publish@master |
| 94 | + # with: |
| 95 | + # password: ${{ secrets.TEST_PYPI_API_TOKEN }} |
| 96 | + # repository_url: https://test.pypi.org/legacy/ |
| 97 | + # skip_existing: true |
| 98 | + |
| 99 | + - name: Publish distribution 📦 to PyPI |
| 100 | + uses: pypa/gh-action-pypi-publish@master |
| 101 | + with: |
| 102 | + password: ${{ secrets.PYPI_API_TOKEN }} |
0 commit comments