Skip to content

Increment version to 11.26.0-pre #2

Increment version to 11.26.0-pre

Increment version to 11.26.0-pre #2

Workflow file for this run

name: Run tests
on:
push:
branches:
- master
- '*-legacy'
pull_request:
types: [opened, synchronize, reopened]
permissions:
contents: read
actions: read
pull-requests: read
concurrency:
group: test-${{ github.head_ref || github.ref }}
cancel-in-progress: true
jobs:
checkout:
name: "Check out source and install dependencies"
timeout-minutes: 2
runs-on: ubuntu-latest
outputs:
ref: ${{ steps.info.outputs.ref }}
commit: ${{ steps.info.outputs.commit }}
branch: ${{ steps.info.outputs.branch }}
fork: ${{ steps.info.outputs.fork }}
base-branch: ${{ steps.info.outputs.base-branch }}
base-commit: ${{ steps.info.outputs.base-commit }}
steps:
- name: Checkout code (PR)
id: checkout-pr
if: ${{ github.event_name == 'pull_request' }}
uses: actions/checkout@v7
with:
ref: refs/pull/${{ github.event.pull_request.number }}/head
fetch-depth: 0
- name: Checkout code (push)
id: checkout-push
if: ${{ github.event_name == 'push' }}
uses: actions/checkout@v7
with:
fetch-depth: 0
- name: Set up Node.js
uses: actions/setup-node@v6
with:
node-version-file: '.nvmrc'
- name: Commit info
id: info
run: |
if [ "${{ github.event_name }}" = "pull_request" ]; then
BASE_BRANCH="${{ github.event.pull_request.base.ref }}"
git fetch origin "$BASE_BRANCH"
BASE_COMMIT="$(git merge-base HEAD "origin/$BASE_BRANCH")"
else
BASE_BRANCH="${{ github.ref }}"
BASE_COMMIT="${{ github.event.before }}"
fi
echo ref="${{ steps.checkout-pr.outputs.ref || steps.checkout-push.outputs.ref }}" >> $GITHUB_OUTPUT
echo commit="${{ steps.checkout-pr.outputs.commit || steps.checkout-push.outputs.commit }}" >> $GITHUB_OUTPUT
echo branch="${{ github.head_ref || github.ref }}" >> $GITHUB_OUTPUT
echo fork="${{ (github.event.pull_request && github.event.pull_request.head.repo.owner.login != github.repository_owner) && github.event.pull_request.head.repo.owner.login || null }}" >> $GITHUB_OUTPUT
echo base-branch="$BASE_BRANCH" >> $GITHUB_OUTPUT
echo base-commit="$BASE_COMMIT" >> $GITHUB_OUTPUT
- name: Save PR number
if: ${{ github.event_name == 'pull_request' }}
run: |
echo ${{ github.event.pull_request.number }} > ${{ runner.temp }}/prNo
- name: Upload PR number
if: ${{ github.event_name == 'pull_request' }}
uses: actions/upload-artifact@v7
with:
name: prNo
path: ${{ runner.temp }}/prNo
- name: Install dependencies
uses: ./.github/actions/npm-ci
- name: 'Save working directory'
uses: ./.github/actions/save
with:
name: source
lint:
name: "Run linter"
needs: checkout
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Restore source
uses: ./.github/actions/load
with:
name: source
- name: lint
run: |
npx eslint
build-no-features:
name: "Build (all features disabled)"
needs: checkout
uses: ./.github/workflows/build.yml
with:
build-cmd: npx gulp precompile-all-features-disabled
source-key: 'source'
test-no-features:
name: "Unit tests (all features disabled)"
needs: [checkout, build-no-features]
uses: ./.github/workflows/run-tests.yml
with:
chunks: 8
built-key: ${{ needs.build-no-features.outputs.linux }}
test-cmd: npx gulp test-all-features-disabled-nobuild
browserstack: false
secrets:
BROWSERSTACK_USER_NAME: ${{ secrets.BROWSERSTACK_USER_NAME }}
BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
test:
name: "Browser tests"
needs: checkout
uses: ./.github/workflows/browser-tests.yml
secrets:
BROWSERSTACK_USER_NAME: ${{ secrets.BROWSERSTACK_USER_NAME }}
BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
base-coverage-check:
name: Check for base branch coverage
needs: [checkout]
outputs:
needs-base-coverage: ${{ steps.restore.outputs.cache-hit != 'true' }}
runs-on: ubuntu-latest
steps:
- name: Restore from cache
id: restore
uses: actions/cache/restore@v6
with:
path: ${{ runner.temp }}/coverage.info
key: coverage-${{ needs.checkout.outputs.base-commit }}
- name: Rename restored file
if: ${{ steps.restore.outputs.cache-hit == 'true' }}
run: |
mv "${{ runner.temp }}/coverage.info" "base-coverage.info"
- name: Save as artifact
if: ${{ steps.restore.outputs.cache-hit == 'true' }}
uses: actions/upload-artifact@v7
with:
name: base-coverage.info
path: base-coverage.info
- name: Checkout
if: ${{ steps.restore.outputs.cache-hit != 'true' }}
uses: actions/checkout@v7
with:
ref: ${{ needs.checkout.outputs.base-commit }}
- name: Install dependencies
if: ${{ steps.restore.outputs.cache-hit != 'true' }}
uses: ./.github/actions/npm-ci
- name: 'Save working directory'
if: ${{ steps.restore.outputs.cache-hit != 'true' }}
uses: ./.github/actions/save
with:
name: base-branch-source
base-coverage-compute:
name: Compute base branch coverage
needs: [base-coverage-check]
if: ${{ needs.base-coverage-check.outputs.needs-base-coverage == 'true' }}
uses: ./.github/workflows/browser-tests.yml
with:
source-key: base-branch-source
coverage-only: true
base-coverage-combine:
name: Combine base branch coverage
needs: [checkout, base-coverage-check, base-coverage-compute]
if: ${{ needs.base-coverage-check.outputs.needs-base-coverage == 'true' }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Combine coverage results
uses: ./.github/actions/combine-coverage
with:
source-artifact: ${{ needs.base-coverage-compute.outputs.coverage }}
lcov: base-coverage.info
cache-key: coverage-${{needs.checkout.outputs.base-commit}}
coverage:
name: Coverage
needs: [checkout, test, base-coverage-combine]
if: always() && needs.test.result == 'success' && (needs.base-coverage-combine.result == 'success' || needs.base-coverage-combine.result == 'skipped')
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Combine coverage results
uses: ./.github/actions/combine-coverage
with:
source-artifact: ${{ needs.test.outputs.coverage }}
lcov: coverage.info
cache-key: coverage-${{needs.checkout.outputs.commit}}
- name: Fetch base branch coverage
uses: actions/download-artifact@v8
with:
path: "."
name: "base-coverage.info"
- name: Generate coverage annotations
uses: barecheck/code-coverage-action@v1
with:
github-token: ${{ github.token }}
lcov-file: "coverage.info"
base-lcov-file: "base-coverage.info"
minimum-ratio: 0
send-summary-comment: false
show-annotations: "warning"