Update README.md #17
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
name: Test Project | |
on: | |
[push, workflow_dispatch] | |
jobs: | |
run-shell-command: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Print confirmation | |
run: | | |
echo "First output" | |
echo "Second output" | |
run-test-cases: | |
runs-on: ubuntu-latest | |
steps: | |
- name: get code from repository | |
# https://github.com/marketplace/actions/checkout | |
uses: actions/checkout@v4 | |
- name: Install NodeJS | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: Install dependencies | |
### install dependency versions that are locked into the package.json file, use: npm ci instead of npm install | |
run: npm ci | |
- name: run unit tests | |
run: npm test | |
deploy-paackage: | |
## IMPORTANT: each job uses its own runner; its own VM that's totally isolated from other machines and jobs! Therefore, we need to define a new runner. | |
#### note: jobs run in parallel by default. to run sequentially, use the "need" keyword | |
needs: [run-test-cases] | |
runs-on: ubuntu-latest | |
steps: | |
- name: get code | |
uses: actions/checkout@v4 | |
- name: Install NodeJS | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: Install dependencies | |
### install dependency versions that are locked into the package.json file, use: npm ci instead of npm install | |
run: npm ci | |
- name: Build project | |
### build the code for the production environment. the npm run build command will target the "build": "vite build" script to build for production (https://vitejs.dev/guide/build) defined in the package.json file | |
run: npm run build | |
- name: Deploy | |
### normal the code in this step will upload the built to the webserver, but this is out of scope of this course. Just echo some text | |
run: echo "Deploying package ...." | |