From d57f6114387d0fda81841ae752c9024b7beed1da Mon Sep 17 00:00:00 2001 From: Marc Cataford Date: Wed, 22 Mar 2023 00:28:46 -0400 Subject: [PATCH 1/3] ci: add caching to CI --- .github/workflows/nodejs.yml | 48 ++++++++++++++++++++++++++++++++---- 1 file changed, 43 insertions(+), 5 deletions(-) diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index 7dddb3a..eb2be5e 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -6,16 +6,42 @@ on: branches: [master] jobs: + dependencies: + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [14, 16, 18] + + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + - uses: actions/cache@v3 + if: dependencies-cache + env: + cache-name: dependencies-cache + with: + path: .yarn + key: ${{ runner.os }}-build-${{env.cache-name}}-${{ hashFile('**/yarn.lock') }}-node-${{ matrix.node-version }} + - if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }} + run: yarn lint: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - name: Use Node.js 12.x - uses: actions/setup-node@v3 + - uses: actions/setup-node@v3 with: node-version: 18 - - run: yarn + - uses: actions/cache@v3 + if: dependencies-cache + env: + cache-name: dependencies-cache + with: + path: .yarn + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFile('**/yarn.lock') }}-node-18 - run: yarn lint test: runs-on: ubuntu-latest @@ -30,7 +56,13 @@ jobs: uses: actions/setup-node@v3 with: node-version: ${{ matrix.node-version }} - - run: yarn + - uses: actions/cache@v3 + if: dependencies-cache + env: + cache-name: dependencies-cache + with: + path: .yarn + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFile('**/yarn.lock') }}-node-${{ matrix.node-version }} - run: yarn test:coverage - name: Coverage uses: codecov/codecov-action@v1 @@ -50,5 +82,11 @@ jobs: uses: actions/setup-node@v3 with: node-version: ${{ matrix.node-version }} - - run: yarn --immutable + - uses: actions/cache@v3 + if: dependencies-cache + env: + cache-name: dependencies-cache + with: + path: .yarn + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFile('**/yarn.lock') }}-node-${{ matrix.node-version }} - run: yarn build -- 2.45.2 From 687da3259bad3ecb05bd7adeb74e917dbfbe8d79 Mon Sep 17 00:00:00 2001 From: Marc Cataford Date: Wed, 22 Mar 2023 00:30:22 -0400 Subject: [PATCH 2/3] ci: job dependencies --- .github/workflows/nodejs.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index eb2be5e..3c7dd6f 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -29,6 +29,7 @@ jobs: run: yarn lint: runs-on: ubuntu-latest + needs: dependencies steps: - uses: actions/checkout@v3 @@ -45,6 +46,7 @@ jobs: - run: yarn lint test: runs-on: ubuntu-latest + needs: dependencies strategy: matrix: @@ -72,6 +74,7 @@ jobs: build: runs-on: ubuntu-latest + needs: dependencies strategy: matrix: node-version: [14, 16, 18] -- 2.45.2 From a658d2a25caded74bd0db92c5fdb2e15432d60c1 Mon Sep 17 00:00:00 2001 From: Marc Cataford Date: Wed, 22 Mar 2023 00:32:31 -0400 Subject: [PATCH 3/3] ci: typo in ci func ci: typo in ci func ci: typo in ci func ci: typo in ci func ci: typo in ci func --- .github/workflows/nodejs.yml | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index 3c7dd6f..e543c21 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -19,14 +19,15 @@ jobs: with: node-version: ${{ matrix.node-version }} - uses: actions/cache@v3 - if: dependencies-cache + id: dependencies-cache env: cache-name: dependencies-cache with: path: .yarn - key: ${{ runner.os }}-build-${{env.cache-name}}-${{ hashFile('**/yarn.lock') }}-node-${{ matrix.node-version }} + key: ${{ runner.os }}-build-${{env.cache-name}}-${{ hashFiles('**/yarn.lock') }}-node-${{ matrix.node-version }} - if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }} run: yarn + lint: runs-on: ubuntu-latest needs: dependencies @@ -37,13 +38,15 @@ jobs: with: node-version: 18 - uses: actions/cache@v3 - if: dependencies-cache + id: dependencies-cache env: cache-name: dependencies-cache with: path: .yarn - key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFile('**/yarn.lock') }}-node-18 - - run: yarn lint + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }}-node-18 + - run: | + yarn + yarn lint test: runs-on: ubuntu-latest needs: dependencies @@ -59,13 +62,15 @@ jobs: with: node-version: ${{ matrix.node-version }} - uses: actions/cache@v3 - if: dependencies-cache + id: dependencies-cache env: cache-name: dependencies-cache with: path: .yarn - key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFile('**/yarn.lock') }}-node-${{ matrix.node-version }} - - run: yarn test:coverage + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }}-node-${{ matrix.node-version }} + - run: | + yarn + yarn test:coverage - name: Coverage uses: codecov/codecov-action@v1 with: @@ -86,10 +91,12 @@ jobs: with: node-version: ${{ matrix.node-version }} - uses: actions/cache@v3 - if: dependencies-cache + id: dependencies-cache env: cache-name: dependencies-cache with: path: .yarn - key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFile('**/yarn.lock') }}-node-${{ matrix.node-version }} - - run: yarn build + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }}-node-${{ matrix.node-version }} + - run: | + yarn + yarn build -- 2.45.2