|
| 1 | +on: |
| 2 | + push: |
| 3 | + pull_request: |
| 4 | + schedule: [{cron: '3 2 * * 6'}] # M H d m w (Sat 2:03) |
| 5 | +jobs: |
| 6 | + test: |
| 7 | + if: github.event_name != 'pull_request' || !contains('OWNER,MEMBER,COLLABORATOR', github.event.pull_request.author_association) |
| 8 | + strategy: |
| 9 | + matrix: |
| 10 | + python: [3.8, 3.9, '3.10', 3.11, 3.12, 3.13, 3.14] |
| 11 | + os: [ubuntu] |
| 12 | + include: [{os: macos, python: 3.13}, {os: windows, python: 3.13}] |
| 13 | + runs-on: ${{ matrix.os }}-latest |
| 14 | + timeout-minutes: 5 |
| 15 | + defaults: {run: {shell: bash}} |
| 16 | + steps: |
| 17 | + - uses: actions/checkout@v6 |
| 18 | + with: {fetch-depth: 0} |
| 19 | + - uses: actions/setup-python@v6 |
| 20 | + with: |
| 21 | + python-version: ${{ matrix.python }} |
| 22 | + - run: pip install -e .[dev] |
| 23 | + - run: pytest --cov=envwrap --cov-report=xml |
| 24 | + - uses: coverallsapp/github-action@v2 |
| 25 | + with: |
| 26 | + flag-name: ${{ matrix.python }}-${{ matrix.os }} |
| 27 | + parallel: true |
| 28 | + - uses: codecov/codecov-action@v6 |
| 29 | + with: |
| 30 | + token: ${{ secrets.CODECOV_TOKEN }} |
| 31 | + flags: ${{ matrix.python }}, ${{ matrix.os }} |
| 32 | + - name: codacy |
| 33 | + run: | |
| 34 | + bash <(curl -fsL https://coverage.codacy.com/get.sh) report -l Python -r coverage.xml --partial || : |
| 35 | + env: |
| 36 | + CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }} |
| 37 | + finish: |
| 38 | + continue-on-error: ${{ github.event_name != 'push' }} |
| 39 | + needs: test |
| 40 | + runs-on: ubuntu-slim |
| 41 | + steps: |
| 42 | + - uses: coverallsapp/github-action@v2 |
| 43 | + with: {parallel-finished: true} |
| 44 | + - name: codacy |
| 45 | + run: | |
| 46 | + bash <(curl -fsL https://coverage.codacy.com/get.sh) final || : |
| 47 | + env: |
| 48 | + CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }} |
| 49 | + deploy: |
| 50 | + needs: test |
| 51 | + runs-on: ubuntu-latest |
| 52 | + environment: pypi |
| 53 | + permissions: {contents: write, id-token: write, packages: write} |
| 54 | + steps: |
| 55 | + - uses: actions/checkout@v6 |
| 56 | + with: |
| 57 | + fetch-depth: 0 |
| 58 | + token: ${{ secrets.GH_TOKEN || github.token }} |
| 59 | + - uses: actions/setup-python@v6 |
| 60 | + with: {python-version: '3.x'} |
| 61 | + - id: dist |
| 62 | + uses: casperdcl/deploy-pypi@v3 |
| 63 | + with: |
| 64 | + upload: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags') }} |
| 65 | + build: true |
| 66 | + - if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') |
| 67 | + name: Release |
| 68 | + run: | |
| 69 | + changelog=$(git log --pretty='format:%d%n- %s%n%b---' $(git tag --sort=v:refname | tail -n2 | head -n1)..HEAD) |
| 70 | + tag="${GITHUB_REF#refs/tags/}" |
| 71 | + gh release create --title "tqdm $tag stable" --draft --notes "$changelog" "$tag" dist/${{ steps.dist.outputs.whl }} dist/${{ steps.dist.outputs.whl_asc }} |
| 72 | + env: |
| 73 | + GH_TOKEN: ${{ secrets.GH_TOKEN }} |
0 commit comments