Skip to content

Update actions/stale action to v9 (#209) #220

Update actions/stale action to v9 (#209)

Update actions/stale action to v9 (#209) #220

Workflow file for this run

name: Test
on:
pull_request:
branches:
- main
- dev
paths-ignore:
- l10n/**
push:
branches:
- main
- dev
paths-ignore:
- l10n/**
workflow_dispatch:
env:
# Location of the phpunit.unit.xml and phpunit.integration.xml files
PHPUNIT_CONFIG: ./tests/phpunit.unit.xml
PHPUNIT_INTEGRATION_CONFIG: ./tests/phpunit.integration.xml
APP_NAME: mediadc
CPA_NAME: cloud_py_api
jobs:
phpunit-mysql:
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: ["7.4", "8.0"]
nextcloud: ['25.0.3']
services:
mysql:
image: mariadb:11.1
ports:
- 4444:3306/tcp
env:
MYSQL_ROOT_PASSWORD: rootpassword
options: --health-cmd="mysqladmin ping" --health-interval 5s --health-timeout 2s --health-retries 5
steps:
- name: Set up php ${{ matrix.php-versions }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
tools: phpunit
extensions: mbstring, iconv, fileinfo, intl, mysql, pdo_mysql
coverage: xdebug
- 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: Unpack nextcloud
run: tar -xjf nextcloud-${{ matrix.nextcloud }}.tar.bz2 --strip-components 1
- name: Checkout ${{ env.APP_NAME }} app
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
with:
path: apps/${{ env.APP_NAME }}
- name: Checkout ${{ env.CPA_NAME }} app
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
with:
repository: cloud-py-api/${{ env.CPA_NAME }}
path: apps/${{ env.CPA_NAME }}
- name: Set up PHPUnit
working-directory: apps/${{ env.APP_NAME }}
run: composer i
- name: Set up Nextcloud
env:
DB_PORT: 4444
run: |
mkdir data
php occ maintenance:install --verbose --database=mysql --database-name=nextcloud \
--database-host=127.0.0.1 --database-port=$DB_PORT --database-user=root \
--database-pass=rootpassword --admin-user admin --admin-pass password
php occ app:enable ${{ env.CPA_NAME }}
php occ app:enable ${{ env.APP_NAME }}
- name: Check PHPUnit config file existence
id: check_phpunit
uses: andstor/file-existence-action@v2
with:
files: apps/${{ env.APP_NAME }}/${{ env.PHPUNIT_CONFIG }}
- name: Run Nextcloud
run: php -S localhost:8080 &
- name: PHPUnit
# Only run if phpunit config file exists
if: steps.check_phpunit.outputs.files_exists == 'true'
working-directory: apps/${{ env.APP_NAME }}
run: composer test:unit:coverage
- name: HTML coverage to artifacts
if: steps.check_phpunit.outputs.files_exists == 'true'
uses: actions/upload-artifact@v3
with:
name: coverage_unit_${{ matrix.nextcloud }}_${{ matrix.php-versions }}_mysql
path: apps/${{ env.APP_NAME }}/tests/coverage/php/unit
if-no-files-found: error
- name: Clover coverage to artifacts
if: steps.check_phpunit.outputs.files_exists == 'true'
uses: actions/upload-artifact@v3
with:
name: clover_coverage_unit_${{ matrix.nextcloud }}_${{ matrix.php-versions }}_mysql.xml
path: apps/${{ env.APP_NAME }}/tests/coverage/php/unit/clover.xml
if-no-files-found: error
- name: Upload to Codecov
if: steps.check_phpunit.outputs.files_exists == 'true'
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: apps/${{ env.APP_NAME }}/tests/coverage/php/unit/clover.xml
flags: php_backend
verbose: true
fail_ci_if_error: true
- name: Check PHPUnit integration config file existence
id: check_integration
uses: andstor/file-existence-action@v2
with:
files: apps/${{ env.APP_NAME }}/${{ env.PHPUNIT_INTEGRATION_CONFIG }}
- name: PHPUnit integration
# Only run if phpunit integration config file exists
if: steps.check_integration.outputs.files_exists == 'true'
working-directory: apps/${{ env.APP_NAME }}
run: composer test:integration:coverage
- name: HTML coverage to artifacts
if: steps.check_integration.outputs.files_exists == 'true'
uses: actions/upload-artifact@v3
with:
name: coverage_integration_${{ matrix.nextcloud }}_${{ matrix.php-versions }}_mysql
path: apps/${{ env.APP_NAME }}/tests/coverage/php/integration
if-no-files-found: error
- name: Clover coverage to artifacts
if: steps.check_integration.outputs.files_exists == 'true'
uses: actions/upload-artifact@v3
with:
name: clover_coverage_integration_${{ matrix.nextcloud }}_${{ matrix.php-versions }}_mysql.xml
path: apps/${{ env.APP_NAME }}/tests/coverage/php/integration/clover.xml
if-no-files-found: error
- name: Upload to Codecov
if: steps.check_integration.outputs.files_exists == 'true'
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: apps/${{ env.APP_NAME }}/tests/coverage/php/integration/clover.xml
flags: php_backend
verbose: true
fail_ci_if_error: true
phpunit-pgsql:
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: ["8.0"]
nextcloud: ['25.0.3']
services:
postgres:
image: postgres
ports:
- 4444:5432/tcp
env:
POSTGRES_USER: root
POSTGRES_PASSWORD: rootpassword
POSTGRES_DB: nextcloud
options: --health-cmd pg_isready --health-interval 5s --health-timeout 2s --health-retries 5
steps:
- name: Set up php ${{ matrix.php-versions }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
tools: phpunit
extensions: mbstring, iconv, fileinfo, intl, pgsql, pdo_pgsql
coverage: xdebug
- 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: Unpack nextcloud
run: tar -xjf nextcloud-${{ matrix.nextcloud }}.tar.bz2 --strip-components 1
- name: Checkout app
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
with:
path: apps/${{ env.APP_NAME }}
- name: Checkout ${{ env.CPA_NAME }} app
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
with:
repository: cloud-py-api/${{ env.CPA_NAME }}
path: apps/${{ env.CPA_NAME }}
- name: Set up PHPUnit
working-directory: apps/${{ env.APP_NAME }}
run: composer i
- name: Set up Nextcloud
env:
DB_PORT: 4444
run: |
mkdir data
php occ maintenance:install --verbose --database=pgsql --database-name=nextcloud \
--database-host=127.0.0.1 --database-port=$DB_PORT --database-user=root \
--database-pass=rootpassword --admin-user admin --admin-pass password
php occ app:enable ${{ env.CPA_NAME }}
php occ app:enable ${{ env.APP_NAME }}
- name: Check PHPUnit config file existence
id: check_phpunit
uses: andstor/file-existence-action@v2
with:
files: apps/${{ env.APP_NAME }}/${{ env.PHPUNIT_CONFIG }}
- name: PHPUnit
# Only run if phpunit config file exists
if: steps.check_phpunit.outputs.files_exists == 'true'
working-directory: apps/${{ env.APP_NAME }}
run: composer test:unit:coverage
- name: HTML coverage to artifacts
if: steps.check_phpunit.outputs.files_exists == 'true'
uses: actions/upload-artifact@v3
with:
name: coverage_unit_${{ matrix.nextcloud }}_${{ matrix.php-versions }}_pgsql
path: apps/${{ env.APP_NAME }}/tests/coverage/php/unit
if-no-files-found: error
- name: Clover coverage to artifacts
if: steps.check_phpunit.outputs.files_exists == 'true'
uses: actions/upload-artifact@v3
with:
name: clover_coverage_unit_${{ matrix.nextcloud }}_${{ matrix.php-versions }}_pgsql.xml
path: apps/${{ env.APP_NAME }}/tests/coverage/php/unit/clover.xml
if-no-files-found: error
- name: Upload to Codecov
if: steps.check_phpunit.outputs.files_exists == 'true'
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: apps/${{ env.APP_NAME }}/tests/coverage/php/unit/clover.xml
flags: php_backend
verbose: true
fail_ci_if_error: true
- name: Check PHPUnit integration config file existence
id: check_integration
uses: andstor/file-existence-action@v2
with:
files: apps/${{ env.APP_NAME }}/${{ env.PHPUNIT_INTEGRATION_CONFIG }}
- name: Run Nextcloud
# Only run if phpunit integration config file exists
if: steps.check_integration.outputs.files_exists == 'true'
run: php -S localhost:8080 &
- name: PHPUnit integration
# Only run if phpunit integration config file exists
if: steps.check_integration.outputs.files_exists == 'true'
working-directory: apps/${{ env.APP_NAME }}
run: composer test:integration:coverage
- name: HTML coverage to artifacts
if: steps.check_integration.outputs.files_exists == 'true'
uses: actions/upload-artifact@v3
with:
name: coverage_integration_${{ matrix.nextcloud }}_${{ matrix.php-versions }}_pgsql
path: apps/${{ env.APP_NAME }}/tests/coverage/php/integration
if-no-files-found: error
- name: Clover coverage to artifacts
if: steps.check_integration.outputs.files_exists == 'true'
uses: actions/upload-artifact@v3
with:
name: clover_coverage_integration_${{ matrix.nextcloud }}_${{ matrix.php-versions }}_pgsql.xml
path: apps/${{ env.APP_NAME }}/tests/coverage/php/integration/clover.xml
if-no-files-found: error
- name: Upload to Codecov
if: steps.check_integration.outputs.files_exists == 'true'
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: apps/${{ env.APP_NAME }}/tests/coverage/php/integration/clover.xml
flags: php_backend
verbose: true
fail_ci_if_error: true
# js-unit:
# runs-on: ubuntu-latest
# steps:
# - name: Checkout app
# uses: actions/checkout@v3
# with:
# path: apps/${{ env.APP_NAME }}
# - name: Setup Node
# uses: actions/setup-node@v3
# with:
# node-version: 16.x
# - name: Install dependencies
# working-directory: apps/${{ env.APP_NAME }}
# run: npm ci
# - name: Run unit tests
# working-directory: apps/${{ env.APP_NAME }}
# run: npm run test:coverage
# - name: JavaScript coverage to artifacts
# uses: actions/upload-artifact@v3
# with:
# name: coverage_js_unit
# path: apps/${{ env.APP_NAME }}/tests/coverage/javascript
# if-no-files-found: error
# - name: Upload to Codecov
# uses: codecov/codecov-action@v3
# with:
# token: ${{ secrets.CODECOV_TOKEN }}
# file: apps/${{ env.APP_NAME }}/tests/coverage/javascript/clover.xml
# flags: frontend
# verbose: true
# fail_ci_if_error: true