mirror of
https://github.com/flarum/core.git
synced 2025-08-03 15:07:53 +02:00
feat(actions): allow running JS tests in GH actions (#3730)
Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>
This commit is contained in:
17
.github/workflows/REUSABLE_frontend.yml
vendored
17
.github/workflows/REUSABLE_frontend.yml
vendored
@@ -28,6 +28,11 @@ on:
|
|||||||
type: string
|
type: string
|
||||||
required: false
|
required: false
|
||||||
default: check-typings-coverage
|
default: check-typings-coverage
|
||||||
|
test_script:
|
||||||
|
description: "Script to run for tests. Empty value to disable."
|
||||||
|
type: string
|
||||||
|
required: false
|
||||||
|
default: test
|
||||||
|
|
||||||
enable_bundlewatch:
|
enable_bundlewatch:
|
||||||
description: "Enable Bundlewatch?"
|
description: "Enable Bundlewatch?"
|
||||||
@@ -44,6 +49,11 @@ on:
|
|||||||
type: boolean
|
type: boolean
|
||||||
default: true
|
default: true
|
||||||
required: false
|
required: false
|
||||||
|
enable_tests:
|
||||||
|
description: "Enable Tests?"
|
||||||
|
type: boolean
|
||||||
|
default: false
|
||||||
|
required: false
|
||||||
|
|
||||||
backend_directory:
|
backend_directory:
|
||||||
description: The directory of the project where backend code is located. This should contain a `composer.json` file, and is generally the root directory of the repo.
|
description: The directory of the project where backend code is located. This should contain a `composer.json` file, and is generally the root directory of the repo.
|
||||||
@@ -96,10 +106,10 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Check out code
|
- name: Check out code
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Set up Node
|
- name: Set up Node
|
||||||
uses: actions/setup-node@v2
|
uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: ${{ inputs.node_version }}
|
node-version: ${{ inputs.node_version }}
|
||||||
cache: ${{ inputs.js_package_manager }}
|
cache: ${{ inputs.js_package_manager }}
|
||||||
@@ -122,7 +132,7 @@ jobs:
|
|||||||
working-directory: ${{ inputs.frontend_directory }}
|
working-directory: ${{ inputs.frontend_directory }}
|
||||||
|
|
||||||
- name: JS Checks & Production Build
|
- name: JS Checks & Production Build
|
||||||
uses: flarum/action-build@3
|
uses: flarum/action-build@v3
|
||||||
with:
|
with:
|
||||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
build_script: ${{ inputs.build_script }}
|
build_script: ${{ inputs.build_script }}
|
||||||
@@ -130,6 +140,7 @@ jobs:
|
|||||||
format_script: ${{ inputs.enable_prettier == true && inputs.format_script || '' }}
|
format_script: ${{ inputs.enable_prettier == true && inputs.format_script || '' }}
|
||||||
check_typings_script: ${{ inputs.enable_typescript == true && inputs.check_typings_script || '' }}
|
check_typings_script: ${{ inputs.enable_typescript == true && inputs.check_typings_script || '' }}
|
||||||
type_coverage_script: ${{ inputs.enable_typescript == true && inputs.type_coverage_script || '' }}
|
type_coverage_script: ${{ inputs.enable_typescript == true && inputs.type_coverage_script || '' }}
|
||||||
|
test_script: ${{ inputs.enable_tests == true && inputs.test_script || '' }}
|
||||||
package_manager: ${{ inputs.js_package_manager }}
|
package_manager: ${{ inputs.js_package_manager }}
|
||||||
js_path: ${{ inputs.frontend_directory }}
|
js_path: ${{ inputs.frontend_directory }}
|
||||||
do_not_commit: ${{ github.ref != format('refs/heads/{0}', inputs.main_git_branch) || github.event_name != 'push' }}
|
do_not_commit: ${{ github.ref != format('refs/heads/{0}', inputs.main_git_branch) || github.event_name != 'push' }}
|
||||||
|
3
.github/workflows/frontend.yml
vendored
3
.github/workflows/frontend.yml
vendored
@@ -11,6 +11,9 @@ jobs:
|
|||||||
js_package_manager: yarn
|
js_package_manager: yarn
|
||||||
cache_dependency_path: ./yarn.lock
|
cache_dependency_path: ./yarn.lock
|
||||||
main_git_branch: main
|
main_git_branch: main
|
||||||
|
enable_tests: true
|
||||||
|
# @TODO: fix bundlewatch
|
||||||
|
enable_bundlewatch: false
|
||||||
|
|
||||||
secrets:
|
secrets:
|
||||||
bundlewatch_github_token: ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }}
|
bundlewatch_github_token: ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }}
|
||||||
|
Reference in New Issue
Block a user