0
0
Fork 0
mirror of https://github.com/alerta/alerta.git synced 2025-01-24 17:29:39 +00:00
alerta_alerta/.github/workflows/release.yml
2023-02-28 00:14:02 +01:00

76 lines
1.7 KiB
YAML

name: Release
on:
push:
tags:
- 'v*'
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
jobs:
test:
name: Test
runs-on: ubuntu-latest
services:
postgres:
image: postgres
env:
POSTGRES_DB: alerta
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install dependencies
id: install-deps
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
pip install -r requirements.txt
pip install -r requirements-dev.txt
pip install .
- name: Test with pytest
id: test
env:
DATABASE_URL: postgres://postgres:postgres@localhost:5432/alerta
run: |
pytest --cov=alerta tests/*.py
- uses: act10ns/slack@v2
with:
status: ${{ job.status }}
steps: ${{ toJson(steps) }}
if: failure()
release:
name: Publish
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build
id: build
run: make build
- name: Publish to PyPI
id: publish
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
- uses: act10ns/slack@v2
with:
status: ${{ job.status }}
steps: ${{ toJson(steps) }}