From 599ab3baf97464838735a7c55eb55c1b9b96cbb9 Mon Sep 17 00:00:00 2001 From: Michael Maeng Date: Tue, 8 Nov 2022 10:21:49 -0500 Subject: [PATCH 1/7] Update github CI workflow to cache pip and npm, update npm ci command to use correct --include=optional syntax --- .github/workflows/ci.yml | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fe45b4c..0283074 100755 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,13 +2,7 @@ # Continous Integration name: ci -on: - pull_request: - branches: - - master - push: - branches: - - master +on: [ push, pull_request ] jobs: build: @@ -26,6 +20,7 @@ jobs: - uses: actions/setup-python@v4 with: python-version: 3.7 + cache: 'pip' - name: Install Dependencies Python id: install_python run: | @@ -36,11 +31,12 @@ jobs: - uses: actions/setup-node@v3 with: node-version: 14 + cache: 'npm' - name: Install Dependencies Node.js id: install_nodejs # Touch needed because of https://github.com/aws/aws-cli/issues/2639 run: | - npm ci --optional + npm ci --include=optional find ./node_modules/* -mtime +10950 -exec touch {} \; npm run build - name: Run Unit Tests @@ -74,7 +70,7 @@ jobs: cp "$RPDK_PATH" ./dist npm install "./dist/$RPDK_PACKAGE" cfn generate -vv && cfn validate -vv - npm install --optional + npm install --include=optional sam build --debug --build-dir ./build TypeFunction sam build --debug --build-dir ./build TestEntrypoint sam local invoke -t build/template.yaml --debug --event sam-tests/create.json --log-file sam.log TestEntrypoint From 0055518098d2077984b54fa474865be9f931befe Mon Sep 17 00:00:00 2001 From: Michael Maeng Date: Tue, 8 Nov 2022 10:22:19 -0500 Subject: [PATCH 2/7] Explicitly set EOL to be LF on checkout --- .gitattributes | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..4282322 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +# Set the default behavior, in case people don't have core.autocrlf set. +* text eol=lf From f8104bcba59d785a4d1ced7e5ed022ebf4b17f2c Mon Sep 17 00:00:00 2001 From: Michael Maeng Date: Tue, 8 Nov 2022 10:59:15 -0500 Subject: [PATCH 3/7] Added stub requirements.txt file for pip caching --- requirements.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 requirements.txt diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..d6e1198 --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +-e . From b6de3bd1acb0ab6014e3a99c8b5e4b26a731428e Mon Sep 17 00:00:00 2001 From: Michael Maeng Date: Tue, 8 Nov 2022 11:10:38 -0500 Subject: [PATCH 4/7] Add in other OSs and version of python --- .github/workflows/ci.yml | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0283074..686ac40 100755 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,6 +7,17 @@ on: [ push, pull_request ] jobs: build: runs-on: ubuntu-18.04 + steps: + - uses: actions/setup-python@v4 + with: + python-version: 3.7 + os_build: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ ubuntu-latest, macos-latest, windows-latest ] + python: [ 3.6, 3.7, 3.8, 3.9 ] + node: [ 14 ] env: SAM_CLI_TELEMETRY: "0" AWS_REGION: "us-east-1" @@ -19,7 +30,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-python@v4 with: - python-version: 3.7 + python-version: ${{ matrix.python }} cache: 'pip' - name: Install Dependencies Python id: install_python @@ -30,7 +41,7 @@ jobs: pip install . - uses: actions/setup-node@v3 with: - node-version: 14 + node-version: ${{ matrix.node }} cache: 'npm' - name: Install Dependencies Node.js id: install_nodejs @@ -39,6 +50,10 @@ jobs: npm ci --include=optional find ./node_modules/* -mtime +10950 -exec touch {} \; npm run build + - uses: actions/cache@v3 + with: + path: ~/.cache/pre-commit/ + key: ${{ matrix.os }}-${{ env.pythonLocation }}${{ hashFiles('.pre-commit-config.yaml') }} - name: Run Unit Tests id: unit_testing run: | From b1274d05db4c7f7d5cfbcf5eb4d057ea08a67896 Mon Sep 17 00:00:00 2001 From: Michael Maeng Date: Tue, 8 Nov 2022 11:23:23 -0500 Subject: [PATCH 5/7] remove windows from ci workflow --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 686ac40..8b2fee2 100755 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,7 +15,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ ubuntu-latest, macos-latest, windows-latest ] + os: [ ubuntu-latest, macos-latest ] python: [ 3.6, 3.7, 3.8, 3.9 ] node: [ 14 ] env: From 15df9dcf591d3fd3a0832bbd888a831cb6b19f2d Mon Sep 17 00:00:00 2001 From: Michael Maeng Date: Tue, 8 Nov 2022 11:28:16 -0500 Subject: [PATCH 6/7] downgrade versions in pre-commit for python 3.6 --- .pre-commit-config.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 59fa56c..b9b20ae 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -5,12 +5,12 @@ repos: - id: isort # language_version: python3.6 - repo: https://github.com/ambv/black - rev: 22.10.0 + rev: 22.8.0 hooks: - id: black # language_version: python3.6 - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.3.0 + rev: v4.1.0 hooks: - id: check-case-conflict - id: end-of-file-fixer @@ -44,7 +44,7 @@ repos: - id: python-check-mock-methods - id: python-no-log-warn - repo: https://github.com/PyCQA/bandit - rev: 1.7.4 + rev: 1.7.1 hooks: - id: bandit files: "^python/" From 9ce86f750c94d2606a19d0f8cae3722192d3731f Mon Sep 17 00:00:00 2001 From: Michael Maeng Date: Tue, 8 Nov 2022 15:53:51 -0500 Subject: [PATCH 7/7] Remove macos from ci --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8b2fee2..9e3844f 100755 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,7 +15,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ ubuntu-latest, macos-latest ] + os: [ ubuntu-latest ] python: [ 3.6, 3.7, 3.8, 3.9 ] node: [ 14 ] env: