This GitHub Action is optimized for testing and building JavaScript Single Page Applications, particularly projects set up with Vite.
yarn test
: A script for running tests. If your project doesn't have tests, ensure you add"test": "echo \"no tests\""
to thescripts
section of yourpackage.json
.yarn build
: A script for building your project. This can be customized using thebuild-command
parameter (see below).
name: Test
on: [push]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: nexys-system/gh-actions-spa-test@v1.1.7
This action supports a range of input parameters for customization:
-
build-command
: Specifies the build command to run.- Default:
VITE_VERSION=${GITHUB_REF##*/} VITE_GIT_SHA=$GITHUB_SHA yarn build
- Default:
-
nodeversion
: Specifies the Node.js version to use.- Default:
20
- Default:
-
use-cache
: Determines whether to cache Yarn dependencies based on theyarn.lock
file.- Default:
true
- Default:
-
deploy-project-name
: Specifies the project name for the deploy service. If this anddeploy-token
are provided, the action will attempt to deploy your application. -
deploy-token
: Specifies the token needed for deployment. If this anddeploy-project-name
are provided, the action will attempt to deploy your application.
...
- uses: nexys-system/gh-actions-spa-test@v1.1.6
with:
build-command: yarn buildprod
nodeversion: '14'
use-cache: 'false'
deploy-project-name: 'my-spa-project'
deploy-token: ${{ secrets.DEPLOY_TOKEN }}
In this example, the action is customized with a new build command, a different Node.js version, disabling cache, and providing deployment details.
For deploying your application through Nova, you need to set the following parameters:
deploy-project-name
: Specifies the project name for the deploy service.deploy-token
: Specifies the token needed for deployment.
If the deploy-project-name
and deploy-token
are not provided, the deployment step is skipped, and a message is logged.
To generate a Docker container for your application, refer to the gh-actions-docker-spa repository for a compatible action.