From 6d7c0c37f43a807ef684ed20a925fd9c6ebf8553 Mon Sep 17 00:00:00 2001 From: Seth Date: Wed, 25 Oct 2023 18:06:09 +0800 Subject: [PATCH 1/3] ci: add gha --- .github/workflows/linters.yml | 28 ++++++++++++++++++++ .github/workflows/pull_requests.yml | 29 ++++++++++++++++++++ .github/workflows/release.yml | 41 +++++++++++++++++++++++++++++ .github/workflows/tests.yml | 30 +++++++++++++++++++++ 4 files changed, 128 insertions(+) create mode 100644 .github/workflows/linters.yml create mode 100644 .github/workflows/pull_requests.yml create mode 100644 .github/workflows/release.yml create mode 100644 .github/workflows/tests.yml diff --git a/.github/workflows/linters.yml b/.github/workflows/linters.yml new file mode 100644 index 0000000..e37c090 --- /dev/null +++ b/.github/workflows/linters.yml @@ -0,0 +1,28 @@ +on: + workflow_call: + +env: + NODE_ENV: ci + +name: "Linters" + +jobs: + lint: + name: Code Lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 14.x + - run: npm ci --ignore-scripts + - run: npm run lint + + commit-lint: + name: Commit Lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Install Commit Lint Dependencies + run: npm install @commitlint/config-conventional + - uses: JulienKode/pull-request-name-linter-action@v0.5.0 diff --git a/.github/workflows/pull_requests.yml b/.github/workflows/pull_requests.yml new file mode 100644 index 0000000..de9e0d3 --- /dev/null +++ b/.github/workflows/pull_requests.yml @@ -0,0 +1,29 @@ +on: + pull_request: + types: [ opened, reopened, synchronize ] + +env: + NODE_ENV: ci + +name: "Pull Requests" + +jobs: + tests: + name: Tests + uses: ./.github/workflows/tests.yml + + linters: + name: Linters + uses: ./.github/workflows/linters.yml + + eslint-review: + name: ESLint Review + runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: write + steps: + - uses: actions/checkout@v3 + - uses: reviewdog/action-eslint@v1 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..dc20b4d --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,41 @@ +on: + push: + branches: + - master + - beta + - +([0-9])?(.{+([0-9]),x}).x + +env: + NODE_ENV: ci + +name: Release + +jobs: + tests: + name: Tests + uses: ./.github/workflows/tests.yml + + linters: + name: Linters + uses: ./.github/workflows/linters.yml + + release: + name: Publish Release + runs-on: ubuntu-latest + needs: [ tests, linters ] + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 14.x + - run: npm ci + - run: npm run build + - uses: codfish/semantic-release-action@v2 + id: semantic + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + - name: Output new release version + if: steps.semantic.outputs.new-release-published == 'true' + run: | + echo "🎉New Release Published: ${{ steps.semantic.outputs.release-version }}" diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..a6093a2 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,30 @@ +on: + workflow_call: + +env: + NODE_ENV: ci + +name: "Tests" + +jobs: + run-tests: + name: Run Tests + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 14.x + - run: npm ci + - run: npm run test -- --runInBand + + test-build: + name: Test Build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 14.x + - run: npm ci + - run: npm run build From 6e18b28936cae4b1b236a2057ecd619f9a63cc5c Mon Sep 17 00:00:00 2001 From: Seth Date: Wed, 25 Oct 2023 18:06:24 +0800 Subject: [PATCH 2/3] ci: remove circleci --- .circleci/config.yml | 32 -------------------------------- 1 file changed, 32 deletions(-) delete mode 100644 .circleci/config.yml diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 7dd13cc..0000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,32 +0,0 @@ -version: 2.1 - -workflows: - build-workflow: - jobs: - - build: - context: - - deployment -jobs: - build: - docker: - - image: 'circleci/node:latest' - steps: - - checkout - - run: - name: install - command: npm install - - run: - name: commitlint - command: npx --no-install commitlint-circle - - run: - name: lint - command: npm run lint - - run: - name: test - command: npm run test - - run: - name: build - command: npm run build - - run: - name: release - command: npm run semantic-release From f15c6ba6534372521a2d2b1def442ba9ed0a080c Mon Sep 17 00:00:00 2001 From: Seth Date: Wed, 25 Oct 2023 18:16:40 +0800 Subject: [PATCH 3/3] ci: add pr tpl --- .github/pull_request_template.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 .github/pull_request_template.md diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 0000000..33ccc7b --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,12 @@ +## Summary + +What is the background of this pull request? + +## Changes + +- What are the changes made in this pull request? +- Change this and that, etc... + +## Issues + +What are the related issues or stories?