Remove xmpp #201
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
name: Inyoka CI | |
on: [push, pull_request] | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
env: | |
DEFAULT_BRANCH: 'refs/heads/staging' | |
REQUIREMENTS_FILE: extra/requirements/linux-py${{ matrix.python-version }}-development.txt | |
strategy: | |
matrix: | |
python-version: [3.9] | |
database: ['postgresql', 'sqlite'] | |
include: | |
- python-version: 3.9 | |
database: 'postgresql' | |
build_docs: true | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
persist-credentials: false | |
# - name: Dump github.event.pull_request context | |
# env: | |
# GITHUB_CONTEXT: ${{ toJSON(github.event.pull_request) }} | |
# run: echo "$GITHUB_CONTEXT" | |
- name: Checkout theme from repo branch # (e.g. staging) | |
id: checkout-branch | |
continue-on-error: true | |
if: ${{ !github.event.pull_request }} | |
uses: actions/checkout@v3 | |
with: | |
repository: inyokaproject/theme-ubuntuusers | |
ssh-key: ${{ secrets.SSH_KEY_THEME_UBUNTUUSERS }} # ssh key of inyokatestci, read only, see https://docs.github.com/en/actions/reference/encrypted-secrets | |
ref: ${{ github.ref }} | |
path: theme-ubuntuusers | |
persist-credentials: false | |
- name: Checkout theme in PR | |
id: checkout-pr | |
continue-on-error: true | |
if: ${{ github.event.pull_request }} | |
uses: actions/checkout@v3 | |
with: | |
repository: ${{ github.event.pull_request.head.repo.owner.login }}/theme-ubuntuusers | |
ssh-key: ${{ secrets.SSH_KEY_THEME_UBUNTUUSERS }} | |
ref: ${{ github.head_ref }} | |
path: theme-ubuntuusers | |
persist-credentials: false | |
- name: "Checkout fallback theme: repo theme-ubuntuusers, staging branch" | |
if: steps.checkout-branch.outcome == 'failure' || steps.checkout-pr.outcome == 'failure' | |
uses: actions/checkout@v3 | |
with: | |
repository: inyokaproject/theme-ubuntuusers | |
ssh-key: ${{ secrets.SSH_KEY_THEME_UBUNTUUSERS }} | |
ref: staging | |
path: theme-ubuntuusers | |
persist-credentials: false | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Cache venv | |
id: cache-venv | |
uses: actions/cache@v3 | |
with: | |
path: ~/venv/ | |
key: ${{ runner.os }}-venv-py${{ matrix.python-version }}-${{ hashFiles(env.REQUIREMENTS_FILE) }} | |
- name: Build virtualenv | |
if: steps.cache-venv.outputs.cache-hit != 'true' | |
run: | | |
python -m venv ~/venv | |
. ~/venv/bin/activate | |
python -m pip install --upgrade pip | |
pip install --no-deps --require-hashes -r ${{ env.REQUIREMENTS_FILE }} | |
- name: Link theme | |
working-directory: ./theme-ubuntuusers | |
run: | | |
. ~/venv/bin/activate | |
pip install -e . | |
- name: Build static files | |
working-directory: ./theme-ubuntuusers | |
run: | | |
npm ci | |
npm run all | |
- name: Create inyoka settings | |
run: | | |
cp example_development_settings.py development_settings.py | |
sed -i "s/None/'supersecreteTest'/g" development_settings.py | |
sed -i "s/inyoka_theme_default/inyoka_theme_ubuntuusers/g" development_settings.py | |
- name: Start postgres | |
if: ${{ matrix.database == 'postgresql' }} | |
run: | | |
cat << '__EOF__' | sudo tee /etc/postgresql/14/main/pg_hba.conf > /dev/null | |
# TYPE DATABASE USER ADDRESS METHOD | |
# "local" is for Unix domain socket connections only | |
local all all trust | |
# IPv4 local connections: | |
host all all 127.0.0.1/32 trust | |
# IPv6 local connections: | |
host all all ::1/128 trust | |
__EOF__ | |
sudo systemctl start postgresql.service | |
pg_isready | |
- name: Install redis (server and cli) | |
run: | | |
sudo apt-get install redis-server | |
- name: Check for missing migrations (postgresql) | |
if: ${{ matrix.database == 'postgresql' }} | |
run: | | |
. ~/venv/bin/activate | |
python manage.py makemigrations --check --dry-run --settings tests.settings.${{ matrix.database }}_staticdbname | |
- name: Check for missing migrations (no postgresql) | |
if: ${{ matrix.database != 'postgresql' }} | |
run: | | |
. ~/venv/bin/activate | |
python manage.py makemigrations --check --dry-run --settings tests.settings.${{ matrix.database }} | |
- name: Run Tests | |
env: | |
PYTHONWARNINGS: 'always' | |
run: | | |
. ~/venv/bin/activate | |
coverage run manage.py test --settings tests.settings.${{ matrix.database }} | |
coverage html | |
- name: Compress coverage report | |
run: zip htmlcov.zip -r htmlcov | |
- name: Save coverage report for tests | |
uses: actions/upload-artifact@v3 | |
with: | |
name: coverage-py${{ matrix.python-version }}-${{ matrix.database }} | |
path: htmlcov.zip | |
- name: Run BDD tests | |
if: ${{ matrix.database == 'postgresql' }} | |
env: | |
DJANGO_SETTINGS_MODULE: 'tests.bdd.settings.headless' | |
#PATH: '$PATH:/usr/lib/chromium-browser/' | |
COVERAGE_RCFILE: 'tests/bdd/settings/.coveragerc' | |
run: | | |
. ~/venv/bin/activate | |
cat << '__EOF__' | sudo tee -a /etc/hosts > /dev/null | |
127.0.0.1 ubuntuusers.local forum.ubuntuusers.local paste.ubuntuusers.local wiki.ubuntuusers.local planet.ubuntuusers.local ikhaya.ubuntuusers.local static.ubuntuusers.local media.ubuntuusers.local | |
__EOF__ | |
python manage.py collectstatic --noinput | |
coverage run -m behave --tags=-skip | |
coverage html -d bdd_coverage | |
- name: Compress BDD results | |
if: ${{ matrix.database == 'postgresql' }} | |
run: zip bdd_coverage.zip -r bdd_coverage | |
- name: Save BDD results | |
if: ${{ matrix.database == 'postgresql' }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: BDD-coverage-py${{ matrix.python-version }}-${{ matrix.database }} | |
path: bdd_coverage.zip | |
- name: Build documentation | |
if: ${{ matrix.build_docs }} | |
run: | | |
. ~/venv/bin/activate | |
make -C docs html | |
- name: Compress documentation | |
if: ${{ matrix.build_docs }} | |
run: zip doc.zip -r docs/build/html | |
- name: Save documentation | |
if: ${{ matrix.build_docs }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: 'Inyoka_Documentation' | |
path: doc.zip | |
- name: Compress statics | |
if: ${{ startsWith(github.ref, 'refs/tags/') && matrix.build_docs }} | |
run: zip static-collected.zip -r inyoka/static-collected | |
- name: Save statics | |
if: ${{ startsWith(github.ref, 'refs/tags/') && matrix.build_docs }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: 'Static_files' | |
path: static-collected.zip |