Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

feat(actions): allow running JS tests in GH actions #3730

Merged
merged 2 commits into from
Feb 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions .github/workflows/REUSABLE_frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ on:
type: string
required: false
default: check-typings-coverage
test_script:
description: "Script to run for tests. Empty value to disable."
type: string
required: false
default: test

enable_bundlewatch:
description: "Enable Bundlewatch?"
Expand All @@ -44,6 +49,11 @@ on:
type: boolean
default: true
required: false
enable_tests:
description: "Enable Tests?"
type: boolean
default: false
required: false

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.
Expand Down Expand Up @@ -96,10 +106,10 @@ jobs:

steps:
- name: Check out code
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Set up Node
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: ${{ inputs.node_version }}
cache: ${{ inputs.js_package_manager }}
Expand All @@ -122,14 +132,15 @@ jobs:
working-directory: ${{ inputs.frontend_directory }}

- name: JS Checks & Production Build
uses: flarum/action-build@3
uses: flarum/action-build@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
build_script: ${{ inputs.build_script }}
build_typings_script: ${{ inputs.build_typings_script }}
format_script: ${{ inputs.enable_prettier == true && inputs.format_script || '' }}
check_typings_script: ${{ inputs.enable_typescript == true && inputs.check_typings_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 }}
js_path: ${{ inputs.frontend_directory }}
do_not_commit: ${{ github.ref != format('refs/heads/{0}', inputs.main_git_branch) || github.event_name != 'push' }}
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ jobs:
js_package_manager: yarn
cache_dependency_path: ./yarn.lock
main_git_branch: main
enable_tests: true
# @TODO: fix bundlewatch
enable_bundlewatch: false

secrets:
bundlewatch_github_token: ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }}