Merge remote-tracking branch 'origin' into fix/tus-upload #1063
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: PR Evaluation | |
on: | |
pull_request: | |
types: [opened, synchronize, reopened, ready_for_review, edited] | |
branches: ['main'] | |
jobs: | |
semantic_pr: | |
name: Semantic PR title | |
runs-on: ubuntu-latest | |
if: ${{ github.event.action != 'edited' || github.event.changes.title != null }} | |
steps: | |
- uses: amannn/action-semantic-pull-request@v5 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
# Configure which types are allowed (newline-delimited). | |
# Default: https://github.com/commitizen/conventional-commit-types | |
types: | | |
fix | |
feat | |
docs | |
style | |
refactor | |
perf | |
test | |
build | |
ci | |
chore | |
revert | |
# Configure additional validation for the subject based on a regex. | |
# This example ensures the subject doesn't start with an uppercase character & has more than 50 chars. | |
subjectPattern: ^(?![A-Z])(?=.{1,50}$).+$ | |
# If `subjectPattern` is configured, you can use this property to override | |
# the default error message that is shown when the pattern doesn't match. | |
# The variables `subject` and `title` can be used within the message. | |
subjectPatternError: | | |
The subject "{subject}" found in the pull request title "{title}" | |
didn't match the configured pattern. Please ensure that the subject | |
doesn't start with an uppercase character & not have more than 50 characters. | |
detect-unresolved-conflicts: | |
name: Detect unresolved merge conflicts | |
runs-on: ubuntu-latest | |
needs: semantic_pr | |
steps: | |
- uses: actions/checkout@v3 | |
- name: List files with merge conflict markers | |
run: git --no-pager grep "<<<<<<<" ":(exclude).github/" || true | |
- name: Fail or succeed job if any files with merge conflict markers have been checked in | |
# Find lines containing "<<<<<<<", then count the number of lines. | |
# 0 matching lines results in exit code 0, i.e. success. | |
run: exit $(git grep "<<<<<<<" ":(exclude).github/" | wc --lines) | |
linters: | |
name: Linting checks | |
runs-on: ubuntu-latest | |
needs: semantic_pr | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 2 | |
- name: Use Node.js 20.x | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 20.x | |
- name: Get node version | |
id: node | |
run: | | |
echo "::set-output name=version::$(node -v)" | |
- name: Get node_modules cache | |
uses: actions/[email protected] | |
id: node_modules | |
with: | |
path: | | |
**/node_modules | |
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/package.lock') }}-${{ steps.node.outputs.version }} | |
- name: Install dependencies | |
run: npm install | |
- name: Run linters | |
run: npm run lint | |
tests: | |
name: Test checks | |
runs-on: ubuntu-latest | |
needs: semantic_pr | |
strategy: | |
matrix: | |
node-version: [18.x, 20.x] | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 2 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Get node version | |
id: node | |
run: | | |
echo "::set-output name=version::$(node -v)" | |
- name: Get node_modules cache | |
uses: actions/[email protected] | |
id: node_modules | |
with: | |
path: | | |
**/node_modules | |
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/package.lock') }}-${{ steps.node.outputs.version }} | |
- name: Cache Playwright | |
id: playwright-cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cache/ms-playwright | |
key: ${{ runner.os }}-playwright-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-playwright- | |
- name: Install dependencies | |
run: npm ci | |
- name: Install playwright | |
run: npx playwright install --with-deps | |
if: steps.playwright-cache.outputs.cache-hit != 'true' | |
- name: Install playwright dependencies | |
- run: npx playwright install-deps | |
if: steps.playwright-cache.outputs.cache-hit == 'true' | |
- name: Build | |
run: npm run build | |
- name: Run tests | |
run: npm run test |