Basic CI pipeline with unit tests setup #4
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is a basic workflow to help you get started with Actions | |
name: CI | |
# Controls when the workflow will run | |
on: | |
# Triggers the workflow on push or pull request events but only for the "main" branch | |
push: | |
pull_request: | |
branches: [ "main" ] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
run-jest-tests: | |
# Name of the job as it will be displayed in GitHub | |
name: Jest Tests | |
# Machine which this action will be run on. For a list of all the machines available/how to run on self hosted machine visit | |
# https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on | |
runs-on: ubuntu-latest | |
# Steps this job must take to complete | |
steps: | |
# Reference the main branch. For more information visit https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstepsuses | |
- name: Checkout under $GITHUB_WORKSPACE | |
uses: actions/checkout@v4 | |
# Specify which version of Node this project is using. For more information visit. | |
# https://docs.github.com/en/actions/guides/building-and-testing-nodejs#specifying-the-nodejs-version | |
- name: Use Node.js 21.x | |
uses: actions/setup-node@v1 | |
with: | |
node-version: 21.x | |
- name: Install client dependencies | |
run: cd client && npm install | |
- name: Install server dependencies | |
run: cd ../server && npm install | |
- name: Run Jest Tests | |
run: cd ../client && npm run test | |
# This workflow contains a single job called "build" | |
build: | |
# The type of runner that the job will run on | |
runs-on: ubuntu-latest | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- name: Checkout under $GITHUB_WORKSPACE | |
uses: actions/checkout@v4 | |
- name: Use Node.js 21.x | |
uses: actions/setup-node@v1 | |
with: | |
node-version: 21.x | |
# Runs a single command using the runners shell | |
- name: Run build | |
run: npm run build |