From 2e656cdb157b7206c9e39e8ba4f7c61da67493bc Mon Sep 17 00:00:00 2001 From: garronej Date: Fri, 21 May 2021 08:15:50 +0200 Subject: [PATCH] Use caching for installing dependencies --- .github/workflows/ci.yaml | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 96a7c1c..2278a7f 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -15,21 +15,15 @@ jobs: steps: - uses: actions/checkout@v2.3.4 - uses: actions/setup-node@v2.1.3 - - name: Making sure 'npm run lint' and 'npm run format' does not changes anything. + - uses: bahmutov/npm-install@v1 + - name: If this step fails run 'npm run lint' and 'npm run format' then commit again. run: | PACKAGE_MANAGER=npm if [ -f "./yarn.lock" ]; then PACKAGE_MANAGER=yarn fi - - if [ "$PACKAGE_MANAGER" = "yarn" ]; then - yarn install --frozen-lockfile - else - npm ci - fi $PACKAGE_MANAGER run lint:check $PACKAGE_MANAGER run format:check - test: runs-on: ${{ matrix.os }} needs: test_lint @@ -48,17 +42,15 @@ jobs: - uses: actions/setup-node@v2.1.3 with: node-version: ${{ matrix.node }} + - uses: bahmutov/npm-install@v1 - if: steps.step1.outputs.npm_or_yarn == 'yarn' run: | - yarn install --frozen-lockfile yarn build yarn test - if: steps.step1.outputs.npm_or_yarn == 'npm' run: | - npm ci npm run build npm test - check_if_version_upgraded: name: Check if version upgrade if: github.event_name == 'push' @@ -129,16 +121,12 @@ jobs: with: node-version: '15' registry-url: https://registry.npmjs.org/ + - uses: bahmutov/npm-install@v1 - run: | PACKAGE_MANAGER=npm if [ -f "./yarn.lock" ]; then PACKAGE_MANAGER=yarn fi - if [ "$PACKAGE_MANAGER" = "yarn" ]; then - yarn install --frozen-lockfile - else - npm ci - fi $PACKAGE_MANAGER run build - run: npx -y -p denoify@0.6.5 denoify_enable_short_npm_import_path env: @@ -156,4 +144,4 @@ jobs: npm publish env: NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} - VERSION: ${{ needs.check_if_version_upgraded.outputs.to_version }} + VERSION: ${{ needs.check_if_version_upgraded.outputs.to_version }} \ No newline at end of file