|
| 1 | +# Generated by seam-plop |
| 2 | +name: Python Test |
| 3 | +on: |
| 4 | + push: |
| 5 | + workflow_dispatch: |
| 6 | + inputs: |
| 7 | + sdkSha: |
| 8 | + description: "SHA of the seamapi-python commit to run against" |
| 9 | + type: string |
| 10 | + required: false |
| 11 | + connectSha: |
| 12 | + description: "SHA of the seam-connect commit to run against" |
| 13 | + type: string |
| 14 | + required: false |
| 15 | + prRepo: |
| 16 | + description: "Repository of PR context (needed when leaving comments)" |
| 17 | + type: string |
| 18 | + required: false |
| 19 | + prNumber: |
| 20 | + description: "PR number (needed when leaving comments)" |
| 21 | + type: string |
| 22 | + |
| 23 | +jobs: |
| 24 | + test: |
| 25 | + runs-on: ubuntu-latest |
| 26 | + env: |
| 27 | + CONTAINER_REGISTRY: "registry.digitalocean.com" |
| 28 | + RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} |
| 29 | + steps: |
| 30 | + - name: Checkout |
| 31 | + uses: actions/checkout@v2 |
| 32 | + with: |
| 33 | + ref: ${{ github.event.inputs.sdkSha }} |
| 34 | + - name: Login to DO container registry |
| 35 | + uses: docker/login-action@v1 |
| 36 | + with: |
| 37 | + registry: ${{ env.CONTAINER_REGISTRY }} |
| 38 | + username: ${{ secrets.DIGITAL_OCEAN_TOKEN }} |
| 39 | + password: ${{ secrets.DIGITAL_OCEAN_TOKEN }} |
| 40 | + - name: Pre-pull Seam Connect image |
| 41 | + run: docker pull ${{ env.CONTAINER_REGISTRY }}/seam/seam-connect:${{ github.event.inputs.connectSha || 'latest' }} |
| 42 | + - uses: actions/setup-python@v2 |
| 43 | + with: |
| 44 | + python-version: 3.8 |
| 45 | + - name: Install Poetry |
| 46 | + uses: snok/install-poetry@v1 |
| 47 | + - if: ${{ github.event.inputs.prNumber }} |
| 48 | + uses: marocchino/sticky-pull-request-comment@v2 |
| 49 | + with: |
| 50 | + number: ${{ github.event.inputs.prNumber }} |
| 51 | + repo: ${{ github.event.inputs.prRepo }} |
| 52 | + GITHUB_TOKEN: ${{ secrets.BOT_GH_TOKEN }} |
| 53 | + message: | |
| 54 | + ⌛️ [running Python SDK tests](${{ env.RUN_URL }})... |
| 55 | + - run: poetry install |
| 56 | + - run: poetry run pytest -s |
| 57 | + - name: Comment on failure |
| 58 | + if: ${{ github.event.inputs.prNumber && failure() }} |
| 59 | + uses: marocchino/sticky-pull-request-comment@v2 |
| 60 | + with: |
| 61 | + number: ${{ github.event.inputs.prNumber }} |
| 62 | + repo: ${{ github.event.inputs.prRepo }} |
| 63 | + GITHUB_TOKEN: ${{ secrets.BOT_GH_TOKEN }} |
| 64 | + message: | |
| 65 | + ⛔️ [Python SDK tests failed](${{ env.RUN_URL }}). |
| 66 | +
|
| 67 | + - name: Comment on success |
| 68 | + if: ${{ github.event.inputs.prNumber && success() }} |
| 69 | + uses: marocchino/sticky-pull-request-comment@v2 |
| 70 | + with: |
| 71 | + number: ${{ github.event.inputs.prNumber }} |
| 72 | + repo: ${{ github.event.inputs.prRepo }} |
| 73 | + GITHUB_TOKEN: ${{ secrets.BOT_GH_TOKEN }} |
| 74 | + message: | |
| 75 | + ✅ [Python SDK tests passed](${{ env.RUN_URL }}). |
0 commit comments