mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-10 23:36:14 -05:00
Split CI database tests into separate types
- this will allow us to see which set of tests are consuming the most amount of time in CI - in order to split apart the commands, I've had to override the coverage thresholds for integration+regression tests in order to keep c8 happy - also sprinkled some more labels into the workflows to make things clearer to read
This commit is contained in:
parent
ade8a1f5f4
commit
3e12c0ea54
3 changed files with 33 additions and 15 deletions
35
.github/workflows/test.yml
vendored
35
.github/workflows/test.yml
vendored
|
@ -211,9 +211,11 @@ jobs:
|
||||||
mysql database: 'ghost_testing'
|
mysql database: 'ghost_testing'
|
||||||
mysql root password: 'root'
|
mysql root password: 'root'
|
||||||
|
|
||||||
- run: yarn --prefer-offline
|
- name: Install dependencies
|
||||||
|
run: yarn --prefer-offline
|
||||||
|
|
||||||
- run: date +%s > ${{ runner.temp }}/startTime # Get start time for test suite
|
- name: Record start time
|
||||||
|
run: date +%s > ${{ runner.temp }}/startTime # Get start time for test suite
|
||||||
|
|
||||||
- name: Set env vars (SQLite)
|
- name: Set env vars (SQLite)
|
||||||
if: contains(matrix.env.DB, 'sqlite')
|
if: contains(matrix.env.DB, 'sqlite')
|
||||||
|
@ -223,12 +225,21 @@ jobs:
|
||||||
if: contains(matrix.env.DB, 'mysql')
|
if: contains(matrix.env.DB, 'mysql')
|
||||||
run: echo "database__connection__password=root" >> $GITHUB_ENV
|
run: echo "database__connection__password=root" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Run tests
|
- name: E2E tests
|
||||||
working-directory: ghost/core
|
working-directory: ghost/core
|
||||||
run: yarn test:ci
|
run: yarn test:ci:e2e
|
||||||
|
|
||||||
|
- name: Regression tests
|
||||||
|
working-directory: ghost/core
|
||||||
|
run: yarn test:ci:regression
|
||||||
|
|
||||||
|
- name: Integration tests
|
||||||
|
working-directory: ghost/core
|
||||||
|
run: yarn test:ci:integration
|
||||||
|
|
||||||
# Get runtime in seconds for test suite
|
# Get runtime in seconds for test suite
|
||||||
- run: |
|
- name: Record test duration
|
||||||
|
run: |
|
||||||
startTime="$(cat ${{ runner.temp }}/startTime)"
|
startTime="$(cat ${{ runner.temp }}/startTime)"
|
||||||
endTime="$(date +%s)"
|
endTime="$(date +%s)"
|
||||||
echo "test_time=$(($endTime-$startTime))" >> $GITHUB_ENV
|
echo "test_time=$(($endTime-$startTime))" >> $GITHUB_ENV
|
||||||
|
@ -237,7 +248,10 @@ jobs:
|
||||||
if: startsWith(matrix.node, '16') && contains(matrix.env.DB, 'mysql')
|
if: startsWith(matrix.node, '16') && contains(matrix.env.DB, 'mysql')
|
||||||
with:
|
with:
|
||||||
name: e2e-coverage
|
name: e2e-coverage
|
||||||
path: ghost/*/coverage-e2e/cobertura-coverage.xml
|
path: |
|
||||||
|
ghost/*/coverage-e2e/cobertura-coverage.xml
|
||||||
|
ghost/*/coverage-integration/cobertura-coverage.xml
|
||||||
|
ghost/*/coverage-regression/cobertura-coverage.xml
|
||||||
|
|
||||||
# Continue on error if TailScale service is down
|
# Continue on error if TailScale service is down
|
||||||
- name: Tailscale Action
|
- name: Tailscale Action
|
||||||
|
@ -250,7 +264,8 @@ jobs:
|
||||||
|
|
||||||
# Report time taken to metrics service
|
# Report time taken to metrics service
|
||||||
# Continue on error if previous TailScale step fails
|
# Continue on error if previous TailScale step fails
|
||||||
- uses: tryghost/action-trigger-metric@main
|
- name: Store test duration
|
||||||
|
uses: tryghost/action-trigger-metric@main
|
||||||
timeout-minutes: 1
|
timeout-minutes: 1
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
if: (github.event_name == 'push' && github.repository_owner == 'TryGhost') || (github.event_name == 'pull_request' && startsWith(github.head_ref, 'TryGhost/'))
|
if: (github.event_name == 'push' && github.repository_owner == 'TryGhost') || (github.event_name == 'pull_request' && startsWith(github.head_ref, 'TryGhost/'))
|
||||||
|
@ -360,7 +375,8 @@ jobs:
|
||||||
rsync -av --remove-source-files admin/* ghost/admin
|
rsync -av --remove-source-files admin/* ghost/admin
|
||||||
rsync -av --remove-source-files core/* ghost/core
|
rsync -av --remove-source-files core/* ghost/core
|
||||||
|
|
||||||
- uses: codecov/codecov-action@v3
|
- name: Upload E2E test coverage
|
||||||
|
uses: codecov/codecov-action@v3
|
||||||
with:
|
with:
|
||||||
flags: e2e-tests
|
flags: e2e-tests
|
||||||
move_coverage_to_trash: true
|
move_coverage_to_trash: true
|
||||||
|
@ -371,7 +387,8 @@ jobs:
|
||||||
name: unit-coverage
|
name: unit-coverage
|
||||||
path: coverage
|
path: coverage
|
||||||
- run: rsync -av --remove-source-files coverage/* ghost/
|
- run: rsync -av --remove-source-files coverage/* ghost/
|
||||||
- uses: codecov/codecov-action@v3
|
- name: Upload unit test coverage
|
||||||
|
uses: codecov/codecov-action@v3
|
||||||
with:
|
with:
|
||||||
flags: unit-tests
|
flags: unit-tests
|
||||||
|
|
||||||
|
|
|
@ -7,10 +7,10 @@
|
||||||
"cobertura"
|
"cobertura"
|
||||||
],
|
],
|
||||||
"reportsDir": "./coverage-e2e",
|
"reportsDir": "./coverage-e2e",
|
||||||
"statements": 86,
|
"statements": 80,
|
||||||
"branches": 85,
|
"branches": 82,
|
||||||
"functions": 87,
|
"functions": 81,
|
||||||
"lines": 86,
|
"lines": 80,
|
||||||
"include": [
|
"include": [
|
||||||
"core/{*.js,frontend,server,shared}"
|
"core/{*.js,frontend,server,shared}"
|
||||||
],
|
],
|
||||||
|
|
|
@ -39,8 +39,9 @@
|
||||||
"test:browser:single": "NODE_ENV=testing-browser playwright test",
|
"test:browser:single": "NODE_ENV=testing-browser playwright test",
|
||||||
"test:browser:setup": "npx playwright install",
|
"test:browser:setup": "npx playwright install",
|
||||||
"test:browser:record": "NODE_ENV=testing-browser yarn start record-test",
|
"test:browser:record": "NODE_ENV=testing-browser yarn start record-test",
|
||||||
"test:ci": "c8 -c ./.c8rc.e2e.json yarn test:ci:base",
|
"test:ci:e2e": "c8 -c ./.c8rc.e2e.json -o coverage-e2e yarn test:e2e -b",
|
||||||
"test:ci:base": "yarn test:e2e -b && yarn test:integration -b && yarn test:regression -b",
|
"test:ci:regression": "c8 -c ./.c8rc.e2e.json -o coverage-regression --lines 72 --functions 66 --branches 82 --statements 72 yarn test:regression -b",
|
||||||
|
"test:ci:integration": "c8 -c ./.c8rc.e2e.json -o coverage-integration --lines 57 --functions 48 --branches 77 --statements 57 yarn test:integration -b",
|
||||||
"test:unit:slow": "yarn test:unit --reporter=mocha-slow-test-reporter",
|
"test:unit:slow": "yarn test:unit --reporter=mocha-slow-test-reporter",
|
||||||
"test:int:slow": "yarn test:integration --reporter=mocha-slow-test-reporter",
|
"test:int:slow": "yarn test:integration --reporter=mocha-slow-test-reporter",
|
||||||
"test:e2e:slow": "yarn test:e2e --reporter=mocha-slow-test-reporter",
|
"test:e2e:slow": "yarn test:e2e --reporter=mocha-slow-test-reporter",
|
||||||
|
|
Loading…
Add table
Reference in a new issue