|
| 1 | +name: Continuous Delivery of Algorand Python Testing package |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + publish_pypi: |
| 7 | + description: "Publish to PyPi?" |
| 8 | + type: boolean |
| 9 | + required: true |
| 10 | + default: false |
| 11 | + run_checks: |
| 12 | + description: "Run checks?" |
| 13 | + type: boolean |
| 14 | + required: true |
| 15 | + default: true |
| 16 | + dry_run: |
| 17 | + description: "Dry Run? If true, won't commit or publish anything" |
| 18 | + type: boolean |
| 19 | + required: true |
| 20 | + default: false |
| 21 | + |
| 22 | +concurrency: release |
| 23 | + |
| 24 | +permissions: |
| 25 | + contents: write |
| 26 | + packages: read |
| 27 | + |
| 28 | +jobs: |
| 29 | + release: |
| 30 | + name: Release `algorand-python-testing` package |
| 31 | + runs-on: ubuntu-latest |
| 32 | + permissions: |
| 33 | + # IMPORTANT: this permission is mandatory for trusted publishing |
| 34 | + id-token: write |
| 35 | + contents: write |
| 36 | + packages: read |
| 37 | + env: |
| 38 | + DRY_RUN: ${{ inputs.dry_run && '--noop' || '' }} |
| 39 | + steps: |
| 40 | + - uses: actions/checkout@v4 |
| 41 | + with: |
| 42 | + token: ${{ secrets.RELEASE_GITHUB_TOKEN }} |
| 43 | + |
| 44 | + - name: Install hatch |
| 45 | + run: pipx install hatch |
| 46 | + |
| 47 | + - name: Set up Python 3.12 |
| 48 | + uses: actions/setup-python@v5 |
| 49 | + with: |
| 50 | + python-version: "3.12" |
| 51 | + cache: "pip" |
| 52 | + |
| 53 | + - name: Start LocalNet |
| 54 | + run: hatch run cicd:localnet_start |
| 55 | + |
| 56 | + - name: Check pre-commits |
| 57 | + run: hatch run check |
| 58 | + |
| 59 | + - name: Check pre-commits (examples) |
| 60 | + run: hatch run examples:check |
| 61 | + |
| 62 | + - name: Check wheels can be built |
| 63 | + run: hatch build |
| 64 | + |
| 65 | + - name: Run tests (codebase) |
| 66 | + run: hatch run test:codebase |
| 67 | + |
| 68 | + - name: Run tests (examples) |
| 69 | + run: hatch run examples:tests |
| 70 | + |
| 71 | + - name: Create Unit Testing Wheel |
| 72 | + run: hatch build |
| 73 | + |
| 74 | + - uses: actions/upload-artifact@v4 # upload artifacts so they are retained on the job |
| 75 | + with: |
| 76 | + path: dist |
| 77 | + |
| 78 | + - name: Publish to PyPI - Unit Testing |
| 79 | + if: ${{ !inputs.dry_run && inputs.publish_pypi }} |
| 80 | + uses: pypa/gh-action-pypi-publish@release/v1 |
| 81 | + with: |
| 82 | + packages-dir: dist |
0 commit comments