From 8624cbed60ecaaae1c00ca023216b596d83b6312 Mon Sep 17 00:00:00 2001 From: uiolee <22849383+uiolee@users.noreply.github.com> Date: Fri, 2 Feb 2024 22:29:37 +0800 Subject: [PATCH] ci: add job `build` && imporve workflow --- .github/workflows/ci.yml | 90 ++++++++++++++++++++++++++++++++++++ .github/workflows/linter.yml | 34 -------------- .github/workflows/tester.yml | 46 ------------------ 3 files changed, 90 insertions(+), 80 deletions(-) create mode 100644 .github/workflows/ci.yml delete mode 100644 .github/workflows/linter.yml delete mode 100644 .github/workflows/tester.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..7724e92 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,90 @@ +name: CI + +on: + push: + branches: + - "master" + pull_request: + +env: + default_node_version: 14 + +jobs: + test: + name: Test + needs: build + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + node-version: ["14", "16", "18"] + fail-fast: false + steps: + - uses: actions/checkout@v4 + - name: Setup Node.js ${{ matrix.node-version }} and Cache + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: npm + cache-dependency-path: "package.json" + + - name: Install Dependencies + run: npm install + - name: Test + run: npm run test + + coverage: + name: Coverage + needs: build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Setup Node.js ${{env.default_node_version}} and Cache + uses: actions/setup-node@v4 + with: + node-version: ${{env.default_node_version}} + cache: npm + cache-dependency-path: "package.json" + + - name: Install Dependencies + run: npm install + - name: Coverage + run: npm run test-cov + - name: Coveralls + uses: coverallsapp/github-action@v2 + with: + github-token: ${{ secrets.github_token }} + + build: + name: Build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Setup Node.js ${{env.default_node_version}} and Cache + uses: actions/setup-node@v4 + with: + node-version: ${{env.default_node_version}} + cache: npm + cache-dependency-path: "package.json" + + - name: Install Dependencies + run: npm install + - name: Build + run: npm run build + + lint: + name: Lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Setup Node.js ${{env.default_node_version}} and Cache + uses: actions/setup-node@v4 + with: + node-version: ${{env.default_node_version}} + cache: npm + cache-dependency-path: "package.json" + + - name: Install Dependencies + run: npm install + - name: Lint + run: npm run eslint diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml deleted file mode 100644 index 4fd522b..0000000 --- a/.github/workflows/linter.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: Linter - -on: - push: - branches: - - "master" - paths: - - "lib/**" - - "test/**" - - ".github/workflows/linter.yml" - pull_request: - paths: - - "lib/**" - - "test/**" - - ".github/workflows/linter.yml" - -permissions: - contents: read - -jobs: - linter: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - with: - node-version: "14.x" - - name: Install Dependencies - run: npm install - - name: Lint - run: | - npm run eslint - env: - CI: true diff --git a/.github/workflows/tester.yml b/.github/workflows/tester.yml deleted file mode 100644 index 9947107..0000000 --- a/.github/workflows/tester.yml +++ /dev/null @@ -1,46 +0,0 @@ -name: Tester - -on: [push, pull_request] - -jobs: - tester: - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ubuntu-latest, windows-latest, macos-latest] - node-version: ['14.x', '16.x', '18.x'] - fail-fast: false - steps: - - uses: actions/checkout@v4 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v4 - with: - node-version: ${{ matrix.node-version }} - - name: Install Dependencies - run: npm install - - name: Test - run: npm test -- --no-parallel - env: - CI: true - coverage: - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ubuntu-latest] - node-version: ['14.x'] - steps: - - uses: actions/checkout@v4 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v4 - with: - node-version: ${{ matrix.node-version }} - - name: Install Dependencies - run: npm install - - name: Coverage - run: npm run test-cov - env: - CI: true - - name: Coveralls - uses: coverallsapp/github-action@master - with: - github-token: ${{ secrets.github_token }} \ No newline at end of file