Merge pull request #29 from prasetyodimas/feat/ci-cd #64
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: CI | |
on: | |
push: | |
branches: | |
- '*' | |
- '*/*' | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 16.20.2 | |
- name: Install dependencies | |
run: npm install --force | |
- name: Build of code | |
run: npm run build | |
- name: Run unit tests | |
id: unit-tests | |
run: | | |
if npm run test:ci; then | |
echo "{name}={value}" >> $GITHUB_STATE | |
else | |
echo "{name}={value}" >> $GITHUB_OUTPUT | |
fi | |
- name: Check test status | |
run: exit 1 | |
if: ${{ steps.unit-tests.outputs.status == 'failure' }} |