Skip to content

Commit 5094ab1

Browse files
authored
added test for pgsql+socket case (#35)
1 parent f2e1563 commit 5094ab1

File tree

1 file changed

+85
-0
lines changed

1 file changed

+85
-0
lines changed

.github/workflows/py_analysis-coverage.yml

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,3 +404,88 @@ jobs:
404404
file: apps/${{ env.APP_NAME }}/coverage.xml
405405
fail_ci_if_error: true
406406
verbose: true
407+
408+
tests-pgsql-socket:
409+
needs: [analysis]
410+
runs-on: ubuntu-22.04
411+
name: ${{ matrix.nextcloud }} • PHP ${{ matrix.php-version }} • PgSQL • SOCK
412+
if: "!contains(github.event.head_commit.message, '[docs]')"
413+
strategy:
414+
fail-fast: false
415+
matrix:
416+
php-version: [ "8.0" ]
417+
nextcloud: [ "25.0.2" ]
418+
419+
steps:
420+
- name: Set up php ${{ matrix.php-version }}
421+
uses: shivammathur/setup-php@v2
422+
with:
423+
php-version: ${{ matrix.php-version }}
424+
extensions: mbstring, fileinfo, intl, pdo_mysql, zip, gd
425+
426+
- uses: actions/setup-python@v4
427+
with:
428+
python-version: '3.9'
429+
430+
- name: cache-nextcloud
431+
id: nextcloud_setup
432+
uses: actions/cache@v3
433+
with:
434+
path: nextcloud-${{ matrix.nextcloud }}.tar.bz2
435+
key: ${{ matrix.nextcloud }}
436+
437+
- name: Download Nextcloud
438+
if: steps.nextcloud_setup.outputs.cache-hit != 'true'
439+
run: wget -q https://download.nextcloud.com/server/releases/nextcloud-${{ matrix.nextcloud }}.tar.bz2
440+
441+
- name: Set up Nextcloud
442+
run: |
443+
sudo sed -i "s/.*local.*all.*all.*peer.*/local all all md5/" /etc/postgresql/14/main/pg_hba.conf
444+
sudo sed -i "s/.*listen_addresses.*localhost.*/listen_addresses = ''/" /etc/postgresql/14/main/postgresql.conf
445+
sudo systemctl restart postgresql.service
446+
sudo -u postgres psql -c "CREATE USER username WITH PASSWORD 'userpass';"
447+
sudo -u postgres psql -c "CREATE DATABASE nextcloud TEMPLATE template0 ENCODING 'UNICODE';"
448+
sudo -u postgres psql -c "ALTER DATABASE nextcloud OWNER TO username;"
449+
sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE nextcloud TO username;"
450+
sudo -u postgres psql -c "\l+"
451+
tar -xjf nextcloud-${{ matrix.nextcloud }}.tar.bz2 --strip-components 1
452+
mkdir data
453+
php occ maintenance:install --verbose --database=pgsql --database-name=nextcloud \
454+
--database-user=username --database-pass=userpass \
455+
--admin-user admin --admin-pass adminpassword --database-host="/var/run/postgresql"
456+
php occ config:system:set debug --value=true --type=boolean
457+
php -S localhost:8080 &
458+
459+
- uses: actions/checkout@v3
460+
with:
461+
path: apps/${{ env.APP_NAME }}
462+
463+
- name: Enable App & Test Data
464+
run: |
465+
php occ app:enable ${{ env.APP_NAME }}
466+
cp -R apps/${{ env.APP_NAME }}/tests/nc_py_api/test_dir ./data/admin/files/
467+
php occ files:scan admin
468+
469+
- name: Generate coverage report
470+
working-directory: apps/${{ env.APP_NAME }}
471+
run: |
472+
python3 -m pip -v install ".[dev]"
473+
coverage run -m pytest -s && coverage xml && coverage html
474+
env:
475+
SERVER_ROOT: "../.."
476+
CPA_LOGLEVEL: debug
477+
478+
- name: HTML coverage to artifacts
479+
uses: actions/upload-artifact@v3
480+
with:
481+
name: coverage_${{ matrix.nextcloud }}_${{ matrix.php-version }}_pgsql_socket
482+
path: apps/${{ env.APP_NAME }}/htmlcov
483+
if-no-files-found: error
484+
485+
- name: Upload report to Codecov
486+
uses: codecov/codecov-action@v3
487+
with:
488+
token: ${{ secrets.CODECOV_TOKEN }}
489+
file: apps/${{ env.APP_NAME }}/coverage.xml
490+
fail_ci_if_error: true
491+
verbose: true

0 commit comments

Comments
 (0)