feat: add push notifications #2509
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# WARNING: Do not edit this file manually! Edit ci/spec.yml and run ci/regen-workflow.py. | |
{ | |
"name": "CI", | |
"on": [ | |
"push", | |
"pull_request" | |
], | |
"defaults": { | |
"run": { | |
"shell": "bash" | |
} | |
}, | |
"env": { | |
"PRODUCTION": "TRUE" | |
}, | |
"jobs": { | |
"linting": { | |
"runs-on": "ubuntu-latest", | |
"strategy": { | |
"matrix": { | |
"python-version": [ | |
3.8 | |
] | |
}, | |
"fail-fast": false | |
}, | |
"steps": [ | |
{ | |
"name": "Set up repo", | |
"uses": "actions/checkout@v2" | |
}, | |
{ | |
"name": "Set up Python ${{ matrix.python-version }}", | |
"uses": "actions/setup-python@v2", | |
"with": { | |
"python-version": "${{ matrix.python-version }}" | |
} | |
}, | |
{ | |
"name": "Set up pip cache", | |
"uses": "actions/cache@v2", | |
"with": { | |
"path": "~/.cache/pip", | |
"key": "pip-${{ matrix.python-version }}" | |
} | |
}, | |
{ | |
"name": "Set up packages", | |
"run": "set -e\n\npip install -U pip setuptools wheel\npip install -U \\\n pre-commit coveralls pyyaml pytest-django\npip install -U -r requirements.txt\n\necho \"PATH=$PATH\" >> $GITHUB_ENV\n" | |
}, | |
{ | |
"name": "Copy secret.py", | |
"run": "cp intranet/settings/ci_secret.py intranet/settings/secret.py" | |
}, | |
{ | |
"name": "Run pre-commit", | |
"run": "pre-commit run --all-files" | |
} | |
] | |
}, | |
"build": { | |
"runs-on": "ubuntu-latest", | |
"strategy": { | |
"matrix": { | |
"python-version": [ | |
3.8 | |
] | |
}, | |
"fail-fast": false | |
}, | |
"steps": [ | |
{ | |
"name": "Set up repo (fetching all commits)", | |
"uses": "actions/checkout@v2", | |
"with": { | |
"fetch-depth": 0 | |
} | |
}, | |
{ | |
"name": "Set up Python ${{ matrix.python-version }}", | |
"uses": "actions/setup-python@v2", | |
"with": { | |
"python-version": "${{ matrix.python-version }}" | |
} | |
}, | |
{ | |
"name": "Set up pip cache", | |
"uses": "actions/cache@v2", | |
"with": { | |
"path": "~/.cache/pip", | |
"key": "pip-${{ matrix.python-version }}" | |
} | |
}, | |
{ | |
"name": "Set up packages", | |
"run": "set -e\n\npip install -U pip setuptools wheel\npip install -U \\\n pre-commit coveralls pyyaml pytest-django\npip install -U -r requirements.txt\n\necho \"PATH=$PATH\" >> $GITHUB_ENV\n" | |
}, | |
{ | |
"name": "Copy secret.py", | |
"run": "cp intranet/settings/ci_secret.py intranet/settings/secret.py" | |
}, | |
{ | |
"name": "Regenerate workflow YAML file and check for changes", | |
"run": "./scripts/build_ensure_no_changes.sh ./ci/regen-workflow.py" | |
}, | |
{ | |
"name": "Check for changes to CI spec", | |
"run": "./scripts/build_ensure_no_changes.sh ./ci/regen-workflow.py" | |
}, | |
{ | |
"name": "Validate PR commit messages", | |
"if": "github.event_name == 'pull_request'", | |
"run": "./scripts/validate-commit-messages.py ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }}" | |
}, | |
{ | |
"name": "Validate push commit messages", | |
"if": "github.event_name == 'push' && (github.repository_owner != 'tjcsl' || github.ref != 'refs/heads/master' || github.ref != 'refs/heads/dev')", | |
"run": "git fetch origin ${{ github.event.before }} && ./scripts/validate-commit-messages.py ${{ github.event.before }}..${{ github.event.after }}" | |
}, | |
{ | |
"name": "Build docs", | |
"run": "./scripts/build_ensure_no_changes.sh ./scripts/build_docs.sh" | |
}, | |
{ | |
"name": "Push docs", | |
"if": "github.event_name == 'push' && github.ref == 'refs/heads/master' && github.repository_owner == 'tjcsl' && matrix.python-version == 3.8", | |
"run": "./scripts/push_docs.sh", | |
"env": { | |
"GH_TOKEN": "${{ secrets.DOCS_GH_TOKEN }}" | |
} | |
} | |
] | |
}, | |
"tests": { | |
"runs-on": "ubuntu-latest", | |
"strategy": { | |
"matrix": { | |
"python-version": [ | |
3.8 | |
], | |
"node-version": [ | |
"12.x" | |
] | |
}, | |
"fail-fast": false | |
}, | |
"services": { | |
"rabbitmq": { | |
"image": "rabbitmq:latest", | |
"ports": [ | |
"5672:5672" | |
], | |
"options": "--health-cmd \"rabbitmqctl node_health_check\" --health-interval 6s --health-timeout 5s --health-retries 10" | |
}, | |
"redis": { | |
"image": "redis:latest", | |
"ports": [ | |
"6379:6379" | |
], | |
"options": "--entrypoint redis-server" | |
}, | |
"postgres": { | |
"image": "postgres:latest", | |
"env": { | |
"POSTGRES_USER": "postgres", | |
"POSTGRES_PASSWORD": "postgres", | |
"POSTGRES_DB": "postgres" | |
}, | |
"ports": [ | |
"5432:5432" | |
], | |
"options": "--health-cmd pg_isready --health-interval 6s --health-timeout 5s --health-retries 9" | |
} | |
}, | |
"steps": [ | |
{ | |
"name": "Set up repo", | |
"uses": "actions/checkout@v2" | |
}, | |
{ | |
"name": "Set up Python ${{ matrix.python-version }}", | |
"uses": "actions/setup-python@v2", | |
"with": { | |
"python-version": "${{ matrix.python-version }}" | |
} | |
}, | |
{ | |
"name": "Set up pip cache", | |
"uses": "actions/cache@v2", | |
"with": { | |
"path": "~/.cache/pip", | |
"key": "pip-${{ matrix.python-version }}" | |
} | |
}, | |
{ | |
"name": "Set up packages", | |
"run": "set -e\n\npip install -U pip setuptools wheel\npip install -U \\\n pre-commit coveralls pyyaml pytest-django\npip install -U -r requirements.txt\n\necho \"PATH=$PATH\" >> $GITHUB_ENV\n" | |
}, | |
{ | |
"name": "Copy secret.py", | |
"run": "cp intranet/settings/ci_secret.py intranet/settings/secret.py" | |
}, | |
{ | |
"name": "Set up Node.js ${{ matrix.node-version }}", | |
"uses": "actions/setup-node@v1", | |
"with": { | |
"node-version": "${{ matrix.node-version }}" | |
} | |
}, | |
{ | |
"name": "Install Sass and add Node modules bin to PATH", | |
"run": "set -e\nnpm install sass\necho \"PATH=${{ github.workspace }}/node_modules/.bin:$PATH\" >> $GITHUB_ENV\n" | |
}, | |
{ | |
"name": "Set and create PGPASSFILE", | |
"run": "set -e\nPGPASSFILE=${{ runner.temp }}/.pgpass\necho \"PGPASSFILE=$PGPASSFILE\" >> $GITHUB_ENV\necho 127.0.0.1:5432:postgres:postgres:postgres >$PGPASSFILE\nchmod 600 $PGPASSFILE\n" | |
}, | |
{ | |
"name": "Create database", | |
"run": "psql -U postgres -h 127.0.0.1 -c 'create database ion'" | |
}, | |
{ | |
"name": "install Kerberos", | |
"run": "sudo apt update\nsudo apt install -y krb5-user\n" | |
}, | |
{ | |
"name": "Run tests (Fork)", | |
"if": "github.repository_owner != 'tjcsl'", | |
"run": "coverage run -a ./manage.py test --noinput --parallel 4" | |
}, | |
{ | |
"name": "Run tests (PR/Push)", | |
"if": "github.repository_owner == 'tjcsl'", | |
"run": "coverage run -a ./manage.py test --noinput" | |
}, | |
{ | |
"name": "Check for unmigrated changes", | |
"run": "coverage run -a ./manage.py makemigrations --noinput --check" | |
}, | |
{ | |
"name": "Migrate database", | |
"run": "coverage run -a ./manage.py migrate" | |
}, | |
{ | |
"name": "Collect static files", | |
"run": "coverage run -a ./manage.py collectstatic --noinput -v 0" | |
}, | |
{ | |
"name": "Report coverage to Coveralls", | |
"uses": "AndreMiras/coveralls-python-action@develop", | |
"with": { | |
"parallel": true | |
} | |
}, | |
{ | |
"name": "Build coverage XML file", | |
"if": "github.repository_owner == 'tjcsl' && github.event_name != 'pull_request'", | |
"run": "coverage xml" | |
}, | |
{ | |
"name": "Report coverage to Codacy", | |
"uses": "codacy/codacy-coverage-reporter-action@master", | |
"if": "github.repository_owner == 'tjcsl' && github.event_name != 'pull_request'", | |
"with": { | |
"coverage-reports": "coverage.xml", | |
"project-token": "${{ secrets.CODACY_PROJECT_TOKEN }}" | |
} | |
} | |
] | |
}, | |
"finish_success": { | |
"needs": [ | |
"linting", | |
"build", | |
"tests" | |
], | |
"runs-on": "ubuntu-latest", | |
"steps": [ | |
{ | |
"name": "Tell Coveralls that parallel jobs have finished", | |
"uses": "coverallsapp/github-action@master", | |
"with": { | |
"github-token": "${{ secrets.GITHUB_TOKEN }}", | |
"parallel-finished": true | |
} | |
} | |
] | |
} | |
} | |
} |