From 4c15652154b608102bae65165dfa151f91569151 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Sun, 23 Apr 2023 00:04:25 +0200 Subject: [PATCH] build(ci): enable dependencies caching with pnpm MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- .github/workflows/ci.yml | 21 ++++++++------ .github/workflows/generate-documentation.yml | 10 +++++-- .github/workflows/npmpublish.yml | 30 ++++++++++++-------- 3 files changed, 37 insertions(+), 24 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7854d04d..72782830 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,29 +28,32 @@ jobs: with: fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis. This is needed for better sonar + - name: Setup pnpm + uses: pnpm/action-setup@v2 + with: + version: 8 + - name: Setup node ${{ matrix.node }} uses: actions/setup-node@v3 with: node-version: ${{ matrix.node }} + cache: 'pnpm' - name: Install - run: | - corepack enable - corepack prepare pnpm@latest --activate - pnpm install + run: pnpm install - name: Build - run: pnpm run build + run: pnpm build - name: Lint - run: pnpm run lint + run: pnpm lint - name: Tests - run: pnpm run test + run: pnpm test - name: Coverage Report if: "github.repository == 'poolifier/poolifier' && matrix.os == 'ubuntu-latest' && matrix.node == '18.x'" - run: pnpm run coverage + run: pnpm coverage - name: Sonar Code Analysis if: "github.repository == 'poolifier/poolifier' && matrix.os == 'ubuntu-latest' && matrix.node == '18.x'" @@ -61,4 +64,4 @@ jobs: - name: Benchmark if: github.event.inputs.withBenchmark - run: pnpm run benchmark + run: pnpm benchmark diff --git a/.github/workflows/generate-documentation.yml b/.github/workflows/generate-documentation.yml index 82553b24..2ba7833e 100644 --- a/.github/workflows/generate-documentation.yml +++ b/.github/workflows/generate-documentation.yml @@ -11,17 +11,21 @@ jobs: - name: Checkout uses: actions/checkout@v3 + - name: Setup pnpm + uses: pnpm/action-setup@v2 + with: + version: 8 + - name: Setup node uses: actions/setup-node@v3 with: node-version: '18.x' + cache: 'pnpm' - name: Generate documentation run: | - corepack enable - corepack prepare pnpm@latest --activate pnpm install - pnpm run typedoc + pnpm typedoc - name: Commit files if: "github.repository == 'poolifier/poolifier' && github.ref == 'refs/heads/${{ github.event.repository.default_branch }}'" diff --git a/.github/workflows/npmpublish.yml b/.github/workflows/npmpublish.yml index d124eed3..17eb40ed 100644 --- a/.github/workflows/npmpublish.yml +++ b/.github/workflows/npmpublish.yml @@ -12,27 +12,30 @@ jobs: - name: Checkout uses: actions/checkout@v3 + - name: Setup pnpm + uses: pnpm/action-setup@v2 + with: + version: 8 + - name: Setup Node uses: actions/setup-node@v3 with: node-version: '18.x' + cache: 'pnpm' - name: Install - run: | - corepack enable - corepack prepare pnpm@latest --activate - pnpm install + run: pnpm install - name: Tests & Coverage run: | - pnpm run test - pnpm run coverage + pnpm test + pnpm coverage - name: Lint - run: pnpm run lint + run: pnpm lint - name: Production Build - run: pnpm run build:prod + run: pnpm build:prod publish: needs: build @@ -42,21 +45,24 @@ jobs: - name: Checkout uses: actions/checkout@v3 + - name: Setup pnpm + uses: pnpm/action-setup@v2 + with: + version: 8 + - name: Setup Node uses: actions/setup-node@v3 with: node-version: '18.x' registry-url: https://registry.npmjs.org/ + cache: 'pnpm' - name: Read package.json version id: package-version uses: jaywcjlove/github-action-package@main - name: Install - run: | - corepack enable - corepack prepare pnpm@latest --activate - pnpm install + run: pnpm install - name: Publish Release if: ${{ contains(steps.package-version.outputs.version, '-') == false }} -- 2.34.1