Skip to content

Commit

Permalink
breaking: Version 2.0.0 (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
NickLiffen authored Apr 19, 2021
1 parent 90f9707 commit 15421eb
Show file tree
Hide file tree
Showing 34 changed files with 15,846 additions and 189 deletions.
8 changes: 0 additions & 8 deletions .dockerignore

This file was deleted.

1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dist/
13 changes: 13 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"env": {
"commonjs": true,
"es6": true,
"jest": true,
"node": true
},
"extends": "eslint:recommended",
"parserOptions": {
"ecmaVersion": 2018
},
"rules": {}
}
5 changes: 2 additions & 3 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@ updates:
schedule:
interval: "weekly"

# Enable version updates for Docker
- package-ecosystem: "docker"
# Look for a `Dockerfile` in the `root` directory
# Enable version updates for npm
- package-ecosystem: "npm"
directory: "/"
# Check for updates once a week
schedule:
Expand Down
34 changes: 34 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: "CodeQL"

on:
push:
branches: [ main, v* ]
pull_request:
branches: [ main, v* ]
schedule:
- cron: '38 18 * * 3'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
language: [ 'javascript' ]

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}

- name: Autobuild
uses: github/codeql-action/autobuild@v1

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
127 changes: 54 additions & 73 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,82 +1,63 @@
name: CI

name: "Tests"
on:
push:
branches:
- master # Push events on master branch
pull_request: # Run tests for any PRs

env:
IMAGE_NAME: cfn-lint-action

branches:
- main
- ft/2.0.0
pull_request:
jobs:
# Run tests.
test:
unit:
name: npm test
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Docker build
run: docker build . --file Dockerfile --tag image

- name: Docker run
run: docker run --entrypoint cfn-lint image -v

lint:
# Name the Job
name: Lint Code Base
# Set the agent to run on
runs-on: ubuntu-latest

##################
# Load all steps #
##################
- uses: actions/setup-node@v2
- run: npm ci
- run: npm test
integ:
strategy:
fail-fast: false
matrix:
os:
- ubuntu-18.04
- ubuntu-20.04
- windows-2016
- windows-2019
- macos-10.15
name: ${{ matrix.os }}
runs-on: ${{ matrix.os }}
steps:
##########################
# Checkout the code base #
##########################
- name: Checkout Code
# Step 1
- name: Git Checkout
uses: actions/checkout@v2

################################
# Run Linter against code base #
################################
- name: Lint Code Base
uses: docker://github/super-linter:v2.2.0
env:
VALIDATE_ALL_CODEBASE: true

# Push image to GitHub Packages.
# See also https://docs.docker.com/docker-hub/builds/
push:
# Ensure test job passes before pushing image.
needs: test

runs-on: ubuntu-latest
if: github.event_name == 'push'

steps:
- uses: actions/checkout@v2

- name: Build image
run: docker build . --file Dockerfile --tag $IMAGE_NAME

- name: Log into GitHub Container Registry
run: echo "${{ secrets.CFN_CR_PAT }}" | docker login https://ghcr.io -u ${{ github.actor }} --password-stdin

- name: Push image to GitHub Container Registry
# Step 2
- name: Setup Cloud Formation Linter with Latest Version
uses: ./
# Step 3
- name: Print the Cloud Formation Linter Version & run Linter.
run: |
cfn-lint --version
cfn-lint -t ./examples/template.yml
# Step 4
- name: Setup Cloud Formation Linter with Specific Version
uses: ./
with:
version: "0.44.5"
# Step 5
- name: Print the Cloud Formation Linter Version & run Linter.
run: |
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME
# Change all uppercase to lowercase
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
SHA="${{ github.sha }}"
# Strip git ref prefix from version
REF=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
echo IMAGE_ID=$IMAGE_ID
echo SHA=$SHA
echo REF=$REF
docker tag $IMAGE_NAME $IMAGE_ID:$SHA
docker tag $IMAGE_NAME $IMAGE_ID:$REF
docker push $IMAGE_ID:$SHA
docker push $IMAGE_ID:$REF
cfn-lint --version
cfn-lint -t ./examples/template.yml
# Step 6
### Testing specifying a version and command
- name: Testing with CFN Lint Version & Command
uses: ./
with:
command: cfn-lint -t ./examples/template.yml
version: "0.44.5"
# Step 7
### Testing specifying a version and command
- name: Testing with CFN Lint Command
uses: ./
with:
command: cfn-lint -t ./examples/template.yml
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
coverage
1 change: 1 addition & 0 deletions .husky/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx lint-staged
5 changes: 5 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules
coverage
dist
examples
.github
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [2.0.0](https://github.com/ScottBrenner/cfn-lint-action/releases/tag/v2.0.0)

### Added

- GitHub Action is now written in JavaScript.
- Unit Tests (90% Coverage).
- User can now specify any command they need to run.

### Removed

- The default functionality to run a command.
23 changes: 0 additions & 23 deletions Dockerfile

This file was deleted.

Loading

0 comments on commit 15421eb

Please sign in to comment.