Compare commits
1 Commits
stable1.10
...
ci/query-c
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
011488d63b |
49
.github/workflows/integration.yml
vendored
49
.github/workflows/integration.yml
vendored
@@ -94,8 +94,57 @@ jobs:
|
|||||||
cat config/config.php
|
cat config/config.php
|
||||||
./occ user:list
|
./occ user:list
|
||||||
./occ app:enable --force ${{ env.APP_NAME }}
|
./occ app:enable --force ${{ env.APP_NAME }}
|
||||||
|
./occ config:system:set query_log_file --value '/home/runner/work/${{ env.APP_NAME }}/${{ env.APP_NAME }}/query.log'
|
||||||
php -S localhost:8080 &
|
php -S localhost:8080 &
|
||||||
|
|
||||||
- name: Run behat
|
- name: Run behat
|
||||||
working-directory: apps/${{ env.APP_NAME }}/tests/integration
|
working-directory: apps/${{ env.APP_NAME }}/tests/integration
|
||||||
run: ./run.sh
|
run: ./run.sh
|
||||||
|
|
||||||
|
- name: Query count
|
||||||
|
if: ${{ matrix.databases == 'mysql' }}
|
||||||
|
uses: actions/github-script@v5
|
||||||
|
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 /home/runner/work/${{ env.APP_NAME }}/${{ env.APP_NAME }}/query.log | wc -l"`, [], options)
|
||||||
|
msg = myOutput
|
||||||
|
const queryCount = parseInt(myOutput, 10)
|
||||||
|
|
||||||
|
myOutput = ''
|
||||||
|
await exec.exec('cat', ['/home/runner/work/${{ env.APP_NAME }}/${{ env.APP_NAME }}/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
|
||||||
|
})
|
||||||
|
}
|
||||||
1
tests/integration/base-query-count.txt
Normal file
1
tests/integration/base-query-count.txt
Normal file
@@ -0,0 +1 @@
|
|||||||
|
61324
|
||||||
@@ -40,7 +40,6 @@ class ServerContext implements Context {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function getCookieJar(): CookieJar {
|
public function getCookieJar(): CookieJar {
|
||||||
echo $this->currentUser;
|
|
||||||
return $this->cookieJar;
|
return $this->cookieJar;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -27,16 +27,16 @@ if [ -z "$EXECUTOR_NUMBER" ]; then
|
|||||||
fi
|
fi
|
||||||
PORT=$((9090 + $EXECUTOR_NUMBER))
|
PORT=$((9090 + $EXECUTOR_NUMBER))
|
||||||
echo $PORT
|
echo $PORT
|
||||||
php -S localhost:$PORT -t $OC_PATH &
|
php -q -S localhost:$PORT -t $OC_PATH &
|
||||||
PHPPID=$!
|
PHPPID=$!
|
||||||
echo $PHPPID
|
echo $PHPPID
|
||||||
|
|
||||||
export TEST_SERVER_URL="http://localhost:$PORT/ocs/"
|
export TEST_SERVER_URL="http://localhost:$PORT/ocs/"
|
||||||
|
|
||||||
vendor/bin/behat $SCENARIO_TO_RUN
|
vendor/bin/behat --colors $SCENARIO_TO_RUN
|
||||||
RESULT=$?
|
RESULT=$?
|
||||||
|
|
||||||
kill $PHPPID
|
kill -9 $PHPPID
|
||||||
|
|
||||||
echo "runsh: Exit code: $RESULT"
|
echo "runsh: Exit code: $RESULT"
|
||||||
exit $RESULT
|
exit $RESULT
|
||||||
|
|||||||
Reference in New Issue
Block a user