100 lines
2.7 KiB
YAML
100 lines
2.7 KiB
YAML
name: ci
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
- dev
|
|
pull_request:
|
|
|
|
jobs:
|
|
lint:
|
|
runs-on: ubuntu-latest
|
|
container: python:3.9
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: actions/setup-node@v3
|
|
with:
|
|
node-version: 14
|
|
- name: Build
|
|
run: |
|
|
pip install $(grep "pre-commit" engine/requirements.txt)
|
|
npm install -g yarn
|
|
cd grafana-plugin/
|
|
yarn --network-timeout 500000
|
|
yarn build
|
|
- name: Lint All
|
|
run: |
|
|
pre-commit run --all-files
|
|
|
|
test-technical-documentation:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: "Check out code"
|
|
uses: "actions/checkout@v3"
|
|
- name: "Build website"
|
|
# -e HUGO_REFLINKSERRORLEVEL=ERROR prevents merging broken refs with the downside
|
|
# that no refs to external content can be used as these refs will not resolve in the
|
|
# docs-base image.
|
|
run: |
|
|
docker run -v ${PWD}/docs/sources:/hugo/content/docs/oncall/latest -e HUGO_REFLINKSERRORLEVEL=ERROR --rm grafana/docs-base:latest /bin/bash -c 'make hugo'
|
|
|
|
unit-test-backend:
|
|
runs-on: ubuntu-latest
|
|
container: python:3.9
|
|
env:
|
|
DJANGO_SETTINGS_MODULE: settings.ci-test
|
|
SLACK_CLIENT_OAUTH_ID: 1
|
|
services:
|
|
rabbit_test:
|
|
image: rabbitmq:3.7.19
|
|
env:
|
|
RABBITMQ_DEFAULT_USER: rabbitmq
|
|
RABBITMQ_DEFAULT_PASS: rabbitmq
|
|
mysql_test:
|
|
image: mysql:5.7.25
|
|
env:
|
|
MYSQL_DATABASE: oncall_local_dev
|
|
MYSQL_ROOT_PASSWORD: local_dev_pwd
|
|
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- name: Unit Test Backend
|
|
run: |
|
|
apt-get update && apt-get install -y netcat
|
|
cd engine/
|
|
pip install -r requirements.txt
|
|
./wait_for_test_mysql_start.sh && pytest --ds=settings.ci-test -x
|
|
|
|
unit-test-backend-postgresql:
|
|
runs-on: ubuntu-latest
|
|
container: python:3.9
|
|
env:
|
|
DB_BACKEND: postgresql
|
|
DJANGO_SETTINGS_MODULE: settings.ci-test
|
|
SLACK_CLIENT_OAUTH_ID: 1
|
|
services:
|
|
rabbit_test:
|
|
image: rabbitmq:3.7.19
|
|
env:
|
|
RABBITMQ_DEFAULT_USER: rabbitmq
|
|
RABBITMQ_DEFAULT_PASS: rabbitmq
|
|
postgresql_test:
|
|
image: postgres:14.4
|
|
env:
|
|
POSTGRES_DB: oncall_local_dev
|
|
POSTGRES_PASSWORD: local_dev_pwd
|
|
# Set health checks to wait until postgres has started
|
|
options: >-
|
|
--health-cmd pg_isready
|
|
--health-interval 10s
|
|
--health-timeout 5s
|
|
--health-retries 5
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- name: Unit Test Backend
|
|
run: |
|
|
cd engine/
|
|
pip install -r requirements.txt
|
|
pytest --ds=settings.ci-test -x
|
|
|