From 086614565e3701a022bc55f77e41b2f52d62c753 Mon Sep 17 00:00:00 2001 From: mpsc0x Date: Fri, 28 Feb 2025 11:30:04 +0200 Subject: [PATCH] fix: fixed workflows --- .github/workflows/gen-deploy-docs.yml | 12 ++++++++---- .github/workflows/node.js.yml | 26 +++++++++++++++++--------- .github/workflows/npm-publish-dev.yml | 22 ---------------------- .github/workflows/test-example.yml | 15 +++++++++------ .github/workflows/unit-test.yml | 24 +++++++++++++++--------- 5 files changed, 49 insertions(+), 50 deletions(-) delete mode 100644 .github/workflows/npm-publish-dev.yml diff --git a/.github/workflows/gen-deploy-docs.yml b/.github/workflows/gen-deploy-docs.yml index a8631f2..1151976 100644 --- a/.github/workflows/gen-deploy-docs.yml +++ b/.github/workflows/gen-deploy-docs.yml @@ -3,7 +3,7 @@ name: Deploy documentation on: push: branches: - - main + - fixes/evgeni/various workflow_dispatch: jobs: @@ -15,12 +15,16 @@ jobs: - uses: actions/setup-node@v3 with: node-version: 18 + cache: "pnpm" + + - name: Install PNPM + run: pnpm install -g pnpm - name: Install dependencies - run: npm ci + run: pnpm install --frozen-lockfile - name: Generate documentation - run: npm run doc + run: pnpm run doc - name: Deploy documentation - run: npm run deploy-docs + run: pnpm run deploy-docs diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index 7947732..e9e084a 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -1,6 +1,3 @@ -# This workflow will do a clean installation of node dependencies, cache/restore them, 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: @@ -14,16 +11,27 @@ jobs: strategy: matrix: node-version: [16.x, 18.x] - # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ steps: - uses: actions/checkout@v3 + - name: Use Node.js ${{ matrix.node-version }} uses: actions/setup-node@v3 with: node-version: ${{ matrix.node-version }} - cache: "npm" - - run: npm ci - - run: npm run build - - run: npm run fmt:check - - run: npm test + cache: "pnpm" + + - name: Enable PNPM with Corepack + run: corepack enable && corepack prepare pnpm@latest --activate + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Build project + run: pnpm run build + + - name: Check formatting + run: pnpm run fmt:check + + - name: Run tests + run: pnpm test diff --git a/.github/workflows/npm-publish-dev.yml b/.github/workflows/npm-publish-dev.yml deleted file mode 100644 index 4b891cb..0000000 --- a/.github/workflows/npm-publish-dev.yml +++ /dev/null @@ -1,22 +0,0 @@ -name: Npm nightly publish - -on: - push: - branches: [main, buildnet] - -jobs: - test: - uses: ./.github/workflows/node.js.yml - - publish-npm-dev: - needs: test - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: 18 - registry-url: https://registry.npmjs.org - - run: ./scripts/publish-dev.sh - env: - NODE_AUTH_TOKEN: ${{ secrets.npm_token }} \ No newline at end of file diff --git a/.github/workflows/test-example.yml b/.github/workflows/test-example.yml index f9fa338..7750184 100644 --- a/.github/workflows/test-example.yml +++ b/.github/workflows/test-example.yml @@ -17,23 +17,26 @@ jobs: - name: Checkout code uses: actions/checkout@v3 - - name: Install node + - name: Install PNPM + run: npm install -g pnpm + + - name: Install Node.js uses: actions/setup-node@v3 with: node-version: "18" - cache: "npm" - cache-dependency-path: ./package-lock.json + cache: "pnpm" + cache-dependency-path: ./pnpm-lock.yaml - name: Install dependencies - run: npm install + run: pnpm install --frozen-lockfile - name: Build - run: npm run build + run: pnpm run build - name: Deploy run: | echo ${{ secrets.JSON_RPC_URL_PUBLIC }} - if npm run test-borrow-example ; then + if pnpm run test-borrow-example ; then echo "Borrow example passed!" else echo "Failed to run borrow example ..." diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index 07ba04d..007cc93 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -22,18 +22,24 @@ jobs: # Checkout code using bot account token: ${{ github.token }} + - name: Install PNPM + run: npm install -g pnpm + - name: Use Node.js uses: actions/setup-node@v3 with: node-version: 18.x - cache: 'npm' + cache: "pnpm" + cache-dependency-path: ./pnpm-lock.yaml + + - name: Install dependencies + run: pnpm install --frozen-lockfile - name: Execute unit tests run: | - npm ci - npm run build - npm run fmt:check - npm run test + pnpm run build + pnpm run fmt:check + pnpm run test - name: allow access to coverage.sh run: chmod +x ./scripts/coverage.sh @@ -42,12 +48,12 @@ jobs: - name: Extract coverage id: coverage run: | - value=$(npm run test:cov | awk '/All files/ {print $10}' | tr -d '%') + value=$(pnpm run test:cov | awk '/All files/ {print $10}' | tr -d '%') echo "coverage=$value" >> $GITHUB_OUTPUT - name: Add test coverage to README - run: ./scripts/coverage.sh - shell: bash + run: ./scripts/coverage.sh + shell: bash env: COVERAGE: ${{ steps.coverage.outputs.coverage }} @@ -62,4 +68,4 @@ jobs: with: commit_message: "Generate coverage badge" file_pattern: "README.md" - commit_author: Aaave \ No newline at end of file + commit_author: Aave