|
| 1 | +# ------------------------------------------------------------------------------------- |
| 2 | +# Summary: Test the external CLI usage of this project. |
| 3 | +# Created: 2021-11-20 18:44:48 |
| 4 | +# Author: Bryant Finney <[email protected]> (https://bryant-finney.github.io/about) |
| 5 | +# ------------------------------------------------------------------------------------- |
| 6 | +name: Test Usage |
| 7 | + |
| 8 | +on: |
| 9 | + push: |
| 10 | + pull_request: |
| 11 | + workflow_dispatch: |
| 12 | + release: |
| 13 | + types: [published] |
| 14 | + |
| 15 | +jobs: |
| 16 | + build: |
| 17 | + name: Build wheel |
| 18 | + outputs: |
| 19 | + wheel: ${{ steps.build.outputs.wheel }} |
| 20 | + |
| 21 | + runs-on: ubuntu-latest |
| 22 | + steps: |
| 23 | + - uses: actions/checkout@v2 |
| 24 | + - uses: actions/setup-python@v2 |
| 25 | + |
| 26 | + - name: Prepare build system |
| 27 | + run: pip install --upgrade pip setuptools wheel |
| 28 | + |
| 29 | + - name: Build wheel and source distribution 🛠️ |
| 30 | + id: build |
| 31 | + run: | |
| 32 | + python setup.py sdist bdist_wheel |
| 33 | + echo "::set-output name=wheel::$(ls ./dist/*.whl)" |
| 34 | +
|
| 35 | + - name: Upload build artifacts ⬆️ |
| 36 | + uses: actions/upload-artifact@v2 |
| 37 | + with: |
| 38 | + name: dist |
| 39 | + path: dist/*.whl |
| 40 | + |
| 41 | + test-install: |
| 42 | + name: "${{ matrix.os }} | py${{ matrix.py }}: ${{ matrix.manager }} install ${{ needs.build.outputs.wheel }}[${{ matrix.extras }}]" |
| 43 | + needs: build |
| 44 | + runs-on: ${{ matrix.os }} |
| 45 | + strategy: |
| 46 | + fail-fast: false |
| 47 | + matrix: |
| 48 | + extras: ["", "dev", "black", "autopep8"] |
| 49 | + manager: [pip, pipenv] |
| 50 | + os: [ubuntu-latest, windows-latest, macos-latest] |
| 51 | + py: [3.7, 3.8] |
| 52 | + |
| 53 | + steps: |
| 54 | + - uses: actions/setup-python@v2 |
| 55 | + with: |
| 56 | + python-version: ${{ matrix.py }} |
| 57 | + |
| 58 | + - name: Update ${{ matrix.manager }} |
| 59 | + run: echo "${{ matrix.manager }}" | grep pipenv | xargs pip install --upgrade pip |
| 60 | + |
| 61 | + - name: Download build artifacts ⬇️ |
| 62 | + uses: actions/download-artifact@v2 |
| 63 | + with: |
| 64 | + name: dist |
| 65 | + path: dist |
| 66 | + |
| 67 | + - name: Install using ${{ matrix.manager }} ➕ |
| 68 | + if: "!${{ matrix.extras }}" |
| 69 | + run: ${{ matrix.manager }} install "${{ needs.build.outputs.wheel }}" |
| 70 | + |
| 71 | + - name: Install (with [${{ matrix.extras }}] extras) using ${{ matrix.manager }} ➕ |
| 72 | + if: ${{ matrix.extras }} |
| 73 | + run: ${{ matrix.manager }} install "${{ needs.build.outputs.wheel }}[${{ matrix.extras }}]" |
| 74 | + |
| 75 | + - name: "Verify ${{ matrix.extras }} installation (${{ matrix.manager }}) 🖨️" |
| 76 | + if: ${{ matrix.manager == 'pip' && matrix.extras && matrix.extras != 'dev' }} |
| 77 | + run: ${{ matrix.extras }} --version |
| 78 | + |
| 79 | + - name: "Verify ${{ matrix.extras }} installation (${{ matrix.manager }}) 🖨️" |
| 80 | + if: ${{ matrix.manager == 'pipenv' && matrix.extras && matrix.extras != 'dev' }} |
| 81 | + run: pipenv run ${{ matrix.extras }} --version |
| 82 | + |
| 83 | + - name: "Verify package installation (${{ matrix.manager }}) 🖨️" |
| 84 | + if: ${{ matrix.manager == 'pip' }} |
| 85 | + run: pipenv-setup --help |
| 86 | + |
| 87 | + - name: "Verify installation (${{ matrix.manager }}) 🖨️" |
| 88 | + if: ${{ matrix.manager == 'pipenv' }} |
| 89 | + run: pipenv run pipenv-setup --help |
0 commit comments