diff --git a/.github/workflows/ci.yml b/.github/workflows/lint.yml similarity index 56% rename from .github/workflows/ci.yml rename to .github/workflows/lint.yml index cd02d20..261ab52 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/lint.yml @@ -1,29 +1,24 @@ -name: CI - -on: [push, pull_request] - +name: Lint +on: + push: + branches: [master] + pull_request: jobs: build: - runs-on: 'ubuntu-latest' - + runs-on: ['ubuntu-latest'] steps: - - uses: 'actions/checkout@v2' - - uses: 'actions/setup-python@v2' with: python-version: '3.8' - - name: yamlllint run: | - pip install yamllint==1.26.3 + pip install yamllint==1.35.1 yamllint module.yml && yamllint test/*.yml - - name: cfn-lint run: | - pip install cfn-lint==0.59.1 - cfn-lint -i W3002 -t module.yml && cfn-lint -t test/*.yml - + pip install cfn-lint==1.20.1 + cfn-lint -i W3002 W1011 -t module.yml && cfn-lint -i W3002 W1011 -t test/*.yml - name: license run: | grep -q "LICENSE-2.0" module.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..9e7fe70 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,30 @@ +name: Test +on: + push: + branches: [master] + pull_request: +permissions: + id-token: write + contents: read +concurrency: + group: test + cancel-in-progress: false +jobs: + build: + runs-on: ['ubuntu-latest'] + steps: + - uses: 'actions/checkout@v2' + - uses: aws-actions/configure-aws-credentials@v4 + with: + role-to-assume: 'arn:aws:iam::068189904525:role/github-openid-connect' + aws-region: 'eu-west-1' + - uses: actions/setup-node@v4 + with: + node-version: '18.x' + - name: test + run: | + npm ci + cd test + npm ci + CFN_PACKAGE_BUCKET_NAME=cf-templates-1a2zmgbg9ut4o-eu-west-1 npm test + cd - \ No newline at end of file diff --git a/module.yml b/module.yml index 312a769..7bf2823 100644 --- a/module.yml +++ b/module.yml @@ -144,6 +144,7 @@ Conditions: HasReservedConcurrentExecutions: !Not [!Equals [!Ref ReservedConcurrentExecutions, -1]] HasVpcModule: !Not [!Equals [!Ref VpcModule, '']] HasFunctionName: !Not [!Equals [!Ref FunctionName, '']] + HasDescription: !Not [!Equals [!Ref Description, '']] HasDependencyModule1: !Not [!Equals [!Ref DependencyModule1, '']] HasDependencyModule2: !Not [!Equals [!Ref DependencyModule2, '']] HasDependencyModule3: !Not [!Equals [!Ref DependencyModule3, '']] @@ -236,7 +237,7 @@ Resources: Properties: Code: '../../../lambda-src/' # we can not make this a parameter because `aws cloudformation package` does not take parameters into account DeadLetterConfig: !If [HasDeadLetterQueueModule, {TargetArn: {'Fn::ImportValue': !Sub '${DeadLetterQueueModule}-Arn'}}, !Ref 'AWS::NoValue'] - Description: !Ref Description + Description: !If [HasDescription, !Ref Description, !Ref AWS::NoValue] Environment: Variables: VARIABLE1: !Ref EnvironmentVariable1 diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..e7c35e6 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,13 @@ +{ + "name": "@cfn-modules/lambda-function", + "version": "2.10.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "@cfn-modules/lambda-function", + "version": "2.10.0", + "license": "Apache-2.0" + } + } +} diff --git a/test/defaults.yml b/test/defaults.yml index fb42645..2bb319e 100644 --- a/test/defaults.yml +++ b/test/defaults.yml @@ -7,5 +7,5 @@ Resources: Properties: Parameters: Handler: 'defaults.handler' - Runtime: 'nodejs16.x' + Runtime: 'nodejs22.x' TemplateURL: './node_modules/@cfn-modules/lambda-function/module.yml' diff --git a/test/layer.yml b/test/layer.yml index 71b3d65..0029490 100644 --- a/test/layer.yml +++ b/test/layer.yml @@ -18,6 +18,6 @@ Resources: Properties: Parameters: Handler: 'defaults.handler' - Runtime: 'nodejs16.x' + Runtime: 'nodejs22.x' LayerArns: !Ref Layer TemplateURL: './node_modules/@cfn-modules/lambda-function/module.yml' diff --git a/test/named.yml b/test/named.yml index 22134c1..729aa19 100644 --- a/test/named.yml +++ b/test/named.yml @@ -7,6 +7,6 @@ Resources: Properties: Parameters: Handler: 'defaults.handler' - Runtime: 'nodejs16.x' + Runtime: 'nodejs22.x' FunctionName: 'NamedLambda' TemplateURL: './node_modules/@cfn-modules/lambda-function/module.yml'