Skip to content

Test NPM Package

Test NPM Package #89

Workflow file for this run

name: Test NPM Package
on:
push:
branches:
- master
schedule:
- cron: '0 1 * * 1'
jobs:
on-success:
needs: test
runs-on: ubuntu-latest
if: ${{ needs.test.result == 'success' }}
steps:
- name: Notification Feishu
uses: whatwewant/[email protected]
with:
url: ${{ secrets.NPM_VERSION_FEISHU_BOT_WEBHOOK_URL }}
title: '✅ NPM 测试:${{ github.repository }}'
text: |
分支: ${{ github.ref }}
提交信息: ${{ github.event.head_commit.message }}
提交人: ${{ github.actor }}
状态: 构建成功(https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})
on-failure:
needs: test
runs-on: ubuntu-latest
if: ${{ needs.test.result == 'failure' }}
steps:
- name: Notification Feishu
uses: whatwewant/[email protected]
with:
url: ${{ secrets.NPM_VERSION_FEISHU_BOT_WEBHOOK_URL }}
title: '❌ NPM 测试:${{ github.repository }}'
text: |
分支: ${{ github.ref }}
提交信息: ${{ github.event.head_commit.message }}
提交人: ${{ github.actor }}
状态: 构建失败(https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})
test:
# bootstrap:
# 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:
- name: Get Current Date
id: date
run: echo "::set-output name=date::$(date +'%Y-%m-%d')"
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
with:
fetch-depth: '0'
- uses: oleksiyrudenko/gha-git-credentials@v2-latest
with:
token: '${{ secrets.GITHUB_TOKEN }}'
# Runs a single command using the runners shell
- name: Use Node.js
uses: zmicro-design/action-setup-node@v1
with:
node-version: 14.x
registry-url: https://registry.npmjs.org
- name: Cache node_modules
uses: actions/cache@v2
id: yarn-cache
with:
path: ~/.npm
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
- name: Install Dependencies
run: yarn
- name: Make Build
run: yarn build
- name: After Build
run: git checkout tsconfig.json
- name: Make Testing
run: yarn test