Skip to content

[pre-commit.ci] pre-commit autoupdate #323

[pre-commit.ci] pre-commit autoupdate

[pre-commit.ci] pre-commit autoupdate #323

Workflow file for this run

name: testing
on:
push:
branches: main
pull_request:
jobs:
integration:
name: ${{ matrix.tracker }} / ${{ matrix.kiwitcms-url }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
kiwitcms-url: [tcms.kiwitcms.org, public.tenant.kiwitcms.org]
python-version: [3.11]
tracker: [internals, mantis, openproject]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Start database for Kiwi TCMS
run: |
docker-compose pull
docker-compose up -d
- name: Dockerize
run: |
docker-compose -f tests/${{ matrix.tracker}}/docker-compose.yml build
docker-compose -f tests/${{ matrix.tracker}}/docker-compose.yml up -d
sleep 10
IP_ADDR=`docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' bugtracker_kiwitcms_org`
sudo sh -c "echo '$IP_ADDR bugtracker.kiwitcms.org' >> /etc/hosts"
# install all dev dependencies here b/c these steps are now part of a
# job matrix which unconditionally initializes the bugtracker DB and
# runs the tests. Some trackers may end up with empty initialization!
- name: Install Python dependencies
run: |
make checkout_kiwi
pip install -U pip
pip install -r devel.txt
- name: Initialize bugs DB
run: |
./tests/${{ matrix.tracker }}/initialize-data
- name: Configure ~/.tcms.conf for ${{ matrix.kiwitcms-url }}
run: |
echo "[tcms]" > ~/.tcms.conf
echo "url = https://${{ matrix.kiwitcms-url }}/xml-rpc/" >> ~/.tcms.conf
echo "username = kiwitcms-bot" >> ~/.tcms.conf
echo "password = ${{ secrets.TCMS_PASSWORD }}" >> ~/.tcms.conf
- name: Prepare ENV
id: prepare-env
if: matrix.tracker == 'internals'
run: |
echo "CI_USE_MULTI_TENANT=1" >> "$GITHUB_OUTPUT"
pip install kiwitcms-tenants
- name: Execute tests
env:
CI_USE_MULTI_TENANT: ${{ steps.prepare-env.outputs.CI_USE_MULTI_TENANT || 0 }}
run: |
# load any extra ENV vars that came from initialize-data
[ -f /tmp/env ] && source /tmp/env
export LANG=en-us
# report to Kiwi TCMS only if we have access to secrets
if [ -n "${{ secrets.TCMS_PASSWORD }}" ]; then
export DJANGO_TEST_RUNNER="tcms_django_plugin.TestRunner"
export TCMS_PRODUCT=$GITHUB_REPOSITORY
# branch name or pull/123
export TCMS_PRODUCT_VERSION=$(echo $GITHUB_REF | sed "s|refs/heads/||" | sed "s|refs/||" | sed "s|/merge||")
# short commit number
export TCMS_BUILD=$(echo $GITHUB_SHA | cut -c1-7)
fi
PYTHONPATH=.:../Kiwi EXECUTOR=standard AUTO_CREATE_SCHEMA='' KIWI_TENANTS_DOMAIN="example.com" \
coverage run --source='.' ./manage.py test -v2 --noinput trackers_integration.tests.test_${{ matrix.tracker }}
- name: Send coverage to codecov.io
uses: codecov/codecov-action@v3
with:
fail_ci_if_error: false
verbose: true
lint:
name: ${{ matrix.tracker }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: [3.11]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
# install all dev dependencies here b/c these steps are now part of a
# job matrix which unconditionally initializes the bugtracker DB and
# runs the tests. Some trackers may end up with empty initialization!
- name: Install Python dependencies
run: |
make checkout_kiwi
pip install -U pip
pip install -r devel.txt
- name: Execute tests
run: |
export LANG=en-us
make check