Skip to content

Commit 0b21273

Browse files
authored
test(cicd): Fix/release (#321)
1 parent cc259d1 commit 0b21273

File tree

106 files changed

+41344
-8384
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

106 files changed

+41344
-8384
lines changed

Diff for: .eslintrc.js

+59-45
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,77 @@
11
module.exports = {
22
env: {
3-
'browser': false,
4-
'es2020': true,
5-
'jest': true,
6-
'node': true,
3+
browser: false,
4+
es2020: true,
5+
jest: true,
6+
node: true,
77
},
8-
extends: [
9-
'plugin:@typescript-eslint/eslint-recommended',
10-
'plugin:@typescript-eslint/recommended'
11-
],
8+
extends: ['plugin:@typescript-eslint/eslint-recommended', 'plugin:@typescript-eslint/recommended'],
129
parser: '@typescript-eslint/parser',
1310
plugins: ['@typescript-eslint'],
11+
settings: {
12+
'import/resolver': {
13+
node: {},
14+
typescript: {
15+
project: './tsconfig.es.json',
16+
alwaysTryTypes: true,
17+
},
18+
},
19+
},
1420
rules: {
1521
'@typescript-eslint/ban-ts-ignore': ['off'],
1622
'@typescript-eslint/camelcase': ['off'],
17-
'@typescript-eslint/explicit-function-return-type': [ 'error', { 'allowExpressions': true } ],
23+
'@typescript-eslint/explicit-function-return-type': ['error', { allowExpressions: true }],
1824
'@typescript-eslint/explicit-member-accessibility': 'error',
19-
'@typescript-eslint/indent': [ 'error', 2, { 'SwitchCase': 1 } ],
25+
'@typescript-eslint/indent': ['error', 2, { SwitchCase: 1 }],
2026
'@typescript-eslint/interface-name-prefix': ['off'],
21-
'@typescript-eslint/member-delimiter-style': [ 'error', { 'multiline': { 'delimiter': 'none' } } ],
22-
'@typescript-eslint/member-ordering': [ 'error', {
23-
'default': { 'memberTypes': [
24-
'signature',
25-
'public-field', // = ["public-static-field", "public-instance-field"]
26-
'protected-field', // = ["protected-static-field", "protected-instance-field"]
27-
'private-field', // = ["private-static-field", "private-instance-field"]
28-
'constructor',
29-
'public-method', // = ["public-static-method", "public-instance-method"]
30-
'protected-method', // = ["protected-static-method", "protected-instance-method"]
31-
'private-method' // = ["private-static-method", "private-instance-method"]
32-
] ,
33-
'order': 'alphabetically' }
34-
} ],
27+
'@typescript-eslint/member-delimiter-style': ['error', { multiline: { delimiter: 'none' } }],
28+
'@typescript-eslint/member-ordering': [
29+
'error',
30+
{
31+
default: {
32+
memberTypes: [
33+
'signature',
34+
'public-field', // = ["public-static-field", "public-instance-field"]
35+
'protected-field', // = ["protected-static-field", "protected-instance-field"]
36+
'private-field', // = ["private-static-field", "private-instance-field"]
37+
'constructor',
38+
'public-method', // = ["public-static-method", "public-instance-method"]
39+
'protected-method', // = ["protected-static-method", "protected-instance-method"]
40+
'private-method', // = ["private-static-method", "private-instance-method"]
41+
],
42+
order: 'alphabetically',
43+
},
44+
},
45+
],
3546
'@typescript-eslint/no-explicit-any': 'error',
3647
'@typescript-eslint/no-inferrable-types': ['off'],
37-
'@typescript-eslint/no-unused-vars': [ 'error', { 'argsIgnorePattern': '^_' } ],
48+
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
3849
'@typescript-eslint/no-use-before-define': ['off'],
39-
'@typescript-eslint/semi': [ 'error', 'always' ],
40-
'array-bracket-spacing': [ 'error', 'always', { 'singleValue': false } ],
41-
'arrow-body-style': [ 'error', 'as-needed' ],
42-
'computed-property-spacing': [ 'error', 'never' ],
43-
'func-style': [ 'warn', 'expression' ],
44-
'indent': [ 'error', 2, { 'SwitchCase': 1 } ],
50+
'@typescript-eslint/semi': ['error', 'always'],
51+
'array-bracket-spacing': ['error', 'always', { singleValue: false }],
52+
'arrow-body-style': ['error', 'as-needed'],
53+
'computed-property-spacing': ['error', 'never'],
54+
'func-style': ['warn', 'expression'],
55+
indent: ['error', 2, { SwitchCase: 1 }],
4556
'keyword-spacing': 'error',
4657
'newline-before-return': 2,
4758
'no-console': 0,
48-
'no-multi-spaces': [ 'error', { 'ignoreEOLComments': false } ],
49-
'no-multiple-empty-lines': [ 'error', { 'max': 1, 'maxBOF': 0 } ],
59+
'no-multi-spaces': ['error', { ignoreEOLComments: false }],
60+
'no-multiple-empty-lines': ['error', { max: 1, maxBOF: 0 }],
5061
'no-throw-literal': 'error',
51-
'object-curly-spacing': [ 'error', 'always' ],
62+
'object-curly-spacing': ['error', 'always'],
5263
'prefer-arrow-callback': 'error',
53-
'quotes': [ 'error', 'single', { 'allowTemplateLiterals': true } ],
54-
'semi': [ 'error', 'always' ],
55-
'sort-imports': [ 'error', {
56-
'allowSeparatedGroups': true,
57-
'ignoreCase': true,
58-
'ignoreDeclarationSort': false,
59-
'ignoreMemberSort': true,
60-
'memberSyntaxSortOrder': [ 'all', 'single', 'multiple', 'none' ]
61-
} ]
62-
}
63-
};
64+
quotes: ['error', 'single', { allowTemplateLiterals: true }],
65+
semi: ['error', 'always'],
66+
'sort-imports': [
67+
'error',
68+
{
69+
allowSeparatedGroups: true,
70+
ignoreCase: true,
71+
ignoreDeclarationSort: false,
72+
ignoreMemberSort: true,
73+
memberSyntaxSortOrder: ['all', 'single', 'multiple', 'none'],
74+
},
75+
],
76+
},
77+
};

Diff for: .github/workflows/on-docs-change.yml

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Auto publish docs to version "develop"
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- 'docs/**'
9+
- 'README.md'
10+
- 'CHANGELOG.md'
11+
- 'mkdocs.yml'
12+
- '.github/workflows/on-docs-change.yml'
13+
14+
jobs:
15+
docs:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v2
19+
with:
20+
fetch-depth: 0
21+
- name: Set up Python
22+
uses: actions/[email protected]
23+
with:
24+
python-version: '3.8'
25+
- name: Set up NodeJS
26+
uses: actions/setup-node@v2
27+
with:
28+
node-version: '17.2'
29+
- name: Install dependencies
30+
run: |
31+
pip install --upgrade pip
32+
pip install mike==1.1.2 mkdocs-material==8.0.5 mkdocs-git-revision-date-plugin==0.3.1
33+
npm ci
34+
- name: Setup doc deploy
35+
run: |
36+
git config --global user.name Docs deploy
37+
git config --global user.email [email protected]
38+
- name: Build mkdocs site in 'gh-pages' branch and push
39+
run: |
40+
rm -rf site
41+
VERSION="develop"
42+
ALIAS="stage"
43+
mkdocs build
44+
mike deploy --push --update-aliases "$VERSION" "$ALIAS"
45+
- name: Build API documentation site
46+
run: |
47+
rm -rf api
48+
npm run docs-generateApiDoc
49+
- name: Deploy API documentation site (copy to "gh-pages" branch inside the version folder)
50+
uses: peaceiris/actions-gh-pages@v3
51+
with:
52+
github_token: ${{ secrets.GITHUB_TOKEN }}
53+
publish_dir: ./api
54+
keep_files: true
55+
destination_dir: develop/api

Diff for: .github/workflows/on-pull-request.yml

-43
This file was deleted.

Diff for: .github/workflows/on-push.yml

+24-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ on:
55
jobs:
66
on_push:
77
runs-on: ubuntu-latest
8-
if: ${{ github.event_name != 'pull_request' }}
98
env:
109
NODE_ENV: dev
1110
steps:
@@ -14,11 +13,34 @@ jobs:
1413
uses: actions/setup-node@v2
1514
with:
1615
node-version: '14'
16+
- name: "Setup npm"
17+
run: |
18+
npm set "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}"
1719
- name: Install packages
1820
run: |
1921
npm ci
2022
npm run lerna-ci
2123
- name: Run lint
2224
run: npm run lerna-lint
2325
- name: Run tests
24-
run: npm run lerna-test
26+
run: npm run lerna-test
27+
- name: Collate Coverage Reports
28+
if: ${{ github.actor != 'dependabot[bot]' }}
29+
run: |
30+
for d in ./packages/*/ ; do
31+
mkdir -p coverage
32+
if [[ ! -f coverage/lcov.info ]]
33+
then
34+
continue
35+
fi
36+
filename="$d""coverage/lcov.info"
37+
targetSource="SF:""$d""src"
38+
sed "s|SF:src|$targetSource|g" $filename >> coverage/lcov.info
39+
done
40+
- name: Report Coverage
41+
#Dependabot user will only have read-only perms, so don't try to report coverage
42+
if: ${{ github.actor != 'dependabot[bot]' }}
43+
uses: romeovs/[email protected]
44+
with:
45+
github-token: ${{ secrets.GITHUB_TOKEN }}
46+
lcov-file: ./coverage/lcov.info

Diff for: .github/workflows/on-release.yml

+1-18
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: release
22
on:
33
push:
44
branches:
5-
- main
5+
- chore/releaseFlow
66
workflow_dispatch: {}
77
jobs:
88
publish:
@@ -43,20 +43,3 @@ jobs:
4343
fi
4444
4545
npx lerna publish --no-verify-access from-git --yes
46-
47-
slack:
48-
name: Publish to slack channel
49-
needs:
50-
- publish
51-
runs-on: ubuntu-latest
52-
steps:
53-
- name: publish latest release
54-
env:
55-
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
56-
run: |
57-
curl -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/${{ github.repository }}/releases/latest > release.json
58-
VERSION=$( jq -r '.name' release.json )
59-
CONTENT=$( jq -r '.body' release.json )
60-
jq -n --arg version "$VERSION" --arg content "$CONTENT" '{"release-version": $version, "release-content": $content}' > body.json
61-
curl --location --request POST $SLACK_WEBHOOK_URL \
62-
--header 'Content-Type: application/json' --data @body.json

Diff for: .gitignore

+10-1
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,13 @@ coverage
2929
.DS_Store
3030

3131
# Visual Studio Code
32-
.vscode
32+
.vscode
33+
34+
# Python virtual environments (for running mkdocs locally)
35+
venv
36+
37+
# Static documentation site generated by Mkdocs
38+
site
39+
40+
# Generated API documentation (from TypeDoc)
41+
/api

Diff for: CHANGELOG.md

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
This project follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) format for changes and adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6+
7+
8+
## [Unreleased]
9+
10+
## 0.1.0
11+
12+
### Features
13+
14+
* **tracer:** beta release ([#91](https://github.com/awslabs/aws-lambda-powertools-python/issues/91))
15+
* **logger:** beta release ([#24](https://github.com/awslabs/aws-lambda-powertools-python/issues/24))
16+
* **metrics:** beta release ([#25](https://github.com/awslabs/aws-lambda-powertools-python/issues/25))

Diff for: CONTRIBUTING.md

+11
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,17 @@ To send us a pull request, please follow these steps:
4646
GitHub provides an additional document on [forking a repository](https://help.github.com/articles/fork-a-repo/) and
4747
[creating a pull request](https://help.github.com/articles/creating-a-pull-request/).
4848

49+
#### Local documentation
50+
51+
You might find useful to run both the documentation website and the API reference locally while contributing:
52+
53+
* **API reference**: :construction:
54+
* **Docs website**:
55+
56+
You can build and start a local docs website by running these two commands.
57+
- `npm run docs-buildDockerImage` OR `docker build -t squidfunk/mkdocs-material ./docs/`
58+
- `npm run docs-runLocalDocker` OR `docker run --rm -it -p 8000:8000 -v ${PWD}:/docs squidfunk/mkdocs-material`
59+
4960
### Conventions
5061

5162
Category | Convention

Diff for: README.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# AWS Lambda Powertools (Typescript)
1+
# AWS Lambda Powertools (TypeScript)
22
![Tests](https://github.com/awslabs/aws-lambda-powertools-typescript/workflows/Test/badge.svg?branch=main)
33
## Testing
44
The repo uses JEST tests, these can be run using
@@ -20,6 +20,11 @@ align them with the style guides. Please run this before creating a PR, and comm
2020

2121
`npm run lerna-format`
2222

23+
## Credits
24+
25+
* Structured logging initial implementation from [aws-lambda-logging](https://gitlab.com/hadrien/aws_lambda_logging)
26+
* Powertools idea [DAZN Powertools](https://github.com/getndazn/dazn-lambda-powertools/)
27+
2328
## Security
2429

2530
See [CONTRIBUTING](CONTRIBUTING.md#security-issue-notifications) for more information.

Diff for: docs/Dockerfile

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
FROM squidfunk/mkdocs-material
2+
RUN pip install mkdocs-git-revision-date-plugin

Diff for: docs/changelog.md

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[comment]: <> (Includes Changelog content entire file as a snippet)
2+
--8<-- "CHANGELOG.md"

0 commit comments

Comments
 (0)