From 8d60a34318008bb4690b9d85024fb16cce532832 Mon Sep 17 00:00:00 2001 From: afc163 Date: Fri, 16 Aug 2024 22:38:43 +0800 Subject: [PATCH 1/2] Update main.yml --- .github/workflows/main.yml | 70 ++++++-------------------------------- 1 file changed, 10 insertions(+), 60 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index eb9fdd4..f0d4f52 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,68 +1,18 @@ name: CI -on: - push: - branches: [master] - pull_request: - branches: [master] +on: ['push', 'pull_request'] jobs: setup: runs-on: ubuntu-latest steps: - - name: checkout - uses: actions/checkout@master - - - uses: actions/setup-node@v1 - with: - node-version: '12' - - - name: cache package-lock.json - uses: actions/cache@v2 + - uses: actions/checkout@v4 + - uses: oven-sh/setup-bun@v2 + - run: bun i + - run: bun run lint + - run: bunx tsc --noEmit + - run: bun run compile + - run: npm test -- --coverage + - uses: codecov/codecov-action@v4 with: - path: package-temp-dir - key: lock-${{ github.sha }} - - - name: create package-lock.json - run: npm i --package-lock-only - - - name: hack for singe file - run: | - if [ ! -d "package-temp-dir" ]; then - mkdir package-temp-dir - fi - cp package-lock.json package-temp-dir - - - name: cache node_modules - id: node_modules_cache_id - uses: actions/cache@v2 - with: - path: node_modules - key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }} - - - name: install - if: steps.node_modules_cache_id.outputs.cache-hit != 'true' - run: npm ci - - test: - runs-on: ubuntu-latest - steps: - - name: checkout - uses: actions/checkout@master - - - name: restore cache from package-lock.json - uses: actions/cache@v2 - with: - path: package-temp-dir - key: lock-${{ github.sha }} - - - name: restore cache from node_modules - uses: actions/cache@v2 - with: - path: node_modules - key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }} - - - name: test - run: npm test - - needs: setup + token: ${{ secrets.CODECOV_TOKEN }} From 26fc462ac434b5f080b9f0219c8ee1402b12c1a9 Mon Sep 17 00:00:00 2001 From: afc163 Date: Fri, 16 Aug 2024 22:39:54 +0800 Subject: [PATCH 2/2] Update package.json --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index a48ac04..99b9a6c 100644 --- a/package.json +++ b/package.json @@ -33,6 +33,7 @@ "compile": "father build", "prepublishOnly": "npm run compile && np --no-cleanup --yolo --no-publish", "test": "npm run compile && npm run test:only", + "lint": "eslint src", "test:only": "node ./bin/rc-test.js" }, "dependencies": {