|
| 1 | +--- |
1 | 2 | name: CI |
2 | | -on: |
| 3 | + |
| 4 | +on: # yamllint disable |
| 5 | + workflow_dispatch: {} |
3 | 6 | push: |
4 | 7 | branches: |
5 | 8 | - master |
| 9 | + - beta |
| 10 | + - sdk-release/** |
| 11 | + - feature/** |
6 | 12 | tags: |
7 | 13 | - v[0-9]+.[0-9]+.[0-9]+* |
8 | 14 | pull_request: |
9 | 15 | branches: |
10 | 16 | - master |
| 17 | + - beta |
| 18 | + - sdk-release/** |
| 19 | + - feature/** |
| 20 | + |
11 | 21 | jobs: |
| 22 | + lint: |
| 23 | + name: Static Checks |
| 24 | + runs-on: "ubuntu-24.04" |
| 25 | + steps: |
| 26 | + - uses: actions/checkout@v4 |
| 27 | + - name: Set up Python 3 |
| 28 | + uses: actions/setup-python@v4 |
| 29 | + with: |
| 30 | + python-version: "3.13" |
| 31 | + - name: Install dev dependencies |
| 32 | + run: | |
| 33 | + python -m pip install --upgrade pip |
| 34 | + pip install -r requirements/base.txt -r requirements/dev.txt |
| 35 | + # - name: check mypy |
| 36 | + # run: mypy . |
| 37 | + - name: check linting |
| 38 | + run: ruff check . |
| 39 | + - name: check formatting |
| 40 | + run: ruff format --check |
| 41 | + |
12 | 42 | build: |
13 | 43 | name: Build |
14 | | - runs-on: ubuntu-latest |
| 44 | + runs-on: "ubuntu-24.04" |
15 | 45 | steps: |
16 | | - - uses: actions/checkout@v3 |
| 46 | + - uses: actions/checkout@v4 |
| 47 | + |
17 | 48 | - name: Set up Python 3 |
18 | | - uses: actions/setup-python@v3 |
| 49 | + uses: actions/setup-python@v4 |
19 | 50 | with: |
20 | | - python-version: "3.10" |
21 | | - - name: Install dependencies |
| 51 | + python-version: "3.13" |
| 52 | + |
| 53 | + - name: Install dev dependencies |
| 54 | + run: | |
| 55 | + python -m pip install --upgrade pip |
| 56 | + pip install -r requirements/base.txt -r requirements/dev.txt |
| 57 | +
|
| 58 | + - name: Build and check package |
22 | 59 | run: | |
23 | | - python -m pip install --upgrade pip |
24 | | - pip install build |
25 | 60 | python -m build |
26 | | - python -m pip install --upgrade twine |
27 | | - python -m twine check dist/* |
28 | | - |
29 | | - - name: 'Upload Artifact' |
30 | | - uses: actions/upload-artifact@v2 |
| 61 | +
|
| 62 | + - name: "Upload Artifact" |
| 63 | + uses: actions/upload-artifact@v4 |
31 | 64 | with: |
32 | 65 | name: dist |
33 | | - path: dist/ |
| 66 | + path: dist/ |
| 67 | + |
34 | 68 | test: |
35 | | - name: Test Coverage |
36 | | - needs: build |
37 | | - runs-on: ubuntu-latest |
| 69 | + runs-on: ubuntu-24.04 |
| 70 | + strategy: |
| 71 | + fail-fast: false |
| 72 | + matrix: |
| 73 | + python_version: |
| 74 | + - "3.9" |
| 75 | + - "3.10" |
| 76 | + - "3.11" |
| 77 | + - "3.12" |
| 78 | + - "3.13" |
| 79 | + # - "pypy-3.7" |
| 80 | + # - "pypy-3.9" |
| 81 | + # - "pypy-3.10" |
| 82 | + name: Test (${{ matrix.python_version }}) |
38 | 83 | steps: |
39 | | - - uses: actions/checkout@v3 |
40 | | - - name: Set up Python 3 |
41 | | - uses: actions/setup-python@v3 |
| 84 | + - uses: actions/checkout@v4 |
| 85 | + - name: Set up Python ${{ matrix.python_version }} |
| 86 | + uses: actions/setup-python@v4 |
42 | 87 | with: |
43 | | - python-version: "3.10" |
44 | | - - name: Install dependencies |
| 88 | + python-version: ${{ matrix.python_version }} |
| 89 | + - name: Install dev dependencies |
45 | 90 | run: | |
46 | 91 | python -m pip install --upgrade pip |
47 | | - pip install responses |
48 | | - pip install coverage |
49 | | - python ${{ github.workspace }}/setup.py install |
50 | | - - name: Run Tests |
51 | | - run: | |
52 | | - python -m coverage run -m unittest |
53 | | - python -m coverage xml |
54 | | - - name: Upload coverage to Codecov |
55 | | - uses: codecov/codecov-action@v3 |
56 | | - |
| 92 | + pip install -r requirements/base.txt -r requirements/dev.txt |
| 93 | + - name: "run tests" |
| 94 | + run: python -m unittest |
| 95 | + |
57 | 96 | publish: |
58 | | - if: startsWith(github.ref, 'refs/tags/v') |
59 | | - needs: test |
60 | | - runs-on: ubuntu-latest |
| 97 | + name: Publish |
| 98 | + if: >- |
| 99 | + ((github.event_name == 'workflow_dispatch') || (github.event_name == 'push')) && |
| 100 | + startsWith(github.ref, 'refs/tags/v') |
| 101 | + needs: [build, test, lint] |
| 102 | + runs-on: "ubuntu-24.04" |
61 | 103 | steps: |
62 | | - - uses: actions/checkout@v2 |
| 104 | + - uses: actions/checkout@v3 |
63 | 105 | - name: Download all workflow run artifacts |
64 | | - uses: actions/download-artifact@v2 |
| 106 | + uses: actions/download-artifact@v4 |
65 | 107 | with: |
66 | 108 | name: dist |
67 | | - path: dist |
| 109 | + path: dist |
68 | 110 | - name: Set up Python 3 |
69 | | - uses: actions/setup-python@v3 |
| 111 | + uses: actions/setup-python@v4 |
70 | 112 | with: |
71 | | - python-version: "3.10" |
72 | | - - name: Publish packages to PyPi |
| 113 | + python-version: "3.13" |
| 114 | + - name: Install dev dependencies |
| 115 | + run: | |
| 116 | + python -m pip install --upgrade pip |
| 117 | + pip install -r requirements/base.txt -r requirements/dev.txt |
| 118 | + - name: Publish packages to PyPI |
| 119 | + # could probably move this into a just recipe too? |
73 | 120 | run: | |
74 | | - python -m pip install --upgrade twine |
75 | | - set -ex |
76 | | - export VERSION=$(python3 setup.py --version) |
77 | | - python -m twine upload --verbose dist/razorpay-$VERSION-py3-none-any.whl dist/razorpay-$VERSION.tar.gz |
| 121 | + export VERSION=$(cat VERSION) |
| 122 | + python -m twine upload --verbose dist/razorpay_py-$VERSION.tar.gz dist/razorpay_py-$VERSION-py3-none-any.whl |
78 | 123 | env: |
79 | 124 | TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }} |
80 | 125 | TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }} |
81 | | - |
|
0 commit comments