90 lines
2.5 KiB
YAML
90 lines
2.5 KiB
YAML
name: Python and PHP Tests
|
|
on:
|
|
push:
|
|
paths-ignore:
|
|
- "docs/**"
|
|
pull_request:
|
|
types:
|
|
[
|
|
opened,
|
|
ready_for_review,
|
|
review_requested,
|
|
edited,
|
|
reopened,
|
|
synchronize,
|
|
]
|
|
paths-ignore:
|
|
- "docs/**"
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
pre-commit:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- uses: actions/setup-python@v2
|
|
- uses: pre-commit/action@v2.0.3
|
|
|
|
check-shell:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- uses: actions/setup-python@v2
|
|
- run: |
|
|
python -m venv venv && source venv/bin/activate
|
|
pip install gh-release-install
|
|
|
|
sudo venv/bin/gh-release-install \
|
|
koalaman/shellcheck \
|
|
shellcheck-{tag}.linux.x86_64.tar.xz --extract shellcheck-{tag}/shellcheck \
|
|
/usr/bin/shellcheck
|
|
|
|
sudo venv/bin/gh-release-install \
|
|
mvdan/sh \
|
|
shfmt_{tag}_linux_amd64 \
|
|
/usr/bin/shfmt
|
|
|
|
- run: SEVERITY=warning make shell-check
|
|
|
|
test:
|
|
strategy:
|
|
matrix:
|
|
include:
|
|
- runs-on: ubuntu-18.04
|
|
python-version: "3.6"
|
|
php-version: "7.2"
|
|
prerequisites-script: install-bionic.sh
|
|
|
|
runs-on: ${{ matrix.runs-on }}
|
|
env:
|
|
ENVIRONMENT: testing
|
|
LIBRETIME_LOG_DIR: /tmp/log/libretime
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- uses: actions/setup-python@v2
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
- name: Setup PostgreSQL
|
|
run: |
|
|
sudo systemctl start postgresql.service
|
|
pg_isready
|
|
sudo -u postgres psql -c 'CREATE DATABASE libretime;'
|
|
sudo -u postgres psql -c "CREATE USER libretime WITH PASSWORD 'libretime';"
|
|
sudo -u postgres psql -c 'GRANT CONNECT ON DATABASE libretime TO libretime;'
|
|
sudo -u postgres psql -c 'ALTER USER libretime CREATEDB;'
|
|
- name: Setup PHP with specific version
|
|
uses: shivammathur/setup-php@v2
|
|
with:
|
|
php-version: ${{ matrix.php-version }}
|
|
- name: Install prerequisites
|
|
run: sudo -E ./.github/scripts/${{ matrix.prerequisites-script }}
|
|
- name: Run Python tests
|
|
run: |
|
|
sudo ./.github/scripts/python-pkg-install.sh
|
|
./.github/scripts/python-pkg-test.sh
|
|
- name: Run PHP tests
|
|
run: |
|
|
composer install --no-progress --dev
|
|
cd airtime_mvc/tests
|
|
php ../../vendor/bin/phpunit
|