Add some tests to the pipeline #1
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
on: | |
push: | |
branches: | |
- main | |
name: pipeline | |
jobs: | |
pipeline: | |
name: Test & Build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
- name: Cache node_modules | |
id: cache-modules | |
uses: actions/cache@v1 | |
with: | |
path: node_modules | |
key: 18.x-${{ runner.OS }}-build-${{ hashFiles('package.json') }} | |
- name: NPM Install | |
if: steps.cache-modules.outputs.cache-hit != 'true' | |
run: npm install | |
- name: Lint | |
run: npm run-script lint | |
- name: Pretty | |
run: npm run-script prettier-check | |
# complete the test coverage | |
- name: Test | |
run: npm test | |
- name: Build | |
run: npm run build | |
- name: Publish | |
id: publish | |
uses: JS-DevTools/npm-publish@v1 | |
with: | |
token: ${{ secrets.NODE_SERVER_SDK_NPM_AUTH_TOKEN }} | |
- name: Send Slack notification | |
uses: 8398a7/action-slack@v3 | |
with: | |
status: ${{ job.status }} | |
fields: repo | |
text: Published to NPM ${{ steps.publish.outputs.old-version }} -> ${{ steps.publish.outputs.version }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
if: steps.publish.outputs.type != 'none' && always() |