|
1 | | -name: release |
| 1 | +name: Release |
2 | 2 |
|
3 | 3 | on: |
4 | 4 | push: |
5 | | - tags: |
6 | | - - 'v*' |
| 5 | + tags: [ 'v*' ] |
| 6 | + branches: [ develop ] |
7 | 7 |
|
8 | 8 | env: |
9 | 9 | SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} |
10 | 10 |
|
11 | 11 | jobs: |
12 | 12 | test: |
| 13 | + name: Test |
13 | 14 | runs-on: ubuntu-latest |
| 15 | + |
14 | 16 | steps: |
15 | | - - uses: actions/checkout@v2 |
16 | | - - name: Install |
17 | | - id: install |
18 | | - run: make install |
19 | | - - name: Lint |
20 | | - id: lint |
21 | | - run: make lint |
22 | | - - name: Test |
| 17 | + - uses: actions/checkout@v3 |
| 18 | + - name: Set up Python 3.11 |
| 19 | + uses: actions/setup-python@v4 |
| 20 | + with: |
| 21 | + python-version: 3.11 |
| 22 | + - name: Install dependencies |
| 23 | + id: install-deps |
| 24 | + run: | |
| 25 | + python3 -m pip install --upgrade pip |
| 26 | + pip install flake8 pytest |
| 27 | + pip install -r requirements.txt |
| 28 | + pip install -r requirements-dev.txt |
| 29 | + pip install . |
| 30 | + - name: Pre-commit hooks |
| 31 | + id: hooks |
| 32 | + run: | |
| 33 | + pre-commit run -a --show-diff-on-failure |
| 34 | + - name: Test with pytest |
23 | 35 | id: test |
24 | | - run: make test |
25 | | - |
26 | | - - uses: act10ns/slack@v1 |
| 36 | + env: |
| 37 | + DATABASE_URL: postgres://postgres:postgres@localhost:5432/alerta |
| 38 | + run: | |
| 39 | + pytest --cov=alerta tests/*.py |
| 40 | + - uses: act10ns/slack@v2 |
27 | 41 | with: |
28 | 42 | status: ${{ job.status }} |
29 | 43 | steps: ${{ toJson(steps) }} |
| 44 | + if: failure() |
30 | 45 |
|
31 | 46 | release: |
| 47 | + name: Publish |
32 | 48 | needs: test |
33 | 49 | runs-on: ubuntu-latest |
| 50 | + |
34 | 51 | steps: |
35 | | - - uses: actions/checkout@v2 |
| 52 | + - uses: actions/checkout@v3 |
| 53 | + - name: Set up Python 3.11 |
| 54 | + uses: actions/setup-python@v4 |
| 55 | + with: |
| 56 | + python-version: 3.11 |
36 | 57 | - name: Build |
37 | 58 | id: build |
38 | | - run: make build |
| 59 | + run: | |
| 60 | + python3 -m pip install --upgrade build |
| 61 | + python3 -m build |
39 | 62 | - name: Publish to PyPI |
40 | 63 | id: publish |
41 | | - uses: pypa/gh-action-pypi-publish@release/v1 |
42 | | - with: |
43 | | - user: __token__ |
44 | | - password: ${{ secrets.PYPI_API_TOKEN }} |
| 64 | + env: |
| 65 | + TWINE_USERNAME: __token__ |
| 66 | + TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} |
| 67 | + run: | |
| 68 | + python3 -m pip install --upgrade twine |
| 69 | + python3 -m twine check dist/* |
| 70 | + python3 -m twine upload --verbose dist/* |
45 | 71 |
|
46 | | - - uses: act10ns/slack@v1 |
| 72 | + - uses: act10ns/slack@v2 |
47 | 73 | with: |
48 | 74 | status: ${{ job.status }} |
49 | 75 | steps: ${{ toJson(steps) }} |
| 76 | + |
| 77 | + - name: Test Install |
| 78 | + run: | |
| 79 | + python3 -m pip install --upgrade alerta-server |
| 80 | + python3 -m pip freeze |
0 commit comments