Skip to content

Commit 9f65070

Browse files
sarageriondreamorosi
authored andcommitted
chore(cicd): add lerna commands in github actions - PR checks
1 parent 13ec0c4 commit 9f65070

File tree

4 files changed

+12
-17
lines changed

4 files changed

+12
-17
lines changed

.github/workflows/reusable-run-linting-check-and-unit-tests.yml

+7-13
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,6 @@ jobs:
5555
matrix:
5656
example: ["sam", "cdk"]
5757
fail-fast: false
58-
defaults:
59-
run:
60-
working-directory: examples/${{ matrix.example }}
6158
steps:
6259
- name: Checkout code
6360
uses: actions/checkout@v3
@@ -73,24 +70,21 @@ jobs:
7370
path: "./examples/${{ matrix.example }}/node_modules"
7471
# Use the combo between example, name, and SHA-256 hash of all example lock files as cache key.
7572
# It's not possible to use the ${{ matrix.example }} key in the hashFiles fn so
76-
# if any of the lock files (wich should be fairly similar anyway) changes the cache is
73+
# if any of the lock files (which should be fairly similar anyway) changes the cache is
7774
# invalidated/discarded for all.
7875
key: ${{ matrix.example }}-cache-examples-node-modules-${{ hashFiles('./examples/*/package-lock.json') }}
7976
- name: Install dependencies
80-
# We can skip the install if there was a cache hit
77+
# We can skip the installation if there was a cache hit
8178
if: steps.cache-node-modules.outputs.cache-hit != 'true'
82-
run: npm ci
79+
run: npm run lerna -- exec npm ci --scope ${{ matrix.example }}-example
8380
- name: Run linting
8481
run: npm run lint
8582
- name: Run tests
86-
run: npm t
83+
run: npm run lerna -- run test --scope ${{ matrix.example }}-example
8784
check-layer-publisher:
8885
runs-on: ubuntu-latest
8986
env:
9087
NODE_ENV: dev
91-
defaults:
92-
run:
93-
working-directory: layer-publisher
9488
steps:
9589
- name: Checkout code
9690
uses: actions/checkout@v3
@@ -107,8 +101,8 @@ jobs:
107101
# Use the combo between example, name, and SHA-256 hash of the layer-publisher lock files as cache key.
108102
key: cache-layer-publisher-node-modules-${{ hashFiles('./layer-publisher/*/package-lock.json') }}
109103
- name: Install Layer publisher
110-
# We can skip the install if there was a cache hit
104+
# We can skip the installation if there was a cache hit
111105
if: steps.cache-node-modules.outputs.cache-hit != 'true'
112-
run: npm ci
106+
run: npm run lerna -- exec npm ci --scope layer-publisher
113107
- name: Run linting
114-
run: npm run lint
108+
run: npm run lerna -- run lint --scope layer-publisher

examples/cdk/package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"name": "cdk-app",
3-
"version": "1.3.0",
2+
"name": "cdk-example",
3+
"version": "1.2.1",
44
"author": {
55
"name": "Amazon Web Services",
66
"url": "https://aws.amazon.com"
@@ -45,4 +45,4 @@
4545
"constructs": "^10.0.82",
4646
"source-map-support": "^0.5.16"
4747
}
48-
}
48+
}

examples/sam/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,4 @@
3535
"@aws-lambda-powertools/tracer": "^1.2.1",
3636
"aws-sdk": "^2.1122.0"
3737
}
38-
}
38+
}

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"commit": "commit",
1717
"package": "npm run package",
1818
"setup-local": "npm ci --foreground-scripts && cd examples/cdk && npm ci && cd ../../examples/sam && npm ci && cd ../../layer-publisher && npm ci && cd ../.. && npm run init-environment",
19+
"lerna" : "lerna",
1920
"lerna-test": "lerna exec -- npm run test",
2021
"lerna-test:unit": "lerna exec -- npm run test:unit",
2122
"lerna-test:e2e": "lerna exec -- npm run test:e2e",

0 commit comments

Comments
 (0)