Skip to content

Commit

Permalink
chore: do not check in lockfiles but cache them (#1896)
Browse files Browse the repository at this point in the history
  • Loading branch information
dyladan authored Feb 4, 2021
1 parent 3b5892b commit 7e423a9
Show file tree
Hide file tree
Showing 45 changed files with 161 additions and 221,645 deletions.
27 changes: 20 additions & 7 deletions .github/workflows/canary.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- main

jobs:
build-and-test:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
Expand All @@ -23,21 +23,34 @@ jobs:
registry-url: https://registry.npmjs.org
scope: '@opentelemetry'

- name: restore lerna
- name: restore lock files
uses: actions/cache@master # must use unreleased master to cache multiple paths
id: cache
with:
# must be done before bootstrap to not include node_modules files in the cache paths
path: |
node_modules
packages/*/node_modules
metapackages/*/node_modules
packages/*/package-lock.json
benchmark/*/package-lock.json
backwards-compatability/*/package-lock.json
metapackages/*/package-lock.json
packages/*/package-lock.json
integration-tests/*/package-lock.json
key: ${{ runner.os }}-${{ hashFiles('**/package.json') }}

- name: Install and Build 🔧
- name: Install root dependencies
run: npm ci --ignore-scripts

- name: Install and Build (cache miss) 🔧
if: steps.cache.outputs.cache-hit != 'true'
run: |
npm ci --ignore-scripts
npx lerna bootstrap --no-ci
npm run compile
- name: Install and Build (cache hit) 🔧
if: steps.cache.outputs.cache-hit == 'true'
run: |
npx lerna bootstrap
npm run compile
- name: Publish
run: npx lerna publish --canary --yes
Expand Down
30 changes: 25 additions & 5 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Deploy docs on a new release
name: Deploy API Documentation

on:
release:
Expand All @@ -11,10 +11,30 @@ jobs:
- name: Checkout 🛎️
uses: actions/checkout@v2

- name: Install Dependencies
run: |
npm ci --ignore-scripts
npx lerna bootstrap --scope @opentelemetry/api --include-dependencies
- name: restore lock files
uses: actions/cache@master # must use unreleased master to cache multiple paths
id: cache
with:
# must be done before bootstrap to not include node_modules files in the cache paths
path: |
packages/*/package-lock.json
benchmark/*/package-lock.json
backwards-compatability/*/package-lock.json
metapackages/*/package-lock.json
packages/*/package-lock.json
integration-tests/*/package-lock.json
key: ${{ runner.os }}-docs-${{ hashFiles('**/package.json') }}

- name: Install root dependencies
run: npm ci --ignore-scripts

- name: Install and Build (cache miss) 🔧
if: steps.cache.outputs.cache-hit != 'true'
run: npx lerna bootstrap --no-ci --scope @opentelemetry/api --include-dependencies

- name: Install and Build (cache hit) 🔧
if: steps.cache.outputs.cache-hit == 'true'
run: npx lerna bootstrap --scope @opentelemetry/api --include-dependencies

- name: Build 🔧
run: |
Expand Down
36 changes: 31 additions & 5 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,46 @@ jobs:
with:
args: "./**/*.md -i ./CHANGELOG.md"

- name: Bootstrap
- name: restore lock files
uses: actions/cache@master # must use unreleased master to cache multiple paths
id: cache
with:
# must be done before bootstrap to not include node_modules files in the cache paths
path: |
packages/*/package-lock.json
benchmark/*/package-lock.json
backwards-compatability/*/package-lock.json
metapackages/*/package-lock.json
packages/*/package-lock.json
integration-tests/*/package-lock.json
key: ${{ runner.os }}-lint-${{ hashFiles('**/package.json') }}

- name: Install root dependencies
run: npm ci --ignore-scripts

# On a cache hit, use ci to speed up the install process
- name: Bootstrap (cache hit)
if: steps.cache.outputs.cache-hit == 'true'
run: npx lerna bootstrap --ignore-scripts

# On a cache miss, fall back to a regular install
- name: Bootstrap (cache miss)
if: steps.cache.outputs.cache-hit != 'true'
run: |
npm ci --ignore-scripts
npx lerna bootstrap --ignore-scripts
run: npx lerna bootstrap --no-ci --ignore-scripts -- --only=dev

- name: Lint
run: |
npm run lint
npm run lint:examples
- name: Install API Dependencies
- name: Install API Dependencies (cache hit)
if: steps.cache.outputs.cache-hit == 'true'
run: npx lerna bootstrap --scope @opentelemetry/api --include-dependencies

- name: Install API Dependencies (cache miss)
if: steps.cache.outputs.cache-hit != 'true'
run: npx lerna bootstrap --no-ci --scope @opentelemetry/api --include-dependencies

- name: Build 🔧
run: |
npx lerna run compile --scope @opentelemetry/api
Expand Down
68 changes: 58 additions & 10 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,36 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Install Root Dependencies

- name: restore lock files
uses: actions/cache@master # must use unreleased master to cache multiple paths
id: cache
with:
# must be done before bootstrap to not include node_modules files in the cache paths
path: |
packages/*/package-lock.json
benchmark/*/package-lock.json
backwards-compatability/*/package-lock.json
metapackages/*/package-lock.json
packages/*/package-lock.json
integration-tests/*/package-lock.json
key: ${{ runner.os }}-unit_test-${{ matrix.container }}-${{ hashFiles('**/package.json') }}

- name: Install root dependencies
run: npm ci --ignore-scripts
- name: Boostrap Dependencies
run: npx lerna bootstrap
- name: Build
run: npm run compile

- name: Install and Build (cache miss) 🔧
if: steps.cache.outputs.cache-hit != 'true'
run: |
npx lerna bootstrap --no-ci
npm run compile
- name: Install and Build (cache hit) 🔧
if: steps.cache.outputs.cache-hit == 'true'
run: |
npx lerna bootstrap
npm run compile
- name: Unit tests
run: npm run test
- name: Report Coverage
Expand All @@ -41,12 +65,36 @@ jobs:
uses: actions/checkout@v1
- name: Permission Setup
run: sudo chmod -R 777 /github /__w
- name: Install Root Dependencies

- name: restore lock files
uses: actions/cache@master # must use unreleased master to cache multiple paths
id: cache
with:
# must be done before bootstrap to not include node_modules files in the cache paths
path: |
packages/*/package-lock.json
benchmark/*/package-lock.json
backwards-compatability/*/package-lock.json
metapackages/*/package-lock.json
packages/*/package-lock.json
integration-tests/*/package-lock.json
key: ${{ runner.os }}-unit_test-${{ matrix.container }}-${{ hashFiles('**/package.json') }}

- name: Install root dependencies
run: npm ci --ignore-scripts
- name: Boostrap Dependencies
run: npx lerna bootstrap
- name: Build
run: npm run compile

- name: Install and Build (cache miss) 🔧
if: steps.cache.outputs.cache-hit != 'true'
run: |
npx lerna bootstrap --no-ci
npm run compile
- name: Install and Build (cache hit) 🔧
if: steps.cache.outputs.cache-hit == 'true'
run: |
npx lerna bootstrap
npm run compile
- name: Unit tests
run: npm run test:browser
- name: Report Coverage
Expand Down
32 changes: 26 additions & 6 deletions .github/workflows/w3c-integration-test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Run w3c tests on push
name: W3C Trace Context Integration Test

on:
push:
Expand All @@ -7,16 +7,36 @@ on:
pull_request:

jobs:
build-and-deploy:
build-and-test:
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v2

- name: Install
run: |
npm ci --ignore-scripts
npx lerna bootstrap --scope=propagation-validation-server --include-dependencies
- name: restore lock files
uses: actions/cache@master # must use unreleased master to cache multiple paths
id: cache
with:
# must be done before bootstrap to not include node_modules files in the cache paths
path: |
packages/*/package-lock.json
benchmark/*/package-lock.json
backwards-compatability/*/package-lock.json
metapackages/*/package-lock.json
packages/*/package-lock.json
integration-tests/*/package-lock.json
key: ${{ runner.os }}-w3c_integration-${{ hashFiles('**/package.json') }}

- name: Install root dependencies
run: npm ci --ignore-scripts

- name: Install and Build (cache miss) 🔧
if: steps.cache.outputs.cache-hit != 'true'
run: npx lerna bootstrap --no-ci --scope=propagation-validation-server --include-dependencies

- name: Install and Build (cache hit) 🔧
if: steps.cache.outputs.cache-hit == 'true'
run: npx lerna bootstrap --scope=propagation-validation-server --include-dependencies

- name: Build 🔧
run: npm run compile
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ typings/
# lock files
yarn.lock
packages/**/yarn.lock
*/**/package-lock.json

# docs files
docs
Expand Down
20 changes: 0 additions & 20 deletions backwards-compatability/node10/package-lock.json

This file was deleted.

20 changes: 0 additions & 20 deletions backwards-compatability/node12/package-lock.json

This file was deleted.

20 changes: 0 additions & 20 deletions backwards-compatability/node8/package-lock.json

This file was deleted.

Loading

0 comments on commit 7e423a9

Please sign in to comment.