From f29ed651844ce5911462051318d7b77215e8ae3d Mon Sep 17 00:00:00 2001 From: Phil Chen Date: Sun, 26 May 2024 14:51:11 -0700 Subject: [PATCH] Adding Testing and Badging --- .../workflows/cloudformation-validation.yml | 28 +++++++++++++++++++ .travis.yml | 25 ----------------- README.md | 2 +- encrypted-s3-cf-template.yml | 3 +- 4 files changed, 31 insertions(+), 27 deletions(-) create mode 100644 .github/workflows/cloudformation-validation.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/cloudformation-validation.yml b/.github/workflows/cloudformation-validation.yml new file mode 100644 index 0000000..04b6d6a --- /dev/null +++ b/.github/workflows/cloudformation-validation.yml @@ -0,0 +1,28 @@ +name: CloudFormation Validation + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: CloudFormation Template Validation + run: | + pip install awscli + aws cloudformation validate-template --template-body file://encrypted-s3-cf-template.yml --region us-east-1 + env: + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + - name: CloudFormation Linter + run: | + pip install cfn-lint + cfn-lint -I encrypted-s3-cf-template.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index bedf791..0000000 --- a/.travis.yml +++ /dev/null @@ -1,25 +0,0 @@ -language: ruby - -git: - submodules: false - -env: - global: - - AWS_DEFAULT_REGION=us-east-2 - -before_install: - - echo "Installing AWS CLI" - - pip install --upgrade --user awscli - - echo "Installing test gems" - - gem install yaml-lint - -install: true - -script: - - aws cloudformation validate-template --template-body file://encrypted-s3-cf-template.yml - - yaml-lint encrypted-s3-cf-template.yml - -after_success: - - echo "Test Success - Branch($TRAVIS_BRANCH) Pull Request($TRAVIS_PULL_REQUEST) Tag($TRAVIS_TAG)" - - echo "Cloudformation template validated" - - echo "YAML linted" diff --git a/README.md b/README.md index 9660717..b6e7527 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # aws-encrypted-s3-cf-template -[![Build Status](https://travis-ci.org/getcft/aws-encrypted-s3-cf-template.svg?branch=master)](https://travis-ci.org/getcft/aws-encrypted-s3-cf-template) +[![CloudFormation Validation](https://github.com/getcft/aws-encrypted-s3-cf-template/actions/workflows/cloudformation-validation.yml/badge.svg)](https://github.com/getcft/aws-encrypted-s3-cf-template//actions/workflows/cloudformation-validation.yml) ## Description: diff --git a/encrypted-s3-cf-template.yml b/encrypted-s3-cf-template.yml index b89a81c..f4b98f7 100644 --- a/encrypted-s3-cf-template.yml +++ b/encrypted-s3-cf-template.yml @@ -1,4 +1,4 @@ -# Copyright [2018] [Phil Chen] +# Copyright [2024] [Phil Chen] # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -54,6 +54,7 @@ Resources: S3GeneralBucket: Type: AWS::S3::Bucket DeletionPolicy: Retain + UpdateReplacePolicy: Retain Properties: BucketEncryption: ServerSideEncryptionConfiguration: