Skip to content

ci(github-actions): ⚡ add caching of dependencies to improve test build times #343

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

Merged
merged 26 commits into from
Apr 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
387a13c
ci(github-actions): :zap: add cache action to improve test build times
ericapisani Apr 5, 2022
75431de
ci: use caching config within actions/setup-node
ericapisani Apr 5, 2022
b9d2790
test: add netlify build package to try and address failures in macOS …
ericapisani Apr 5, 2022
1d5c2f3
ci: use netlify-cli as dep, not netlify/build
ericapisani Apr 5, 2022
ab8d9d1
ci: add package-locks to test fixtures
ericapisani Apr 5, 2022
0f4b617
revert: "ci: add package-locks to test fixtures"
ericapisani Apr 6, 2022
b8b0a81
ci: revert back to 'npm ci' instead of 'npm install'
ericapisani Apr 6, 2022
8817421
chore(deps): install netlify-cli globally within test runner
ericapisani Apr 6, 2022
86398c6
fix(deps): pin netlify/build package to previous version
ericapisani Apr 6, 2022
e2d92d8
ci: remove setting of cache
ericapisani Apr 6, 2022
07ecf96
ci: add --prefer-offline flag to npm installs of test
ericapisani Apr 6, 2022
4c4c690
ci: try to cache node_modules for the test fixtures
ericapisani Apr 6, 2022
5ea5ae6
style: lint
ericapisani Apr 6, 2022
ad01007
ci: accidentally removed an install command
ericapisani Apr 6, 2022
c0b9e91
ci: 'run' accidentally snuck into the command
ericapisani Apr 6, 2022
4241513
ci: run the macOS test runner on the main branch rather than on every…
ericapisani Apr 7, 2022
9b80afc
ci: modify conditional logic for syntax reasons
ericapisani Apr 7, 2022
06961e0
ci: use include rather than exclude mechanism
ericapisani Apr 7, 2022
ce9cfc0
style: lint
ericapisani Apr 7, 2022
f9fea15
ci: move expression out of matrix
ericapisani Apr 7, 2022
6955cf4
ci: last attempt at matrix config before breaking them into jobs
ericapisani Apr 7, 2022
46141d6
ci: transition from use of a matrix to jobs
ericapisani Apr 7, 2022
ecf254f
style: lint
ericapisani Apr 7, 2022
ca4bdc2
style: more lint
ericapisani Apr 7, 2022
996b3da
ci: remove node_version
ericapisani Apr 7, 2022
41c314f
ci: mac test job doesn't need to wait for ubuntu to complete
ericapisani Apr 7, 2022
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
61 changes: 44 additions & 17 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,54 @@ on:
pull_request:

jobs:
build:
runs-on: ${{ matrix.os }}

strategy:
matrix:
os: [ubuntu-latest, macOS-latest] #, windows-latest] # TODO add an e2etest.bat file
node-version: ['*']
exclude:
- os: macOS-latest
node-version: 14.15.0
# - os: windows-latest
# node-version: 14.15.0
fail-fast: false
build-ubuntu:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '*'
- name: Global Node packages cache
uses: actions/cache@v3
with:
path: ~/.npm
key:
ubuntu--build-${{ env.cache-name }}-${{
hashFiles('**/package-lock.json') }}
- name: Test fixture dependency cache
uses: actions/cache@v3
with:
path: plugin/test/fixtures/**/node_modules
key:
ubuntu-build-${{ env.cache-name }}-${{
hashFiles('plugin/test/fixtures/**/package.json') }}-node-modules
- run: npm install -g netlify-cli
- run: npm ci
- run: cd plugin && npm ci && npm run build
- run: npm test

build-mac:
runs-on: macOS-latest
if: github.ref_name == 'main'
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
- uses: actions/setup-node@v3
with:
node-version: '*'
- name: Global Node packages cache
uses: actions/cache@v3
with:
path: ~/.npm
key:
macOS-build-${{ env.cache-name }}-${{
hashFiles('**/package-lock.json') }}
- name: Test fixture dependency cache
uses: actions/cache@v3
with:
node-version: ${{ matrix.node-version }}
check-latest: '*'
path: plugin/test/fixtures/**/node_modules
key:
macOS-build-${{ env.cache-name }}-${{
hashFiles('plugin/test/fixtures/**/package.json') }}-node-modules
- run: npm install -g netlify-cli
- run: npm ci
- run: cd plugin && npm ci && npm run build
Expand Down
Loading