mirror of
https://github.com/inventree/InvenTree.git
synced 2026-03-11 22:54:17 +00:00
re-enable codspeed (#11457)
* re-enable codspeed * fix style * use 2 step check * use more verbose syntax * run performance even if not needed otherwise * fix possible injection * another possible injection * fix syntax * run python api instead of backend perf test forced * only submit tests when running in correct enviroment
This commit is contained in:
32
.github/workflows/qc_checks.yaml
vendored
32
.github/workflows/qc_checks.yaml
vendored
@@ -23,8 +23,6 @@ env:
|
|||||||
INVENTREE_SITE_URL: http://localhost:8000
|
INVENTREE_SITE_URL: http://localhost:8000
|
||||||
INVENTREE_DEBUG: true
|
INVENTREE_DEBUG: true
|
||||||
|
|
||||||
use_performance: false
|
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
|
|
||||||
@@ -42,6 +40,8 @@ jobs:
|
|||||||
cicd: ${{ steps.filter.outputs.cicd }}
|
cicd: ${{ steps.filter.outputs.cicd }}
|
||||||
requirements: ${{ steps.filter.outputs.requirements }}
|
requirements: ${{ steps.filter.outputs.requirements }}
|
||||||
runner-perf: ${{ steps.runner-perf.outputs.runner }}
|
runner-perf: ${{ steps.runner-perf.outputs.runner }}
|
||||||
|
performance: ${{ steps.performance.outputs.force-performance }}
|
||||||
|
submit-performance: ${{ steps.runner-perf.outputs.submit-performance }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # pin@v6.0.2
|
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # pin@v6.0.2
|
||||||
@@ -77,10 +77,29 @@ jobs:
|
|||||||
if: |
|
if: |
|
||||||
contains(github.event.pull_request.labels.*.name, 'dependency') ||
|
contains(github.event.pull_request.labels.*.name, 'dependency') ||
|
||||||
contains(github.event.pull_request.labels.*.name, 'full-run')
|
contains(github.event.pull_request.labels.*.name, 'full-run')
|
||||||
|
- name: Is performance testing being forced?
|
||||||
|
run: echo "force-performance=true" >> $GITHUB_OUTPUT
|
||||||
|
id: performance
|
||||||
|
if: |
|
||||||
|
contains(github.event.pull_request.labels.*.name, 'performance-run')
|
||||||
- name: Which runner to use?
|
- name: Which runner to use?
|
||||||
|
env:
|
||||||
|
GITHUB_REF: ${{ github.ref }}
|
||||||
|
PERFORMANCE: ${{ steps.performance.outputs.force-performance }}
|
||||||
id: runner-perf
|
id: runner-perf
|
||||||
# decide if we are running in inventree/inventree -> use codspeed-macro runner else ubuntu-24.04
|
# decide if we are running in inventree/inventree -> use codspeed-macro runner else ubuntu-24.04
|
||||||
run: echo "runner=$([[ '${{ github.repository }}' == 'inventree/InvenTree' && '${{ env.use_performance }}' == 'true' ]] && echo 'codspeed-macro' || echo 'ubuntu-24.04')" >> $GITHUB_OUTPUT
|
run: |
|
||||||
|
is_main_push=false
|
||||||
|
if [[ '${{ github.event_name }}' == 'push' && "$GITHUB_REF" == 'refs/heads/master' ]]; then
|
||||||
|
is_main_push=true
|
||||||
|
fi
|
||||||
|
if [[ '${{ github.repository }}' == 'inventree/InvenTree' && ( "$is_main_push" == 'true' || "$PERFORMANCE" == 'true' ) ]]; then
|
||||||
|
echo "runner=codspeed-macro" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "submit-performance=true" >> "$GITHUB_OUTPUT"
|
||||||
|
else
|
||||||
|
echo "runner=ubuntu-24.04" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "submit-performance=false" >> "$GITHUB_OUTPUT"
|
||||||
|
fi
|
||||||
|
|
||||||
pre-commit:
|
pre-commit:
|
||||||
name: Style [pre-commit]
|
name: Style [pre-commit]
|
||||||
@@ -292,7 +311,7 @@ jobs:
|
|||||||
runs-on: ${{ needs.paths-filter.outputs.runner-perf }}
|
runs-on: ${{ needs.paths-filter.outputs.runner-perf }}
|
||||||
|
|
||||||
needs: ["pre-commit", "paths-filter"]
|
needs: ["pre-commit", "paths-filter"]
|
||||||
if: needs.paths-filter.outputs.server == 'true' || needs.paths-filter.outputs.force == 'true'
|
if: needs.paths-filter.outputs.server == 'true' || needs.paths-filter.outputs.force == 'true' || needs.paths-filter.outputs.performance == 'true'
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
id-token: write
|
id-token: write
|
||||||
@@ -341,10 +360,11 @@ jobs:
|
|||||||
pip uninstall pytest-django -y
|
pip uninstall pytest-django -y
|
||||||
cd ${WRAPPER_NAME}
|
cd ${WRAPPER_NAME}
|
||||||
pip install .
|
pip install .
|
||||||
|
if: needs.paths-filter.outputs.submit-performance == 'true'
|
||||||
- name: Performance Reporting
|
- name: Performance Reporting
|
||||||
uses: CodSpeedHQ/action@dbda7111f8ac363564b0c51b992d4ce76bb89f2f # pin@v4
|
uses: CodSpeedHQ/action@dbda7111f8ac363564b0c51b992d4ce76bb89f2f # pin@v4
|
||||||
# check if we are in inventree/inventree - reporting only works in that OIDC context
|
# check if we are in inventree/inventree - reporting only works in that OIDC context
|
||||||
if: github.repository == 'inventree/InvenTree'
|
if: github.repository == 'inventree/InvenTree' && needs.paths-filter.outputs.submit-performance == 'true'
|
||||||
with:
|
with:
|
||||||
mode: walltime
|
mode: walltime
|
||||||
run: pytest ./src/performance --codspeed
|
run: pytest ./src/performance --codspeed
|
||||||
@@ -406,7 +426,7 @@ jobs:
|
|||||||
|
|
||||||
needs: ["pre-commit", "paths-filter"]
|
needs: ["pre-commit", "paths-filter"]
|
||||||
# check if we are in inventree/inventree - reporting only works in that OIDC context
|
# check if we are in inventree/inventree - reporting only works in that OIDC context
|
||||||
if: (needs.paths-filter.outputs.server == 'true' || needs.paths-filter.outputs.force == 'true') && github.repository == 'inventree/InvenTree'
|
if: (needs.paths-filter.outputs.server == 'true' || needs.paths-filter.outputs.force == 'true') && github.repository == 'inventree/InvenTree' && needs.paths-filter.outputs.submit-performance == 'true'
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
id-token: write
|
id-token: write
|
||||||
|
|||||||
Reference in New Issue
Block a user