feat: maintenance update, basic object storage support, minor cleanup #174
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: (Py)Analysis & Coverage | |
on: | |
push: | |
branches: | |
- main | |
- dev | |
paths-ignore: | |
- l10n/** | |
pull_request: | |
branches: | |
- main | |
- dev | |
paths-ignore: | |
- l10n/** | |
env: | |
APP_NAME: cloud_py_api | |
jobs: | |
analysis: | |
runs-on: macos-12 | |
name: Analysis | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.9' | |
- name: Install from source | |
run: python3 -m pip install . | |
- name: Run Analysis | |
run: | | |
python3 -m pip install pylint | |
python3 -m pylint setup.py "nc_py_api/" -sn | |
tests-pgsql: | |
needs: [analysis] | |
runs-on: ubuntu-22.04 | |
name: ${{ matrix.nextcloud }} • PHP ${{ matrix.php-version }} • PgSQL ${{ matrix.pgsql-version }} | |
strategy: | |
fail-fast: false | |
matrix: | |
nextcloud: [ "25.0.2" ] | |
php-version: [ "7.4", "8.0" ] | |
pgsql-version: [ "13", "15" ] | |
env: | |
NC_dbname: nextcloud_abz | |
services: | |
postgres: | |
image: postgres:${{ matrix.pgsql-version }} | |
env: | |
POSTGRES_USER: root | |
POSTGRES_PASSWORD: rootpassword | |
POSTGRES_DB: ${{ env.NC_dbname }} | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 5432:5432 | |
steps: | |
- name: Set up php ${{ matrix.php-version }} | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php-version }} | |
extensions: mbstring, fileinfo, intl, pdo_pgsql, zip, gd | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.9' | |
- name: cache-nextcloud | |
id: nextcloud_setup | |
uses: actions/cache@v3 | |
with: | |
path: nextcloud-${{ matrix.nextcloud }}.tar.bz2 | |
key: ${{ matrix.nextcloud }} | |
- name: Download Nextcloud | |
if: steps.nextcloud_setup.outputs.cache-hit != 'true' | |
run: wget -q https://download.nextcloud.com/server/releases/nextcloud-${{ matrix.nextcloud }}.tar.bz2 | |
- name: Set up Nextcloud | |
run: | | |
tar -xjf nextcloud-${{ matrix.nextcloud }}.tar.bz2 --strip-components 1 | |
mkdir data | |
php occ maintenance:install --verbose --database=pgsql --database-name=${{ env.NC_dbname }} \ | |
--database-host=127.0.0.1 --database-user=root --database-pass=rootpassword \ | |
--admin-user admin --admin-pass adminpassword | |
sed -i -e 's/${{ env.NC_dbname }}/xyz/g' config/config.php | |
php occ config:system:set debug --value=true --type=boolean | |
OC_PASS=uSr1paSZsg php occ user:add --password-from-env --display-name="Test User" --group="users" user | |
php -S localhost:8080 & | |
- uses: actions/checkout@v3 | |
with: | |
path: apps/${{ env.APP_NAME }} | |
- name: Enable App & Test Data | |
run: | | |
php occ app:enable ${{ env.APP_NAME }} | |
cp -R apps/${{ env.APP_NAME }}/tests/nc_py_api/test_dir ./data/admin/files/ | |
php occ files:scan admin | |
- name: Generate coverage report | |
working-directory: apps/${{ env.APP_NAME }} | |
run: | | |
python3 -m pip -v install ".[dev]" | |
coverage run -m pytest -s && coverage xml && coverage html | |
env: | |
SERVER_ROOT: "../.." | |
CPA_LOGLEVEL: debug | |
USER_ID: admin | |
- name: HTML coverage to artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: coverage_${{ matrix.nextcloud }}_${{ matrix.php-version }}_${{ matrix.pgsql-version }} | |
path: apps/${{ env.APP_NAME }}/htmlcov | |
if-no-files-found: error | |
- name: Upload report to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
file: apps/${{ env.APP_NAME }}/coverage.xml | |
flags: python_backend | |
fail_ci_if_error: true | |
verbose: true | |
tests-mysql: | |
needs: [analysis] | |
runs-on: ubuntu-22.04 | |
name: ${{ matrix.nextcloud }} • PHP ${{ matrix.php-version }} • MySQL ${{ matrix.mysql-version }} | |
strategy: | |
fail-fast: false | |
matrix: | |
nextcloud: [ "25.0.2" ] | |
php-version: [ "7.4", "8.0" ] | |
mysql-version: [ "8" ] | |
services: | |
mysql: | |
image: mysql:${{ matrix.mysql-version }} | |
env: | |
MYSQL_ROOT_PASSWORD: rootpassword | |
MYSQL_DATABASE: nextcloud | |
options: >- | |
--health-cmd mysqladmin ping | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 3306:3306 | |
steps: | |
- name: Set up php ${{ matrix.php-version }} | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php-version }} | |
extensions: mbstring, fileinfo, intl, pdo_mysql, zip, gd | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.9' | |
- name: cache-nextcloud | |
id: nextcloud_setup | |
uses: actions/cache@v3 | |
with: | |
path: nextcloud-${{ matrix.nextcloud }}.tar.bz2 | |
key: ${{ matrix.nextcloud }} | |
- name: Download Nextcloud | |
if: steps.nextcloud_setup.outputs.cache-hit != 'true' | |
run: wget -q https://download.nextcloud.com/server/releases/nextcloud-${{ matrix.nextcloud }}.tar.bz2 | |
- name: Set up Nextcloud | |
run: | | |
tar -xjf nextcloud-${{ matrix.nextcloud }}.tar.bz2 --strip-components 1 | |
mkdir data | |
php occ maintenance:install --verbose --database=mysql --database-name=nextcloud \ | |
--database-host=127.0.0.1 --database-user=root --database-pass=rootpassword \ | |
--admin-user admin --admin-pass adminpassword | |
php occ config:system:set debug --value=true --type=boolean | |
OC_PASS=uSr1paSZsg php occ user:add --password-from-env --display-name="Test User" --group="users" user | |
php -S localhost:8080 & | |
- uses: actions/checkout@v3 | |
with: | |
path: apps/${{ env.APP_NAME }} | |
- name: Enable App & Test Data | |
run: | | |
php occ app:enable ${{ env.APP_NAME }} | |
cp -R apps/${{ env.APP_NAME }}/tests/nc_py_api/test_dir ./data/admin/files/ | |
php occ files:scan admin | |
- name: Generate coverage report | |
working-directory: apps/${{ env.APP_NAME }} | |
run: | | |
python3 -m pip -v install ".[dev]" | |
coverage run -m pytest -s && coverage xml && coverage html | |
env: | |
SERVER_ROOT: "../.." | |
CPA_LOGLEVEL: debug | |
USER_ID: admin | |
- name: HTML coverage to artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: coverage_${{ matrix.nextcloud }}_${{ matrix.php-version }}_${{ matrix.mysql-version }} | |
path: apps/${{ env.APP_NAME }}/htmlcov | |
if-no-files-found: error | |
- name: Upload report to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
file: apps/${{ env.APP_NAME }}/coverage.xml | |
flags: python_backend | |
fail_ci_if_error: true | |
verbose: true | |
tests-mariadb: | |
needs: [analysis] | |
runs-on: ubuntu-22.04 | |
name: ${{ matrix.nextcloud }} • PHP ${{ matrix.php-version }} • Maria ${{ matrix.mariadb-version }} | |
strategy: | |
fail-fast: false | |
matrix: | |
nextcloud: [ "25.0.2" ] | |
php-version: [ "7.4", "8.0" ] | |
mariadb-version: [ "10.3", "10.10" ] | |
services: | |
mariadb: | |
image: mariadb:${{ matrix.mariadb-version }} | |
env: | |
MARIADB_ROOT_PASSWORD: rootpassword | |
MYSQL_DATABASE: nextcloud | |
options: >- | |
--health-cmd mysqladmin ping | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 3306:3306 | |
steps: | |
- name: Set up php ${{ matrix.php-version }} | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php-version }} | |
extensions: mbstring, fileinfo, intl, pdo_mysql, zip, gd | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.9' | |
- name: cache-nextcloud | |
id: nextcloud_setup | |
uses: actions/cache@v3 | |
with: | |
path: nextcloud-${{ matrix.nextcloud }}.tar.bz2 | |
key: ${{ matrix.nextcloud }} | |
- name: Download Nextcloud | |
if: steps.nextcloud_setup.outputs.cache-hit != 'true' | |
run: wget -q https://download.nextcloud.com/server/releases/nextcloud-${{ matrix.nextcloud }}.tar.bz2 | |
- name: Set up Nextcloud | |
run: | | |
tar -xjf nextcloud-${{ matrix.nextcloud }}.tar.bz2 --strip-components 1 | |
mkdir data | |
php occ maintenance:install --verbose --database=mysql --database-name=nextcloud \ | |
--database-host=127.0.0.1 --database-user=root --database-pass=rootpassword \ | |
--admin-user admin --admin-pass adminpassword | |
php occ config:system:set debug --value=true --type=boolean | |
OC_PASS=uSr1paSZsg php occ user:add --password-from-env --display-name="Test User" --group="users" user | |
php -S localhost:8080 & | |
- uses: actions/checkout@v3 | |
with: | |
path: apps/${{ env.APP_NAME }} | |
- name: Enable App & Test Data | |
run: | | |
php occ app:enable ${{ env.APP_NAME }} | |
cp -R apps/${{ env.APP_NAME }}/tests/nc_py_api/test_dir ./data/admin/files/ | |
php occ files:scan admin | |
- name: Generate coverage report | |
working-directory: apps/${{ env.APP_NAME }} | |
run: | | |
python3 -m pip -v install ".[dev]" | |
coverage run -m pytest -s && coverage xml && coverage html | |
env: | |
SERVER_ROOT: "../.." | |
CPA_LOGLEVEL: debug | |
USER_ID: admin | |
- name: HTML coverage to artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: coverage_${{ matrix.nextcloud }}_${{ matrix.php-version }}_${{ matrix.mariadb-version }} | |
path: apps/${{ env.APP_NAME }}/htmlcov | |
if-no-files-found: error | |
- name: Upload report to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
file: apps/${{ env.APP_NAME }}/coverage.xml | |
flags: python_backend | |
fail_ci_if_error: true | |
verbose: true | |
tests-mysql-socket: | |
needs: [analysis] | |
runs-on: ubuntu-22.04 | |
name: ${{ matrix.nextcloud }} • PHP ${{ matrix.php-version }} • MySQL • SOCK | |
strategy: | |
fail-fast: false | |
matrix: | |
php-version: [ "7.4", "8.0" ] | |
nextcloud: [ "25.0.2" ] | |
steps: | |
- name: Set up php ${{ matrix.php-version }} | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php-version }} | |
extensions: mbstring, fileinfo, intl, pdo_mysql, zip, gd | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.9' | |
- name: cache-nextcloud | |
id: nextcloud_setup | |
uses: actions/cache@v3 | |
with: | |
path: nextcloud-${{ matrix.nextcloud }}.tar.bz2 | |
key: ${{ matrix.nextcloud }} | |
- name: Download Nextcloud | |
if: steps.nextcloud_setup.outputs.cache-hit != 'true' | |
run: wget -q https://download.nextcloud.com/server/releases/nextcloud-${{ matrix.nextcloud }}.tar.bz2 | |
- name: Set up Nextcloud | |
run: | | |
sudo sed -i "s/.*port.*3306.*/port = 3307/" /etc/mysql/mysql.conf.d/mysqld.cnf | |
sudo systemctl restart mysql.service | |
mysql -uroot -proot -e "CREATE DATABASE nextcloud CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;" | |
mysql -uroot -proot -e "show databases;" | |
tar -xjf nextcloud-${{ matrix.nextcloud }}.tar.bz2 --strip-components 1 | |
mkdir data | |
php occ maintenance:install --verbose --database=mysql --database-name=nextcloud \ | |
--database-user=root --database-pass=root \ | |
--admin-user admin --admin-pass adminpassword | |
php occ config:system:set debug --value=true --type=boolean | |
OC_PASS=uSr1paSZsg php occ user:add --password-from-env --display-name="Test User" --group="users" user | |
php -S localhost:8080 & | |
- uses: actions/checkout@v3 | |
with: | |
path: apps/${{ env.APP_NAME }} | |
- name: Enable App & Test Data | |
run: | | |
php occ app:enable ${{ env.APP_NAME }} | |
cp -R apps/${{ env.APP_NAME }}/tests/nc_py_api/test_dir ./data/admin/files/ | |
php occ files:scan admin | |
- name: Generate coverage report | |
working-directory: apps/${{ env.APP_NAME }} | |
run: | | |
python3 -m pip -v install ".[dev]" | |
coverage run -m pytest -s && coverage xml && coverage html | |
env: | |
SERVER_ROOT: "../.." | |
CPA_LOGLEVEL: debug | |
USER_ID: admin | |
- name: HTML coverage to artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: coverage_${{ matrix.nextcloud }}_${{ matrix.php-version }}_mysql_socket | |
path: apps/${{ env.APP_NAME }}/htmlcov | |
if-no-files-found: error | |
- name: Upload report to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
file: apps/${{ env.APP_NAME }}/coverage.xml | |
flags: python_backend | |
fail_ci_if_error: true | |
verbose: true | |
tests-pgsql-socket: | |
needs: [analysis] | |
runs-on: ubuntu-22.04 | |
name: ${{ matrix.nextcloud }} • PHP ${{ matrix.php-version }} • PgSQL • SOCK | |
strategy: | |
fail-fast: false | |
matrix: | |
php-version: [ "8.0" ] | |
nextcloud: [ "25.0.2" ] | |
steps: | |
- name: Set up php ${{ matrix.php-version }} | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php-version }} | |
extensions: mbstring, fileinfo, intl, pdo_mysql, zip, gd | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.9' | |
- name: cache-nextcloud | |
id: nextcloud_setup | |
uses: actions/cache@v3 | |
with: | |
path: nextcloud-${{ matrix.nextcloud }}.tar.bz2 | |
key: ${{ matrix.nextcloud }} | |
- name: Download Nextcloud | |
if: steps.nextcloud_setup.outputs.cache-hit != 'true' | |
run: wget -q https://download.nextcloud.com/server/releases/nextcloud-${{ matrix.nextcloud }}.tar.bz2 | |
- name: Set up Nextcloud | |
run: | | |
sudo sed -i "s/.*local.*all.*all.*peer.*/local all all md5/" /etc/postgresql/14/main/pg_hba.conf | |
sudo sed -i "s/.*listen_addresses.*localhost.*/listen_addresses = ''/" /etc/postgresql/14/main/postgresql.conf | |
sudo systemctl restart postgresql.service | |
sudo -u postgres psql -c "CREATE USER username WITH PASSWORD 'userpass';" | |
sudo -u postgres psql -c "CREATE DATABASE nextcloud TEMPLATE template0 ENCODING 'UNICODE';" | |
sudo -u postgres psql -c "ALTER DATABASE nextcloud OWNER TO username;" | |
sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE nextcloud TO username;" | |
sudo -u postgres psql -c "\l+" | |
tar -xjf nextcloud-${{ matrix.nextcloud }}.tar.bz2 --strip-components 1 | |
mkdir data | |
php occ maintenance:install --verbose --database=pgsql --database-name=nextcloud \ | |
--database-user=username --database-pass=userpass \ | |
--admin-user admin --admin-pass adminpassword --database-host="/var/run/postgresql" | |
php occ config:system:set debug --value=true --type=boolean | |
OC_PASS=uSr1paSZsg php occ user:add --password-from-env --display-name="Test User" --group="users" user | |
php -S localhost:8080 & | |
- uses: actions/checkout@v3 | |
with: | |
path: apps/${{ env.APP_NAME }} | |
- name: Enable App & Test Data | |
run: | | |
php occ app:enable ${{ env.APP_NAME }} | |
cp -R apps/${{ env.APP_NAME }}/tests/nc_py_api/test_dir ./data/admin/files/ | |
php occ files:scan admin | |
- name: Generate coverage report | |
working-directory: apps/${{ env.APP_NAME }} | |
run: | | |
python3 -m pip -v install ".[dev]" | |
coverage run -m pytest -s && coverage xml && coverage html | |
env: | |
SERVER_ROOT: "../.." | |
CPA_LOGLEVEL: debug | |
USER_ID: admin | |
- name: HTML coverage to artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: coverage_${{ matrix.nextcloud }}_${{ matrix.php-version }}_pgsql_socket | |
path: apps/${{ env.APP_NAME }}/htmlcov | |
if-no-files-found: error | |
- name: Upload report to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
file: apps/${{ env.APP_NAME }}/coverage.xml | |
flags: python_backend | |
fail_ci_if_error: true | |
verbose: true |