-
Notifications
You must be signed in to change notification settings - Fork 156
chore(build): broke up pr workflow & measure package size #1031
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
Changes from 3 commits
1585596
0db209f
75df9a3
736dbf6
b108cfd
017c999
8e303d9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: Measure packages size | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
prNumber: | ||
description: "PR Number" | ||
required: true | ||
|
||
jobs: | ||
measure-utils-sizes: | ||
runs-on: ubuntu-latest | ||
env: | ||
NODE_ENV: dev | ||
PR_NUMBER: ${{ inputs.prNumber }} | ||
steps: | ||
- name: Checkout Repo | ||
uses: actions/checkout@v3 | ||
- name: Packages size report | ||
uses: flochaz/[email protected] | ||
with: | ||
build-command: mkdir dist && npm run package -w packages/logger -w packages/tracer -w packages/metrics && npm run package-bundle -w packages/logger -w packages/tracer -w packages/metrics && bash -c "mv ./packages/*/dist/* dist/" && ls dist | ||
dist-directory: /dist | ||
pr-number: ${{ inputs.prNumber }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
name: pr-lint-and-test | ||
name: On PR code update | ||
|
||
on: | ||
pull_request: | ||
types: [opened, synchronize] | ||
jobs: | ||
on_push: | ||
run-unit-tests-on-utils: | ||
runs-on: ubuntu-latest | ||
env: | ||
NODE_ENV: dev | ||
|
@@ -12,63 +13,40 @@ jobs: | |
version: [12, 14, 16] | ||
fail-fast: false | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: "Use NodeJS" | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
- name: Setup NodeJS | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.version }} | ||
- name: Install npm@8.x | ||
- name: Setup npm | ||
run: npm i -g npm@next-8 | ||
- name: "Setup npm" | ||
run: | | ||
npm set "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" | ||
- name: Install monorepo packages | ||
# This installs all the dependencies of ./packages/* | ||
- name: Install dependencies | ||
# See https://github.com/npm/cli/issues/4475 to see why --foreground-scripts | ||
run: npm ci --foreground-scripts | ||
- name: Install CDK example packages | ||
# Since we are not managing the CDK examples with npm workspaces we install | ||
# the dependencies in a separate step | ||
working-directory: ./examples/cdk | ||
run: npm ci | ||
- name: "Setup SAM" | ||
# We use an ad-hoc action so we can specify the SAM CLI version | ||
uses: aws-actions/setup-sam@v2 | ||
- name: Lint | ||
run: npm run lint -w packages/logger -w packages/tracer -w packages/metrics | ||
- name: Run unit tests | ||
run: npm t -w packages/logger -w packages/tracer -w packages/metrics | ||
check-examples: | ||
runs-on: ubuntu-latest | ||
env: | ||
NODE_ENV: dev | ||
strategy: | ||
matrix: | ||
example: ["sam", "cdk"] | ||
fail-fast: false | ||
defaults: | ||
run: | ||
working-directory: examples/${{ matrix.example }} | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
- name: Setup NodeJS | ||
uses: actions/setup-node@v3 | ||
with: | ||
version: 1.49.0 | ||
- name: Install SAM example packages | ||
# Since we are not managing the SAM examples with npm workspaces we install | ||
# the dependencies in a separate step | ||
working-directory: ./examples/sam | ||
node-version: 16 | ||
- name: Install dependencies | ||
run: npm ci | ||
- name: Run lint | ||
run: npm run lerna-lint | ||
- name: Run tests | ||
run: npm run lerna-test | ||
- name: Collate Coverage Reports | ||
if: ${{ github.actor != 'dependabot[bot]' }} | ||
run: | | ||
for d in ./packages/*/ ; do | ||
mkdir -p coverage | ||
if [[ ! -f coverage/lcov.info ]] | ||
then | ||
continue | ||
fi | ||
filename="$d""coverage/lcov.info" | ||
targetSource="SF:""$d""src" | ||
sed "s|SF:src|$targetSource|g" $filename >> coverage/lcov.info | ||
done | ||
- name: Report Coverage | ||
#Dependabot user will only have read-only perms, so don't try to report coverage | ||
if: ${{ github.actor != 'dependabot[bot]' }} | ||
uses: romeovs/[email protected] | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
lcov-file: ./coverage/lcov.info | ||
- name: Packages size report | ||
uses: flochaz/[email protected] | ||
with: | ||
build-command: mkdir dist && npm run lerna-package && npm run lerna-package-bundle && bash -c "mv ./packages/*/dist/* dist/" && ls dist | ||
dist-directory: /dist | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: npm t |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,7 @@ | |
}, | ||
"devDependencies": { | ||
"@types/aws-lambda": "^8.10.86", | ||
"@types/jest": "^27.5.2", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This change is needed because we are now running the tests outside of the |
||
"@types/node": "18.0.0", | ||
"esbuild": "^0.14.23", | ||
"eslint": "^8.4.0", | ||
|
@@ -32,4 +33,4 @@ | |
"@aws-lambda-powertools/tracer": "^1.0.1", | ||
"aws-sdk": "^2.1122.0" | ||
} | ||
} | ||
} |
Uh oh!
There was an error while loading. Please reload this page.