Skip to content

Commit 6969276

Browse files
authored
fix: Resolve multiple customer-blocking bugs (#126, #131, #132) (#134)
* fix: Resolve multiple customer-blocking bugs (#126, #131, #132) Fix class-transformer version mismatch (0.3.1 -> 0.5.1) causing silent deserialization failures in generated projects. Remove @ts-ignore from Integer interface so consumers with skipLibCheck:false can compile. Fix timezone-dependent test failure in log-delivery tests. Bump lib version to 1.0.7. Closes #126, #132 * ci: Modernize CI/CD workflows and tooling Replace macos-12 (removed by GitHub) with macos-13. Drop EOL Python 3.8/3.9, add 3.12. Bump python_requires from >=3.8 to >=3.10. Bump all GitHub Actions to v4. Fix upload-artifact unique name requirement. Fix pre-commit eslint hook: replace mirrors-eslint with local hook using project node_modules to prevent version drift. Bump flake8 5.0.4 -> 7.1.2 and bandit 1.7.1 -> 1.8.3 for Python 3.12 compat. Add PyPI release workflow for automated plugin publishing (requires PYPI_API_KEY_CLOUDFORMATION_CLI_TYPESCRIPT_PLUGIN secret). Add pyproject.toml for PEP 517 build system declaration. Install cloudformation-cli from GitHub master in CI to pick up pkg_resources fix not yet published to PyPI. Bump plugin version to 1.0.5. Closes #131
1 parent c674181 commit 6969276

12 files changed

Lines changed: 123 additions & 91 deletions

File tree

.github/workflows/cd.yml

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
---
21
# Continuous Delivery (Release)
32
name: cd
43

@@ -12,8 +11,8 @@ jobs:
1211
name: Prepare for NPM
1312
runs-on: ubuntu-latest
1413
steps:
15-
- uses: actions/checkout@v3
16-
- uses: actions/setup-node@v3
14+
- uses: actions/checkout@v4
15+
- uses: actions/setup-node@v4
1716
with:
1817
node-version: 20
1918
registry-url: https://registry.npmjs.org/
@@ -28,47 +27,44 @@ jobs:
2827
npm pack
2928
- name: Upload NPM Artifacts
3029
id: upload_npm
31-
uses: actions/upload-artifact@v3
30+
uses: actions/upload-artifact@v4
3231
with:
3332
name: package-npm
3433
path: cfn-rpdk-${{ env.VERSION }}.tgz
3534

3635
delivery-python:
3736
name: Prepare for PyPI
3837
runs-on: ubuntu-latest
39-
strategy:
40-
matrix:
41-
python: [3.8]
4238
steps:
43-
- uses: actions/checkout@v3
44-
- name: Setup Python ${{ matrix.python }}
45-
uses: actions/setup-python@v4
39+
- uses: actions/checkout@v4
40+
- name: Setup Python
41+
uses: actions/setup-python@v5
4642
with:
47-
python-version: ${{ matrix.python }}
43+
python-version: "3.12"
4844
- name: Install Dependencies and Package Project
4945
id: installing
5046
run: |
5147
python -m pip install --upgrade pip setuptools wheel
5248
python3 setup.py sdist bdist_wheel
53-
- uses: actions/upload-artifact@v3
49+
- uses: actions/upload-artifact@v4
5450
with:
55-
name: dist-py${{ matrix.python }}
51+
name: dist-python
5652
path: dist
5753

5854
delivery-github:
5955
name: Delivery to GitHub
6056
needs: [delivery-nodejs, delivery-python]
6157
runs-on: ubuntu-latest
6258
steps:
63-
- uses: actions/checkout@v3
59+
- uses: actions/checkout@v4
6460
- name: Download NPM Artifacts
65-
uses: actions/download-artifact@v3
61+
uses: actions/download-artifact@v4
6662
with:
6763
name: package-npm
68-
- name: Download Python 3.8 Artifacts
69-
uses: actions/download-artifact@v3
64+
- name: Download Python Artifacts
65+
uses: actions/download-artifact@v4
7066
with:
71-
name: dist-py3.8
67+
name: dist-python
7268
path: dist/
7369
- name: List Artifacts
7470
run: |

.github/workflows/ci.yml

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
---
21
# Continous Integration
32
name: ci
43

@@ -8,17 +7,29 @@ jobs:
87
build:
98
runs-on: ubuntu-latest
109
steps:
10+
- uses: actions/checkout@v4
1111
- uses: actions/setup-python@v5
1212
with:
13-
python-version: 3.9
13+
python-version: "3.12"
14+
- uses: actions/setup-node@v4
15+
with:
16+
node-version: 20
17+
cache: 'npm'
18+
- name: Install and Build
19+
run: |
20+
npm ci --include=optional
21+
npm run build
22+
- name: TypeScript Tests
23+
run: |
24+
npx jest --ci
1425
os_build:
1526
runs-on: ${{ matrix.os }}
1627
strategy:
1728
matrix:
1829
os:
1930
- ubuntu-latest
20-
- macos-12 # Later versions of ARM-based macOS runners fail because the hypervisor framework required for Docker is not supported
21-
python: [ "3.8", "3.9", "3.10", "3.11"]
31+
- macos-13
32+
python: [ "3.10", "3.11", "3.12"]
2233
node: [ 20 ]
2334
env:
2435
SAM_CLI_TELEMETRY: "0"
@@ -30,14 +41,14 @@ jobs:
3041
PIP_LOG_FILE: /tmp/pip.log
3142
HOMEBREW_NO_AUTO_UPDATE: 1
3243
steps:
33-
- uses: actions/checkout@v3
44+
- uses: actions/checkout@v4
3445
- name: Update Homebrew and save docker version
3546
if: runner.os == 'macOS'
3647
run: |
3748
brew tap homebrew/core
3849
cat "$(brew --repository)/Library/Taps/homebrew/homebrew-core/Formula/d/docker.rb" > .github/brew-formulae
3950
- name: Configure Homebrew docker cache files
40-
uses: actions/cache@v3
51+
uses: actions/cache@v4
4152
if: runner.os == 'macOS'
4253
with:
4354
path: |
@@ -51,18 +62,12 @@ jobs:
5162
run: |
5263
brew install docker --cask
5364
brew install colima
54-
# Docker engine is no longer available because of licensing
55-
# Alternative Colima is part of the github macOS runner
56-
# SAM v1.47.0+ needed for colima support, unable to use Python 3.6
5765
colima start
58-
# Ensure colima is configured for later user
5966
echo "DOCKER_HOST=unix://$HOME/.colima/default/docker.sock" >> $GITHUB_ENV
60-
# Verify Docker
6167
docker ps
6268
docker --version
63-
# Verify colima
6469
colima status
65-
- uses: actions/setup-python@v4
70+
- uses: actions/setup-python@v5
6671
with:
6772
python-version: ${{ matrix.python }}
6873
cache: 'pip'
@@ -72,19 +77,19 @@ jobs:
7277
mkdir "$LOG_PATH"
7378
pip install --upgrade pip
7479
pip install --upgrade setuptools wheel aws-sam-cli -r https://raw.githubusercontent.com/aws-cloudformation/cloudformation-cli/master/requirements.txt
80+
pip install git+https://github.com/aws-cloudformation/cloudformation-cli.git@master
7581
pip install .
76-
- uses: actions/setup-node@v3
82+
- uses: actions/setup-node@v4
7783
with:
7884
node-version: ${{ matrix.node }}
7985
cache: 'npm'
8086
- name: Install Dependencies Node.js
8187
id: install_nodejs
82-
# Touch needed because of https://github.com/aws/aws-cli/issues/2639
8388
run: |
8489
npm ci --include=optional
8590
find ./node_modules/* -mtime +10950 -exec touch {} \;
8691
npm run build
87-
- uses: actions/cache@v3
92+
- uses: actions/cache@v4
8893
with:
8994
path: ~/.cache/pre-commit/
9095
key: ${{ matrix.os }}-${{ env.pythonLocation }}${{ hashFiles('.pre-commit-config.yaml') }}
@@ -100,9 +105,9 @@ jobs:
100105
bash codecov.sh -f coverage/ts/coverage-final.json -F unittests -n codecov-typescript
101106
- name: Upload Coverage Artifacts
102107
id: upload_coverage
103-
uses: actions/upload-artifact@v3
108+
uses: actions/upload-artifact@v4
104109
with:
105-
name: coverage
110+
name: coverage-${{ matrix.os }}-py${{ matrix.python }}
106111
path: coverage/
107112
- name: Run Integration Tests
108113
id: integration_testing
@@ -140,7 +145,7 @@ jobs:
140145
- name: Upload Debug Artifacts
141146
id: upload_logs
142147
if: failure()
143-
uses: actions/upload-artifact@v3
148+
uses: actions/upload-artifact@v4
144149
with:
145-
name: debug-logs
150+
name: debug-logs-${{ matrix.os }}-py${{ matrix.python }}
146151
path: ${{ env.LOG_PATH }}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# This workflow will release project to PyPI
2+
name: CloudFormation CLI TypeScript Plugin Release
3+
on:
4+
release:
5+
types: [published]
6+
jobs:
7+
build:
8+
if: endsWith(github.ref, '-plugin')
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
- name: Set up Python 3.11
13+
uses: actions/setup-python@v5
14+
with:
15+
python-version: 3.11
16+
- name: Install dependencies
17+
run: |
18+
pip install --upgrade wheel twine
19+
- name: Package project
20+
run: |
21+
python setup.py sdist bdist_wheel
22+
- name: Publish distribution to PyPI
23+
uses: pypa/gh-action-pypi-publish@release/v1
24+
with:
25+
password: ${{ secrets.PYPI_API_KEY_CLOUDFORMATION_CLI_TYPESCRIPT_PLUGIN }}

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,3 +141,5 @@ node_modules/
141141
coverage/
142142

143143
*.iml
144+
# Kiro IDE
145+
.kiro/

.pre-commit-config.yaml

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ repos:
2727
- id: check-merge-conflict
2828
# - id: check-yaml # have jinja yml templates so skipping this
2929
- repo: https://github.com/pycqa/flake8
30-
rev: "5.0.4"
30+
rev: "7.1.2"
3131
hooks:
3232
- id: flake8
3333
additional_dependencies:
@@ -45,19 +45,18 @@ repos:
4545
- id: python-check-mock-methods
4646
- id: python-no-log-warn
4747
- repo: https://github.com/PyCQA/bandit
48-
rev: 1.7.1
48+
rev: 1.8.3
4949
hooks:
5050
- id: bandit
5151
files: "^python/"
52-
- repo: https://github.com/pre-commit/mirrors-eslint
53-
rev: v8.26.0
52+
- repo: local
5453
hooks:
5554
- id: eslint
56-
args: [--fix]
57-
types: []
58-
files: (.*.js$|.*.ts$)
59-
additional_dependencies:
60-
- eslint@8.21.0
55+
name: eslint
56+
description: Run eslint from local node_modules
57+
entry: npx eslint --fix
58+
language: system
59+
files: \.(js|ts)$
6160
- repo: local
6261
hooks:
6362
- id: pylint-local

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@amazon-web-services-cloudformation/cloudformation-cli-typescript-lib",
3-
"version": "1.0.6",
3+
"version": "1.0.7",
44
"description": "The CloudFormation Resource Provider Development Kit (RPDK) allows you to author your own resource providers that can be used by CloudFormation. This plugin library helps to provide runtime bindings for the execution of your providers by CloudFormation.",
55
"private": false,
66
"main": "dist/index.js",

pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[build-system]
2+
requires = ["setuptools>=68.0", "wheel"]
3+
build-backend = "setuptools.build_meta"

python/rpdk/typescript/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import logging
22

3-
__version__ = "1.0.4"
3+
__version__ = "1.0.5"
44

55
logging.getLogger(__name__).addHandler(logging.NullHandler())

python/rpdk/typescript/templates/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
},
1515
"dependencies": {
1616
"{{lib_name}}": "{{lib_path}}",
17-
"class-transformer": "0.3.1"
17+
"class-transformer": "0.5.1"
1818
},
1919
"devDependencies": {
2020
"@types/node": "^20.0.0",

setup.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def find_version(*file_paths):
3636
# package_data -> use MANIFEST.in instead
3737
include_package_data=True,
3838
zip_safe=True,
39-
python_requires=">=3.8",
39+
python_requires=">=3.10",
4040
install_requires=[
4141
"cloudformation-cli>=0.1.14",
4242
"zipfile38>=0.0.3,<0.2",
@@ -60,10 +60,9 @@ def find_version(*file_paths):
6060
"Topic :: Software Development :: Code Generators",
6161
"Operating System :: OS Independent",
6262
"Programming Language :: Python :: 3 :: Only",
63-
"Programming Language :: Python :: 3.8",
64-
"Programming Language :: Python :: 3.9",
6563
"Programming Language :: Python :: 3.10",
6664
"Programming Language :: Python :: 3.11",
65+
"Programming Language :: Python :: 3.12",
6766
],
6867
keywords="Amazon Web Services AWS CloudFormation",
6968
)

0 commit comments

Comments
 (0)