mirror of
https://gh.wpcy.net/https://github.com/syntatis/kubrick.git
synced 2026-04-26 21:52:37 +08:00
Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
208 lines
5.2 KiB
YAML
208 lines
5.2 KiB
YAML
name: ci
|
|
|
|
on:
|
|
workflow_call:
|
|
secrets:
|
|
CODECOV_TOKEN:
|
|
description: "Token for uploading test coverage to Codecov"
|
|
required: true
|
|
workflow_dispatch:
|
|
push:
|
|
branches:
|
|
- main
|
|
paths:
|
|
- "**.ts"
|
|
- "**.tsx"
|
|
- "**.scss"
|
|
- ".github/workflows/**"
|
|
- ".eslint*"
|
|
- ".stylelint*"
|
|
- "package-lock.json"
|
|
- "package.json"
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
types:
|
|
- opened
|
|
- synchronize
|
|
paths:
|
|
- "**.ts"
|
|
- "**.tsx"
|
|
- "**.scss"
|
|
- ".github/workflows/**"
|
|
- ".eslint*"
|
|
- ".stylelint*"
|
|
- "package-lock.json"
|
|
- "package.json"
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.event.number || github.sha }}
|
|
cancel-in-progress: true
|
|
|
|
env:
|
|
NODE_VERSION: 22
|
|
|
|
jobs:
|
|
lint-scripts:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v5
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v6
|
|
with:
|
|
node-version: ${{ env.NODE_VERSION }}
|
|
cache: "npm"
|
|
|
|
- name: Setup PHP
|
|
uses: shivammathur/setup-php@v2
|
|
with:
|
|
php-version: "7.4"
|
|
|
|
- name: Get Composer cache directory
|
|
id: composer-cache
|
|
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
|
|
|
|
- name: Cache Composer dependencies
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: ${{ steps.composer-cache.outputs.dir }}
|
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
|
restore-keys: ${{ runner.os }}-composer
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
npm ci --workspaces --no-audit --ignore-scripts
|
|
composer install
|
|
npm run build
|
|
|
|
- name: Run build
|
|
run: npm run build
|
|
|
|
- name: Run lint
|
|
run: npm run lint:scripts --workspaces --if-present
|
|
|
|
lint-styles:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v5
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v6
|
|
with:
|
|
node-version: ${{ env.NODE_VERSION }}
|
|
cache: "npm"
|
|
|
|
- name: Setup PHP
|
|
uses: shivammathur/setup-php@v2
|
|
with:
|
|
php-version: "7.4"
|
|
|
|
- name: Get Composer cache directory
|
|
id: composer-cache
|
|
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
|
|
|
|
- name: Cache Composer dependencies
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: ${{ steps.composer-cache.outputs.dir }}
|
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
|
restore-keys: ${{ runner.os }}-composer
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
npm ci --workspaces --workspaces --no-audit --ignore-scripts
|
|
composer install
|
|
|
|
- name: Run build
|
|
run: npm run build
|
|
|
|
- name: Run lint
|
|
run: npm run lint:styles --workspaces --if-present
|
|
|
|
lint-types:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v5
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v6
|
|
with:
|
|
node-version: ${{ env.NODE_VERSION }}
|
|
cache: "npm"
|
|
|
|
- name: Setup PHP
|
|
uses: shivammathur/setup-php@v2
|
|
with:
|
|
php-version: "7.4"
|
|
|
|
- name: Get Composer cache directory
|
|
id: composer-cache
|
|
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
|
|
|
|
- name: Cache Composer dependencies
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: ${{ steps.composer-cache.outputs.dir }}
|
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
|
restore-keys: ${{ runner.os }}-composer
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
npm ci --workspaces --no-audit --ignore-scripts
|
|
composer install
|
|
|
|
- name: Run build
|
|
run: npm run build
|
|
|
|
- name: Run lint
|
|
run: npm run lint:types --workspaces --if-present
|
|
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v5
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v6
|
|
with:
|
|
node-version: ${{ env.NODE_VERSION }}
|
|
cache: "npm"
|
|
|
|
- name: Setup PHP
|
|
uses: shivammathur/setup-php@v2
|
|
with:
|
|
php-version: "7.4"
|
|
|
|
- name: Get Composer cache directory
|
|
id: composer-cache
|
|
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
|
|
|
|
- name: Cache Composer dependencies
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: ${{ steps.composer-cache.outputs.dir }}
|
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
|
restore-keys: ${{ runner.os }}-composer
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
npm ci --workspaces --no-audit --ignore-scripts
|
|
composer install --prefer-dist
|
|
|
|
- name: Run build
|
|
run: npm run build
|
|
|
|
- name: Run test
|
|
run: npm run test:coverage
|
|
|
|
- name: Upload coverage to Codecov
|
|
uses: codecov/codecov-action@v5
|
|
env:
|
|
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|