Unit and Integration Tests #1824
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: Unit and Integration Tests | |
on: | |
pull_request: | |
push: | |
branches: | |
- master | |
- stable* | |
schedule: | |
- cron: '0 2 * * *' | |
env: | |
APP_NAME: auto_groups | |
PHP_EXTENSIONS: mbstring, iconv, fileinfo, intl, sqlite, pdo_sqlite, xdebug, zip, gd | |
CACHE_KEY: cache-v3 # can be any string, change to clear the extension cache. | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
continue-on-error: ${{ matrix.experimental }} | |
strategy: | |
fail-fast: false | |
matrix: | |
php-versions: ['7.4', '8.0', '8.1' ] | |
databases: ['sqlite'] | |
server-versions: ['stable22', 'stable23', 'stable24', 'stable25', 'stable26', 'stable27', 'stable28'] | |
experimental: [false] | |
include: | |
- php-versions: '8.1' | |
databases: sqlite | |
server-versions: master | |
experimental: true | |
exclude: | |
- php-versions: '8.1' | |
databases: sqlite | |
server-versions: 'stable22' | |
experimental: false | |
- php-versions: '8.1' | |
databases: sqlite | |
server-versions: 'stable23' | |
experimental: false | |
- php-versions: '7.4' | |
databases: sqlite | |
server-versions: 'stable26' | |
experimental: false | |
- php-versions: '7.4' | |
databases: sqlite | |
server-versions: 'stable27' | |
experimental: false | |
- php-versions: '7.4' | |
databases: sqlite | |
server-versions: 'stable28' | |
experimental: false | |
name: test-php${{ matrix.php-versions }}-${{ matrix.databases }}-${{ matrix.server-versions }} | |
steps: | |
- name: Checkout Nextcloud Server | |
uses: actions/checkout@v3 | |
with: | |
repository: nextcloud/server | |
ref: ${{ matrix.server-versions }} | |
fetch-depth: 2 | |
- name: Checkout submodules | |
shell: bash | |
run: | | |
auth_header="$(git config --local --get http.https://github.com/.extraheader)" | |
git submodule sync --recursive | |
git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive --depth=1 | |
- name: Checkout app | |
uses: actions/checkout@v3 | |
with: | |
path: apps/${{ env.APP_NAME }} | |
fetch-depth: 2 | |
- name: Setup cache environment | |
id: cache-env | |
uses: shivammathur/cache-extensions@v1 | |
with: | |
php-version: ${{ matrix.php-versions }} | |
extensions: ${{ env.PHP_EXTENSIONS }} | |
key: ${{ env.CACHE_KEY }} | |
- name: Cache extensions | |
uses: actions/cache@v3 | |
with: | |
path: ${{ steps.cache-env.outputs.dir }} | |
key: ${{ steps.cache-env.outputs.key }} | |
restore-keys: ${{ steps.cache-env.outputs.key }} | |
- name: Set up php ${{ matrix.php-versions }} | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php-versions }} | |
tools: phpunit:9.6.9 | |
extensions: ${{ env.PHP_EXTENSIONS }} | |
coverage: xdebug | |
- name: Setup problem matchers for PHP | |
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json" | |
- name: Setup problem matchers for PHPUnit | |
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" | |
- name: Set up Nextcloud | |
run: | | |
mkdir data | |
./occ maintenance:install --verbose --database=${{ matrix.databases }} --database-name=nextcloud --database-user=root --database-pass=rootpassword --admin-user admin --admin-pass password | |
./occ app:enable ${{ env.APP_NAME }} | |
- name: Check Syntax | |
working-directory: apps/${{ env.APP_NAME }} | |
run: composer run lint | |
- name: Unit and Integration Tests | |
working-directory: apps/${{ env.APP_NAME }} | |
run: phpunit -c tests/phpunit.xml | |
env: | |
TRAVIS: true | |
- name: Codecov.io Upload | |
working-directory: apps/${{ env.APP_NAME }} | |
run: bash <(curl -s https://codecov.io/bash) -F ${{ matrix.server-versions }} -f ./tests/coverage.xml |