Use dev-master for NC28 compat #88
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: PHPUnit-Coverage | |
on: | |
pull_request: | |
push: | |
branches: | |
- master | |
- stable* | |
env: | |
APP_NAME: workflow_ocr | |
jobs: | |
php: | |
runs-on: ubuntu-20.04 | |
strategy: | |
# do not stop on another job's failure | |
fail-fast: false | |
matrix: | |
php-versions: ['8.2'] | |
databases: ['sqlite'] | |
server-versions: ['master'] | |
name: php${{ matrix.php-versions }}-${{ matrix.databases }}-COVERAGE | |
steps: | |
- name: Checkout server | |
uses: actions/checkout@v3 | |
with: | |
repository: nextcloud/server | |
ref: ${{ matrix.server-versions }} | |
- 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: 0 | |
- 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, sqlite, pdo_sqlite, gd, zip, imagick | |
coverage: xdebug | |
- name: Set up PHPUnit | |
working-directory: apps/${{ env.APP_NAME }} | |
run: composer i | |
- name: Set up Nextcloud | |
env: | |
DB_PORT: 4444 | |
run: | | |
mkdir data | |
./occ maintenance:install --verbose --database=${{ matrix.databases }} --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 ${{ env.APP_NAME }} | |
php -S localhost:8080 & | |
- name: Read package.json node and npm engines version | |
uses: skjnldsv/read-package-engines-version-actions@v2 | |
id: versions | |
continue-on-error: false | |
with: | |
path: ./apps/${{ env.APP_NAME }} | |
- name: Set up node ${{ steps.versions.outputs.nodeVersion }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ steps.versions.outputs.nodeVersion }} | |
- name: Set up npm ${{ steps.versions.outputs.npmVersion }} | |
run: npm i -g npm@"${{ steps.versions.outputs.npmVersion }}" | |
- name: Run PHP and JS tests with coverage tracking and merge results | |
working-directory: apps/${{ env.APP_NAME }} | |
run: make coverage-all | |
- name: Fix code coverage paths | |
working-directory: ./apps/${{ env.APP_NAME }}/coverage | |
run: sed -i 's@'$GITHUB_WORKSPACE'@/github/workspace/@g' php-coverage.xml | |
- name: SonarCloud Scan | |
uses: SonarSource/sonarcloud-github-action@master | |
with: | |
projectBaseDir: ./apps/${{ env.APP_NAME }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |