Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable25] Fix CI #4912

Merged
merged 5 commits into from
Jul 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 19 additions & 7 deletions .github/workflows/cypress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
pull_request:
push:
branches:
- master
- main
- stable*

env:
Expand All @@ -14,7 +14,7 @@ env:
jobs:
cypress:

runs-on: ubuntu-latest
runs-on: self-hosted

strategy:
fail-fast: false
Expand All @@ -33,6 +33,11 @@ jobs:
- name: Set up npm7
run: npm i -g npm@7

- name: Register text Git reference
run: |
text_app_ref="$(if [ "${{ matrix.server-versions }}" = "master" ]; then echo -n "main"; else echo -n "${{ matrix.server-versions }}"; fi)"
echo "text_app_ref=$text_app_ref" >> $GITHUB_ENV

- name: Checkout server
uses: actions/checkout@v3
with:
Expand All @@ -51,11 +56,18 @@ jobs:
with:
path: apps/${{ env.APP_NAME }}

- name: Checkout text
uses: actions/checkout@v3
with:
repository: nextcloud/text
ref: ${{ env.text_app_ref }}
path: apps/text

- name: Set up php ${{ matrix.php-versions }}
uses: shivammathur/setup-php@2.21.2
uses: shivammathur/setup-php@2.25.4
with:
php-version: ${{ matrix.php-versions }}
extensions: mbstring, iconv, fileinfo, intl, sqlite, pdo_sqlite, zip, gd, apcu
extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, intl, json, libxml, mbstring, openssl, pcntl, posix, session, simplexml, xmlreader, xmlwriter, zip, zlib, sqlite, pdo_sqlite, apcu
ini-values:
apc.enable_cli=on
coverage: none
Expand Down Expand Up @@ -84,7 +96,7 @@ jobs:
curl -v http://localhost:8081/index.php/login

- name: Cypress run
uses: cypress-io/github-action@v4
uses: cypress-io/github-action@v5
with:
record: true
parallel: false
Expand All @@ -96,15 +108,15 @@ jobs:
npm_package_name: ${{ env.APP_NAME }}

- name: Upload test failure screenshots
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
if: failure()
with:
name: Upload screenshots
path: apps/${{ env.APP_NAME }}/cypress/screenshots/
retention-days: 5

- name: Upload nextcloud logs
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
if: failure()
with:
name: Upload nextcloud log
Expand Down
64 changes: 59 additions & 5 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ on:
- 'composer.lock'
push:
branches:
- main
- master
- stable*

Expand Down Expand Up @@ -70,16 +71,17 @@ jobs:
path: apps/${{ env.APP_NAME }}

- name: Set up php ${{ matrix.php-versions }}
uses: shivammathur/setup-php@2.21.2
uses: shivammathur/setup-php@2.25.4
with:
php-version: ${{ matrix.php-versions }}
tools: phpunit
extensions: mbstring, iconv, fileinfo, intl, sqlite, pdo_sqlite, mysql, pdo_mysql, pgsql, pdo_pgsql,
extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, intl, json, libxml, mbstring, openssl, pcntl, posix, session, simplexml, xmlreader, xmlwriter, zip, zlib, sqlite, pdo_sqlite, mysql, pdo_mysql, pgsql, pdo_pgsql, apcu
ini-values:
apc.enable_cli=on
coverage: none

- name: Set up PHPUnit
- name: Set up dependencies
working-directory: apps/${{ env.APP_NAME }}
run: composer i
run: composer i --no-dev

- name: Set up Nextcloud
run: |
Expand All @@ -90,11 +92,63 @@ jobs:
fi
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 admin
./occ config:system:set hashing_default_password --value=true --type=boolean
./occ config:system:set memcache.local --value="\\OC\\Memcache\\APCu"
./occ config:system:set memcache.distributed --value="\\OC\\Memcache\\APCu"
cat config/config.php
./occ user:list
./occ app:enable --force ${{ env.APP_NAME }}
./occ config:system:set query_log_file --value "$PWD/query.log"
php -S localhost:8080 &

- name: Run behat
working-directory: apps/${{ env.APP_NAME }}/tests/integration
run: ./run.sh

- name: Query count
if: ${{ matrix.databases == 'mysql' }}
uses: actions/github-script@v6
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
let myOutput = ''
let myError = ''

const options = {}
options.listeners = {
stdout: (data) => {
myOutput += data.toString()
},
stderr: (data) => {
myError += data.toString()
}
}
await exec.exec(`/bin/bash -c "cat query.log | wc -l"`, [], options)
msg = myOutput
const queryCount = parseInt(myOutput, 10)

myOutput = ''
await exec.exec('cat', ['apps/${{ env.APP_NAME }}/tests/integration/base-query-count.txt'], options)
const baseCount = parseInt(myOutput, 10)

const absoluteIncrease = queryCount - baseCount
const relativeIncrease = baseCount <= 0 ? 100 : (parseInt((absoluteIncrease / baseCount * 10000), 10) / 100)

if (absoluteIncrease >= 100 || relativeIncrease > 5) {
const comment = `🐢 Performance warning.\nIt looks like the query count of the integration tests increased with this PR.\nDatabase query count is now ` + queryCount + ' was ' + baseCount + ' (+' + relativeIncrease + '%)\nPlease check your code again. If you added a new test this can be expected and the base value in tests/integration/base-query-count.txt can be increased.'
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: comment
})
}
if (queryCount < 100) {
const comment = `🐈 Performance messuring seems broken. Failed to get query count.`
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: comment
})
}
64 changes: 0 additions & 64 deletions .github/workflows/nightly.yml

This file was deleted.

Loading