mirror of
https://gitlab.com/Binaryify/neteasecloudmusicapi.git
synced 2025-05-23 22:37:41 +08:00
Merge pull request #919 from greenhat616/build-github-action
build: support github actions
This commit is contained in:
commit
606278a9be
56
.github/workflows/node.js.yml
vendored
Normal file
56
.github/workflows/node.js.yml
vendored
Normal file
@ -0,0 +1,56 @@
|
||||
name: Node.js CI
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
push:
|
||||
branches: [ master ]
|
||||
jobs:
|
||||
test:
|
||||
name: Test
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [12.x, 14.x]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Use Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: ~/.npm
|
||||
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-node-
|
||||
- run: npm ci
|
||||
name: Install dependencies
|
||||
- name: Set Test Env
|
||||
run: |
|
||||
export NCM_API_TEST_LOGIN_PHONE=${{ secrets.NCM_API_TEST_LOGIN_PHONE }}
|
||||
export NCM_API_TEST_LOGIN_PASSWORD=${{ secrets.NCM_API_TEST_LOGIN_PASSWORD }}
|
||||
- name: Test
|
||||
run: npm test
|
||||
lint:
|
||||
name: Lint
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [14.x]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Use Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: ~/.npm
|
||||
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-node-
|
||||
- run: npm ci
|
||||
name: Install dependencies
|
||||
- name: Lint
|
||||
run: npm lint
|
@ -5,7 +5,8 @@
|
||||
"scripts": {
|
||||
"start": "node app.js",
|
||||
"test": "mocha -r intelli-espower-loader -t 20000 app.test.js --exit",
|
||||
"lint-fix": "eslint --fix --ext .js app.js module/ util/ test/ "
|
||||
"lint": "eslint **/*.{js,ts}",
|
||||
"lint-fix": "eslint --fix **/*.{js,ts}"
|
||||
},
|
||||
"keywords": [
|
||||
"网易云音乐",
|
||||
|
@ -3,12 +3,13 @@ const request = require('request')
|
||||
const host = global.host || 'http://localhost:3000'
|
||||
|
||||
console.log('注意: 测试登录需在 test/login.test.js 中填写账号密码!!!');
|
||||
|
||||
const phone = ''
|
||||
const password = ''
|
||||
describe('测试登录是否正常', () => {
|
||||
it('手机登录 code 应该等于200', done => {
|
||||
const qs = {
|
||||
phone: phone,
|
||||
password: password
|
||||
phone: process.env.NCM_API_TEST_LOGIN_PHONE || phone || '',
|
||||
password: process.env.NCM_API_TEST_LOGIN_PASSWORD || password || ''
|
||||
}
|
||||
|
||||
request.get({url: `${host}/login/cellphone`, qs: qs}, (err, res, body) => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user