-
Notifications
You must be signed in to change notification settings - Fork 229
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* test: lerna run test * feat(action): test workflow * feat: github action publish * feat(actions): add feflowbot account * feat: on tag push * feat(lerna): add lerna build workflow * feat(lerna): lerna run build Co-authored-by: bethonxyfu <bethonxyfu@tencent.com>
- Loading branch information
1 parent
1a16c7f
commit 2e1fdd9
Showing
6 changed files
with
99 additions
and
46 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: Publish with Lerna | ||
|
||
on: | ||
push: | ||
tags: | ||
- "*" | ||
|
||
jobs: | ||
Publish_Workflow: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v1.0.0 | ||
- name: Git Identity | ||
run: | | ||
git config --global user.name 'feflowbot' | ||
git config --global user.email 'feflowbot@gmail.com' | ||
git remote set-url origin https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$GITHUB_REPOSITORY | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Prepare repository | ||
run: git checkout "${GITHUB_REF:11}" | ||
- name: Pulling | ||
run: git pull | ||
- name: Install dependencies | ||
run: npm i | ||
- name: Authenticate with Registry | ||
run: | | ||
yarn logout | ||
echo "Tencent/feflow:registry=http://registry.npmjs.org/" > .npmrc | ||
echo "registry=http://registry.npmjs.org/" >> .npmrc | ||
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> .npmrc | ||
npm whoami | ||
env: | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
- name: Lerna bootstrap | ||
run: npx lerna bootstrap | ||
- name: Lerna build | ||
run: npx lerna run build | ||
- name: Publish with Lerna | ||
run: npx lerna publish --yes --message 'chore(release)' --cd-version=patch | ||
env: | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node | ||
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions | ||
|
||
name: Test | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
- release | ||
- feat_* | ||
tags: | ||
- "*" | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
node-version: [10.x] | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- run: npm install lerna -g | ||
- run: lerna bootstrap | ||
- run: lerna run test | ||
env: | ||
CI: true |
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
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
52 changes: 15 additions & 37 deletions
52
packages/feflow-cli/__tests__/core/plugin/compose.test.ts
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,63 +1,41 @@ | ||
import chai from 'chai'; | ||
import compose from '../../../src/core/plugin/compose'; | ||
const should = chai.should(); | ||
import chai from 'chai'; | ||
const expect = chai.expect; | ||
|
||
describe('@feflow/core - Plugin compose', () => { | ||
it('Composes from right to left', () => { | ||
const double = (x: number) => x * 2; | ||
const square = (x: number) => x * x; | ||
|
||
compose(square)(5).should.eql(25); | ||
expect(compose(square)(5)).to.be.eql(25); | ||
|
||
compose( | ||
square, | ||
double | ||
)(5).should.eql(100); | ||
expect(compose(square, double)(5)).to.eql(100); | ||
|
||
compose( | ||
double, | ||
square, | ||
double | ||
)(5).should.eql(200); | ||
expect(compose(double, square, double)(5)).to.be.eql(200); | ||
}); | ||
|
||
it('Composes functions from right to left', () => { | ||
const a = (next: any) => (x: string) => next(x + 'a'); | ||
const b = (next: any) => (x: string) => next(x + 'b'); | ||
const c = (next: any) => (x: string) => next(x + 'c'); | ||
const final = (x: any) => x; | ||
compose( | ||
a, | ||
b, | ||
c | ||
)(final)('').should.eql('abc'); | ||
|
||
compose( | ||
b, | ||
c, | ||
a | ||
)(final)('').should.eql('bca'); | ||
|
||
compose( | ||
c, | ||
a, | ||
b | ||
)(final)('').should.eql('cab'); | ||
expect(compose(a, b, c)(final)('')).to.be.eql('abc'); | ||
|
||
expect(compose(b, c, a)(final)('')).to.be.eql('bca'); | ||
|
||
expect(compose(c, a, b)(final)('')).to.be.eql('cab'); | ||
}); | ||
|
||
it('Can be seeded with multiple arguments', () => { | ||
const square = (x: number) => x * x | ||
const add = (x: number, y: number) => x + y | ||
const square = (x: number) => x * x; | ||
const add = (x: number, y: number) => x + y; | ||
|
||
compose( | ||
square, | ||
add | ||
)(1, 2).should.eql(9); | ||
expect(compose(square, add)(1, 2)).to.be.eql(9); | ||
}); | ||
|
||
it('Returns the first function if given only one', () => { | ||
const fn = () => {}; | ||
|
||
compose(fn).should.eql(fn); | ||
expect(compose(fn)).to.be.eql(fn); | ||
}); | ||
}); | ||
}); |
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