Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: cached dist files on Github Actions #201

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
id: cacheModules
uses: actions/cache@v4
with:
path: ~/.npm # this is cache where npm installs from before going out to the network
path: ~/.npm # this is the cache where npm installs from before going out to the network
key: ${{ runner.os }}-node-${{ hashFiles('**/package.json') }}
- name: Install dependencies
if: steps.cacheModules.outputs.cache-hit != 'true'
Expand Down
40 changes: 32 additions & 8 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,16 @@ jobs:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}
- uses: actions/cache@v4
- name: Restore ~/.npm/ cache
uses: actions/cache@v4
with:
path: ~/.npm # this is cache where npm installs from before going out to the network
path: ~/.npm # this is the cache where npm installs from before going out to the network
key: ${{ runner.os }}-node-${{ hashFiles('**/package.json') }}
- name: Restore dist/ cache
uses: actions/cache@v4
with:
path: ./dist
key: ${{ runner.os }}-node-${{ hashFiles('package.json', 'rollup.config.js', 'src/*.js') }}
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
Expand All @@ -40,10 +46,16 @@ jobs:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}
- uses: actions/cache@v4
- name: Restore ~/.npm/ cache
uses: actions/cache@v4
with:
path: ~/.npm # this is cache where npm installs from before going out to the network
path: ~/.npm # this is the cache where npm installs from before going out to the network
key: ${{ runner.os }}-node-${{ hashFiles('**/package.json') }}
- name: Restore dist/ cache
uses: actions/cache@v4
with:
path: ./dist
key: ${{ runner.os }}-node-${{ hashFiles('package.json', 'rollup.config.js', 'src/*.js') }}
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
Expand All @@ -58,10 +70,16 @@ jobs:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}
- uses: actions/cache@v4
- name: Restore ~/.npm/ cache
uses: actions/cache@v4
with:
path: ~/.npm # this is cache where npm installs from before going out to the network
path: ~/.npm # this is the cache where npm installs from before going out to the network
key: ${{ runner.os }}-node-${{ hashFiles('**/package.json') }}
- name: Restore dist/ cache
uses: actions/cache@v4
with:
path: ./dist
key: ${{ runner.os }}-node-${{ hashFiles('package.json', 'rollup.config.js', 'src/*.js') }}
- run: npm install --prefer-offline
- run: make lint

Expand All @@ -72,9 +90,15 @@ jobs:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}
- uses: actions/cache@v4
- name: Restore ~/.npm/ cache
uses: actions/cache@v4
with:
path: ~/.npm # this is cache where npm installs from before going out to the network
path: ~/.npm # this is the cache where npm installs from before going out to the network
key: ${{ runner.os }}-node-${{ hashFiles('**/package.json') }}
- name: Restore dist/ cache
uses: actions/cache@v4
with:
path: ./dist
key: ${{ runner.os }}-node-${{ hashFiles('package.json', 'rollup.config.js', 'src/*.js') }}
- run: npm install --prefer-offline
- run: make typecheck
22 changes: 20 additions & 2 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,33 @@ jobs:
id: cacheModules
uses: actions/cache@v4
with:
path: ~/.npm # this is cache where npm installs from before going out to the network
path: ~/.npm # this is the cache where npm installs from before going out to the network
key: ${{ runner.os }}-node-${{ hashFiles('**/package.json') }}
- name: Install dependencies
if: steps.cacheModules.outputs.cache-hit != 'true'
run: npm install

build:
name: Build
needs: [install]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Cache dist files
id: cacheDist
uses: actions/cache@v4
with:
path: ./dist
key: ${{ runner.os }}-node-${{ hashFiles('package.json', 'rollup.config.js', 'src/*.js') }}
- name: Install dependencies
if: steps.cacheDist.outputs.cache-hit != 'true'
run: make dist

checks:
name: Checks
needs: [install]
needs: [build]
uses: ./.github/workflows/checks.yml
with:
ref: ${{ github.event.pull_request.head.sha }}
Loading