https://github.com/nexys-system/gh-actions-spa-test
Github actions for single page application (SPA) - build + test
https://github.com/nexys-system/gh-actions-spa-test
Last synced: 2 months ago
JSON representation
Github actions for single page application (SPA) - build + test
- Host: GitHub
- URL: https://github.com/nexys-system/gh-actions-spa-test
- Owner: nexys-system
- Created: 2022-08-15T15:47:32.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2025-03-13T12:08:09.000Z (3 months ago)
- Last Synced: 2025-03-13T13:23:05.250Z (3 months ago)
- Homepage: https://github.com/marketplace/actions/yarn-spa-test
- Size: 24.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Continuous Integration (CI) GitHub Actions for JS Single Page Application
This GitHub Action is optimized for testing and building JavaScript Single Page Applications, particularly projects set up with [Vite](https://vitejs.dev/).
## Assumptions
- `yarn test`: A script for running tests. If your project doesn't have tests, ensure you add `"test": "echo \"no tests\""` to the `scripts` section of your `package.json`.
- `yarn build`: A script for building your project. This can be customized using the `build-command` parameter (see below).## Basic Usage
```yaml
name: Teston: [push]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: nexys-system/[email protected]
```## Parameters
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`- `nodeversion`: Specifies the Node.js version to use.
- Default: `20`- `use-cache`: Determines whether to cache Yarn dependencies based on the `yarn.lock` file.
- Default: `true`- `deploy-project-name`: Specifies the project name for the deploy service. If this and `deploy-token` are provided, the action will attempt to deploy your application.
- `deploy-token`: Specifies the token needed for deployment. If this and `deploy-project-name` are provided, the action will attempt to deploy your application.
### Usage Example with Multiple Parameters
```yaml
...
- uses: nexys-system/[email protected]
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.
## Deployment Configuration
For deploying your application through [Nova](https://nova.nexys.io), 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.
## Docker Integration
To generate a Docker container for your application, refer to the [gh-actions-docker-spa](https://github.com/nexys-system/gh-actions-docker-spa) repository for a compatible action.