Skip to content

Increase PHP Test Coverage #789

Increase PHP Test Coverage

Increase PHP Test Coverage #789

Workflow file for this run

name: CI
on:
push:
branches:
- master
- release--*
tags:
- "!v[0-9]+.[0-9]+.[0-9]+"
- "!v[0-9]+.[0-9]+.[0-9]+-"
pull_request:
branches:
- master
- release--*
jobs:
check-commit-message:
name: Check Commit Message
runs-on: ubuntu-latest
steps:
- name: Proofread commit types
uses: gsactions/commit-message-checker@v1
with:
pattern: '^(feat|fix|docs|style|refactor|test|chore).+'
error: 'Commit messages must begin with a valid commit type.'
excludeDescription: 'true'
excludeTitle: 'true'
checkAllCommitMessages: 'true'
accessToken: ${{ secrets.GITHUB_TOKEN }}
set-variables:
name: Set Variables
runs-on: ubuntu-latest
timeout-minutes: 2
outputs:
node-version: ${{ steps.nvm.outputs.NVMRC }}
php-version: ${{ steps.php.outputs.PHP_VERSION }}
release-version: ${{ steps.release-version.outputs.RELEASE_VERSION }}
steps:
- uses: actions/checkout@v4
- name: Read .nvmrc
run: echo "NVMRC=$(cat .nvmrc)" >> $GITHUB_OUTPUT
id: nvm
- name: Get PHP cersion
run: echo "PHP_VERSION=7.4" >> $GITHUB_OUTPUT
id: php
- name: Set release version
run: echo "RELEASE_VERSION=$(cat package.json | jq -r '.version')" >> $GITHUB_OUTPUT
id: release-version
install-dependencies:
name: Cache Dependencies
runs-on: ubuntu-latest
timeout-minutes: 20
needs: set-variables
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set Node version
uses: actions/setup-node@v4
with:
node-version: ${{ needs.set-variables.outputs.node-version }}
- name: Set PHP version
uses: shivammathur/setup-php@v2
with:
php-version: ${{ needs.set-variables.outputs.php-version }}
- name: Install Node dependencies
run: npm ci
- name: Install Composer dependencies
run: composer install
- name: Save to cache
uses: actions/cache@v4
with:
path: |
vendor
node_modules
key: dependencies-${{ runner.os }}-${{ github.sha }}
analyze:
name: Static Analysis
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: 'javascript'
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
linting:
name: Linting
runs-on: ubuntu-latest
timeout-minutes: 20
needs:
- install-dependencies
- set-variables
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set Node version
uses: actions/setup-node@v4
with:
node-version: ${{ needs.set-variables.outputs.node-version }}
- name: Pull dependencies from cache
uses: actions/cache@v4
with:
path: |
vendor
node_modules
key: dependencies-${{ runner.os }}-${{ github.sha }}
- name: Lint JavaScript source code
run: npm run lint
- name: Lint PHP source code
run: composer lint
testing-javascript:
name: Testing - JavaScript
runs-on: ubuntu-latest
timeout-minutes: 20
needs:
- install-dependencies
- set-variables
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set Node version
uses: actions/setup-node@v4
with:
node-version: ${{ needs.set-variables.outputs.node-version }}
- name: Pull dependencies from cache
uses: actions/cache@v4
with:
path: |
vendor
node_modules
key: dependencies-${{ runner.os }}-${{ github.sha }}
- name: Test JavaScript source code
run: npm test
testing-php:
name: Testing - PHP
runs-on: ubuntu-latest
timeout-minutes: 20
needs:
- install-dependencies
- set-variables
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set PHP version
uses: shivammathur/setup-php@v2
with:
php-version: ${{ needs.set-variables.outputs.php-version }}
coverage: xdebug
- name: Pull dependencies from cache
uses: actions/cache@v4
with:
path: |
vendor
node_modules
key: dependencies-${{ runner.os }}-${{ github.sha }}
- name: Test PHP source code
run: composer test:coverage
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4.0.1
with:
token: ${{ secrets.CODECOV_TOKEN }}
slug: jordanleven/force-refresh
file: ./coverage/coverage.xml
building:
name: Building
runs-on: ubuntu-latest
timeout-minutes: 20
needs:
- install-dependencies
- set-variables
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set Node version
uses: actions/setup-node@v4
with:
node-version: ${{ needs.set-variables.outputs.node-version }}
- name: Pull dependencies from cache
uses: actions/cache@v4
with:
path: |
vendor
node_modules
key: dependencies-${{ runner.os }}-${{ github.sha }}
- name: Build JavaScript artifact
run: npm run build