Skip to content

Commit

Permalink
chore(github-actions): update cache keys
Browse files Browse the repository at this point in the history
  • Loading branch information
awinogrodzki committed Jun 5, 2024
1 parent 5ef7434 commit 86cdd0a
Show file tree
Hide file tree
Showing 6 changed files with 791 additions and 358 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ jobs:
with:
path: |
node_modules
key: ${{ runner.os }}-node_modules-cache-v1-${{ hashFiles('./yarn.lock') }}-${{github.sha}}
key: ${{ runner.os }}-node_modules-cache-v2-${{ hashFiles('./yarn.lock') }}-${{github.sha}}
restore-keys: |
${{ runner.os }}-node_modules-cache-v1-${{ hashFiles('./yarn.lock') }}-
${{ runner.os }}-node_modules-cache-v2-${{ hashFiles('./yarn.lock') }}-
- run: yarn install

build:
Expand All @@ -59,15 +59,15 @@ jobs:
with:
path: |
node_modules
key: ${{ runner.os }}-node_modules-cache-v1-${{ hashFiles('./yarn.lock') }}-${{github.sha}}
key: ${{ runner.os }}-node_modules-cache-v2-${{ hashFiles('./yarn.lock') }}-${{github.sha}}
- name: Cache build
uses: actions/cache@v3
with:
path: |
lib
key: ${{ runner.os }}-build-cache-v1-${{ github.ref_name }}-${{github.sha}}
key: ${{ runner.os }}-build-cache-v2-${{ github.ref_name }}-${{github.sha}}
restore-keys: |
${{ runner.os }}-build-cache-v1-${{ github.ref_name }}-
${{ runner.os }}-build-cache-v2-${{ github.ref_name }}-
- run: yarn build

lint:
Expand All @@ -86,7 +86,7 @@ jobs:
with:
path: |
node_modules
key: ${{ runner.os }}-node_modules-cache-v1-${{ hashFiles('./yarn.lock') }}-${{github.sha}}
key: ${{ runner.os }}-node_modules-cache-v2-${{ hashFiles('./yarn.lock') }}-${{github.sha}}
- run: yarn lint

tests:
Expand All @@ -105,11 +105,11 @@ jobs:
with:
path: |
node_modules
key: ${{ runner.os }}-node_modules-cache-v1-${{ hashFiles('./yarn.lock') }}-${{github.sha}}
key: ${{ runner.os }}-node_modules-cache-v2-${{ hashFiles('./yarn.lock') }}-${{github.sha}}
- name: Cache build
uses: actions/cache@v3
with:
path: |
lib
key: ${{ runner.os }}-build-cache-v1-${{ github.ref_name }}-${{github.sha}}
key: ${{ runner.os }}-build-cache-v2-${{ github.ref_name }}-${{github.sha}}
- run: yarn test
16 changes: 8 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ jobs:
with:
path: |
node_modules
key: ${{ runner.os }}-node_modules-cache-v1-${{ hashFiles('./yarn.lock') }}-${{github.sha}}
key: ${{ runner.os }}-node_modules-cache-v2-${{ hashFiles('./yarn.lock') }}-${{github.sha}}
restore-keys: |
${{ runner.os }}-node_modules-cache-v1-${{ hashFiles('./yarn.lock') }}-
${{ runner.os }}-node_modules-cache-v2-${{ hashFiles('./yarn.lock') }}-
- run: yarn install

build:
Expand All @@ -61,15 +61,15 @@ jobs:
with:
path: |
node_modules
key: ${{ runner.os }}-node_modules-cache-v1-${{ hashFiles('./yarn.lock') }}-${{github.sha}}
key: ${{ runner.os }}-node_modules-cache-v2-${{ hashFiles('./yarn.lock') }}-${{github.sha}}
- name: Cache build
uses: actions/cache@v3
with:
path: |
lib
key: ${{ runner.os }}-build-cache-v1-${{ github.ref_name }}-${{github.sha}}
key: ${{ runner.os }}-build-cache-v2-${{ github.ref_name }}-${{github.sha}}
restore-keys: |
${{ runner.os }}-build-cache-v1-${{ github.ref_name }}-
${{ runner.os }}-build-cache-v2-${{ github.ref_name }}-
- run: yarn build

semantic-release:
Expand All @@ -93,15 +93,15 @@ jobs:
with:
path: |
node_modules
key: ${{ runner.os }}-node_modules-cache-v1-${{ hashFiles('./yarn.lock') }}-${{github.sha}}
key: ${{ runner.os }}-node_modules-cache-v2-${{ hashFiles('./yarn.lock') }}-${{github.sha}}
- name: Cache build
uses: actions/cache@v3
with:
path: |
lib
key: ${{ runner.os }}-build-cache-v1-${{ github.ref_name }}-${{github.sha}}
key: ${{ runner.os }}-build-cache-v2-${{ github.ref_name }}-${{github.sha}}
restore-keys: |
${{ runner.os }}-build-cache-v1-${{ github.ref_name }}-
${{ runner.os }}-build-cache-v2-${{ github.ref_name }}-
- name: Semantic Release
uses: cycjimmy/semantic-release-action@v4
Expand Down
2 changes: 1 addition & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module.exports = {
'^.+\\.tsx?$': [
'ts-jest',
{
tsconfig: 'tsconfig.test.json',
tsconfig: 'tsconfig.json',
},
],
'^.+\\.jsx?$': 'babel-jest',
Expand Down
10 changes: 10 additions & 0 deletions jest.setup.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,12 @@
import "isomorphic-fetch";
import "dotenv/config";

declare module 'next/server' {
export interface NextRequest {
headers: Headers;
}

export interface NextResponse {
headers: Headers;
}
}
7 changes: 3 additions & 4 deletions src/next/cookies.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import {NextRequest, NextResponse} from 'next/server';
import {SetAuthCookiesOptions, refreshCredentials} from './cookies';

jest.mock('../auth', () => ({
Expand All @@ -23,7 +22,7 @@ const MOCK_REQUEST = {
headers: {
get: jest.fn()
}
} as unknown as jest.Mocked<NextRequest>;
} as unknown as jest.Mocked<any>;

const MOCK_OPTIONS: SetAuthCookiesOptions = {
cookieName: 'TestCookie',
Expand All @@ -42,7 +41,7 @@ describe('cookies', () => {
headers: {
append: jest.fn()
}
} as unknown as jest.Mocked<NextResponse> & jest.Mocked<Response>;
} as unknown as jest.Mocked<any> & jest.Mocked<Response>;
const result = await refreshCredentials(
MOCK_REQUEST,
MOCK_OPTIONS,
Expand All @@ -67,7 +66,7 @@ describe('cookies', () => {
headers: {
append: jest.fn()
}
} as unknown as jest.Mocked<NextResponse> & jest.Mocked<Response>;
} as unknown as jest.Mocked<any> & jest.Mocked<Response>;
const result = await refreshCredentials(MOCK_REQUEST, MOCK_OPTIONS, () =>
Promise.resolve(MOCK_RESPONSE)
);
Expand Down
Loading

0 comments on commit 86cdd0a

Please sign in to comment.