diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml new file mode 100644 index 0000000..ef9a6ef --- /dev/null +++ b/.github/workflows/nodejs.yml @@ -0,0 +1,46 @@ +# 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: Node.js CI + +on: + push: + branches: + - main + - master + pull_request: + branches: + - main + - master + schedule: + - cron: '0 2 * * *' + +jobs: + build: + runs-on: ${{ matrix.os }} + + strategy: + fail-fast: false + matrix: + node-version: [16.x] + os: [ubuntu-latest] + + steps: + - name: Checkout Git Source + uses: actions/checkout@v2 + + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + + - name: Install Dependencies + run: npm i -g npminstall && npminstall + + - name: Continuous Integration + run: npm run ci + + - name: Code Coverage + uses: codecov/codecov-action@v1 + with: + token: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..ce6a397 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,37 @@ +name: Actions Release + +on: + push: + branches: [ master ] + +jobs: + build: + runs-on: ${{ matrix.os }} + + strategy: + fail-fast: false + matrix: + node-version: [16.x] + os: [ubuntu-latest] + + steps: + - name: Checkout Git Source + uses: actions/checkout@v2 + + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + + - name: Install Dependencies + run: npm i -g npminstall && npminstall + + - name: Continuous integration + run: | + run: npm run ci + + - name: Semantic Release + run: | + npm run semantic-release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/README.md b/README.md index 2950304..6ca668f 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# react-cnode +# React-CNode.js -CNode 社区 React 版本 +> Frontend Powered By React For CNode.js ## Getting Started @@ -13,5 +13,5 @@ $ yarn Start the dev server, ```bash -$ yarn start +$ yarn dev ``` diff --git a/package.json b/package.json index 20d79f7..7ce8a94 100644 --- a/package.json +++ b/package.json @@ -1,12 +1,18 @@ { - "private": true, + "name": "react-cnode", + "description": "Frontend Powered By React For CNode.js", + "version": "development", + "private": false, + "license": "MIT", "scripts": { "dev": "umi dev", "build": "umi build", "postinstall": "umi generate tmp", "prettier": "prettier --write '**/*.{js,jsx,tsx,ts,less,md,json}'", + "ci": "npm run test", "test": "umi-test", - "test:coverage": "umi-test --coverage" + "test:coverage": "umi-test --coverage", + "semantic-release": "semantic-release" }, "gitHooks": { "pre-commit": "lint-staged" @@ -19,6 +25,37 @@ "prettier --parser=typescript --write" ] }, + "ci": { + "type": "github", + "os": { + "github": "linux" + }, + "version": "16.x" + }, + "release": { + "branche": "master", + "tagFormat": "${version}", + "plugins": [ + "@semantic-release/commit-analyzer", + "@semantic-release/release-notes-generator", + [ + "@semantic-release/changelog", + { + "changelogFile": "History.md" + } + ], + [ + "@semantic-release/github", + { + "assets": { + "path": "dist", + "label": "Assets Distribution" + }, + "addReleases": "bottom" + } + ] + ] + }, "dependencies": { "dotenv": "^10.0.0", "react": "17.x", @@ -30,7 +67,9 @@ "@ant-design/pro-layout": "^6.32.1", "@ant-design/pro-list": "^1.21.12", "@ant-design/pro-table": "^2.61.9", + "@semantic-release/changelog": "^6.0.1", "@types/dotenv": "^8.2.0", + "@types/jest": "^27.4.0", "@types/markdown-it": "^12.2.3", "@types/react": "^17.0.0", "@types/react-dom": "^17.0.0", @@ -40,12 +79,14 @@ "@umijs/test": "^3.5.20", "ahooks": "^3.1.3", "dayjs": "^1.10.7", + "egg-ci": "^1.19.0", "lint-staged": "^10.0.7", "markdown-it": "^12.3.0", "prettier": "^2.2.0", "react-markdown-editor-lite": "^1.3.2", + "semantic-release": "^18.0.1", "typescript": "^4.1.2", "umi": "^3.5.20", "yorkie": "^2.0.0" } -} \ No newline at end of file +} diff --git a/tests/util.test.ts b/tests/util.test.ts new file mode 100644 index 0000000..ad84135 --- /dev/null +++ b/tests/util.test.ts @@ -0,0 +1,5 @@ +describe('util.test.ts', () => { + it('demo', () => { + expect(10).toEqual(10); + }); +});