diff options
author | Joas Schilling <coding@schilljs.com> | 2022-04-06 11:32:07 +0300 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2022-04-06 11:32:07 +0300 |
commit | ce4bb32b9a2829a76a48ebb42a06ea06124e31f9 (patch) | |
tree | e2a048acd448e17dadce8465dd59f92d009fa32b | |
parent | 988838b80baa5796b848e7bd0544e6900a6ed8ac (diff) |
Update phpunit action
Signed-off-by: Joas Schilling <coding@schilljs.com>
-rw-r--r-- | .github/workflows/phpunit-sqlite.yml | 33 |
1 files changed, 25 insertions, 8 deletions
diff --git a/.github/workflows/phpunit-sqlite.yml b/.github/workflows/phpunit-sqlite.yml index 1cd7454..add1391 100644 --- a/.github/workflows/phpunit-sqlite.yml +++ b/.github/workflows/phpunit-sqlite.yml @@ -8,9 +8,7 @@ on: - stable* env: - APP_NAME: files_downloadactivity # Location of the phpunit.xml and phpunit.integration.xml files - # Comment to disable PHPUNIT_CONFIG: ./tests/phpunit.xml PHPUNIT_INTEGRATION_CONFIG: ./tests/phpunit.integration.xml @@ -19,8 +17,6 @@ jobs: runs-on: ubuntu-latest strategy: - # do not stop on another job's failure - fail-fast: false matrix: php-versions: ["7.4", "8.0"] server-versions: ["master", "stable23", "stable22"] @@ -33,6 +29,11 @@ jobs: server-versions: "master" steps: + - name: Set app env + run: | + # Split and keep last + echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV + - name: Checkout server uses: actions/checkout@v3 with: @@ -63,18 +64,34 @@ jobs: run: | mkdir data ./occ maintenance:install --verbose --database=sqlite --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 - ./occ app:enable --force ${{ env.APP_NAME }} - php -S localhost:8080 & + ./occ app:enable ${{ env.APP_NAME }} + + - name: Check PHPUnit config file existence + id: check_phpunit + uses: andstor/file-existence-action@v1 + with: + files: apps/${{ env.APP_NAME }}/${{ env.PHPUNIT_CONFIG }} - name: PHPUnit # Only run if phpunit config file exists - if: env.PHPUNIT_CONFIG != '' + if: steps.check_phpunit.outputs.files_exists == 'true' working-directory: apps/${{ env.APP_NAME }} run: ./vendor/phpunit/phpunit/phpunit -c ${{ env.PHPUNIT_CONFIG }} + - name: Check PHPUnit integration config file existence + id: check_integration + uses: andstor/file-existence-action@v1 + 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: env.PHPUNIT_INTEGRATION_CONFIG != '' + if: steps.check_integration.outputs.files_exists == 'true' working-directory: apps/${{ env.APP_NAME }} run: ./vendor/phpunit/phpunit/phpunit -c ${{ env.PHPUNIT_INTEGRATION_CONFIG }} |