Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
5f6b4c0
feat: story/GD-40 unit tests added
videki Mar 22, 2023
f4fc091
feat: story/GD-40 unit tests added
videki Mar 22, 2023
f6a313c
feat: story/GD-40 unit tests added
videki Mar 22, 2023
7244090
feat: story/GD-40 unit tests added
videki Mar 22, 2023
1524b26
feat: story/GD-40 unit tests added
videki Mar 22, 2023
3faf6a0
feat: story/GD-40 unit tests added
videki Mar 22, 2023
0c93676
feat: story/GD-40 unit tests added
videki Mar 22, 2023
482cdef
feat: story/GD-40 unit tests added
videki Mar 22, 2023
ccc66ea
feat: story/GD-40 unit tests added
videki Mar 22, 2023
feddb75
feat: story/GD-40 unit tests added
videki Mar 22, 2023
85109b6
feat: story/GD-40 unit tests added
videki Mar 22, 2023
28d5e07
feat: story/GD-40 unit tests added
videki Mar 22, 2023
30a6b9c
feat: story/GD-40 unit tests added
videki Mar 22, 2023
6bb8ee9
feat: story/GD-40 unit tests added
videki Mar 22, 2023
38b6ffd
feat: story/GD-40 unit tests added
videki Mar 22, 2023
f7a54c9
feat: story/GD-40 unit tests added
videki Mar 22, 2023
3b9a07a
feat: story/GD-40 unit tests added
videki Mar 22, 2023
923b70d
feat: story/GD-40 unit tests added
videki Mar 22, 2023
7f36424
feat: story/GD-40 unit tests added
videki Mar 22, 2023
b86b99f
feat: story/GD-40 unit tests added
videki Mar 22, 2023
835880d
feat: story/GD-40 unit tests added
videki Mar 22, 2023
4b308b3
feat: story/GD-40 unit tests added
videki Mar 22, 2023
dd9f513
ci: story/GD-40 sonarcloud integration init
videki Mar 22, 2023
36767d0
ci: story/GD-40 sonarcloud integration init
videki Mar 22, 2023
c75beae
ci: story/GD-40 sonarcloud integration init
videki Mar 22, 2023
90df6ad
build: story/GD-40 eslint fixes
videki Mar 26, 2023
c885746
build: story/GD-40 re-adding babel config
videki Mar 26, 2023
c86ad8c
ci: story/GD-40 docker pull-back fix
videki Mar 26, 2023
ffbb427
ci: story/GD-40 gh action deprecation fixes
videki Mar 26, 2023
042329e
ci: story/GD-40 gh action deprecation fixes - trivy
videki Mar 26, 2023
bc6fb92
ci: story/GD-40 gh cache usage added
videki Mar 26, 2023
3d9dbfc
ci: story/GD-40 ecr upload added
videki Mar 26, 2023
0b859c5
ci: story/GD-40 ecr upload added
videki Mar 26, 2023
56b7dd3
ci: story/GD-40 ecr upload added
videki Mar 26, 2023
a326dea
ci: story/GD-40 docker build fixes
videki Mar 26, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 0 additions & 79 deletions .eslintrc

This file was deleted.

14 changes: 14 additions & 0 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
env:
browser: true
es2021: true
extends:
- eslint:recommended
- plugin:@typescript-eslint/recommended
overrides: []
parser: '@typescript-eslint/parser'
parserOptions:
ecmaVersion: latest
sourceType: module
plugins:
- '@typescript-eslint'
rules: {}
230 changes: 230 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,230 @@
name: Build

on:
push:
branches: [ "main", release/*, story/*, task/* ]
paths:
- 'src/**'
- 'events/**'
- 'tests/**'
- 'package.json'
- '.github/workflows/**'
pull_request:
# branches: [ "main" ]
types: [opened, synchronize, reopened]
paths:
- 'src/**'
- 'events/**'
- 'tests/**'
- 'package.json'
workflow_dispatch:

env:
API_DOCKER_REGISTRY: ghcr.io
API_DOCKER_IMAGE_NAME: ${{ github.repository_owner }}/docs-func-aws-template-list-v1

permissions:
pull-requests: read # allows SonarCloud to decorate PRs with analysis results

jobs:
build_job:
name: Build
runs-on: ubuntu-latest

steps:
- name: Git checkout
uses: actions/checkout@v3

- name: Install node v18
uses: actions/setup-node@v3
with:
node-version: 18

- name: Cache node modules
id: cache-npm
uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
path: |
'**/node_modules'
key: ${{ runner.os }}-yarn-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-${{ env.cache-name }}-
${{ runner.os }}-yarn-
${{ runner.os }}-

- name: Yarn install
run: yarn install

- name: Yarn build
run: yarn build

test_job:
name: Run tests
needs: build_job
runs-on: ubuntu-latest
environment: ci

steps:
- name: Git checkout
uses: actions/checkout@v3

- name: Cache node modules
id: cache-npm
uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
path: |
'**/node_modules'
key: ${{ runner.os }}-yarn-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-${{ env.cache-name }}-
${{ runner.os }}-yarn-
${{ runner.os }}-

- name: Yarn install
run: yarn install

- name: Build project
run: yarn build

- name: Run tests
env:
REPOSITORY_TEMPLATE_PROVIDER_AWS_S3_BUCKETNAME: ${{ secrets.TEST_AWS_BUCKETNAME }}
REPOSITORY_TEMPLATE_PROVIDER_AWS_S3_REGION: ${{ secrets.TEST_AWS_REGION }}
REPOSITORY_TEMPLATE_PROVIDER_AWS_S3_PREFIX: ${{ secrets.TEST_AWS_BUCKET_PREFIX }}

AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
run: yarn test

analyze_job:
name: Code analysis
needs:
- build_job
- test_job
runs-on: ubuntu-latest
environment: ci

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis

- name: Cache node modules
id: cache-npm
uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
path: |
'**/node_modules'
key: ${{ runner.os }}-yarn-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-${{ env.cache-name }}-
${{ runner.os }}-yarn-
${{ runner.os }}-

- name: Yarn install
run: yarn install

- name: Build project
run: yarn build

- name: Run tests
env:
REPOSITORY_TEMPLATE_PROVIDER_AWS_S3_BUCKETNAME: ${{ secrets.TEST_AWS_BUCKETNAME }}
REPOSITORY_TEMPLATE_PROVIDER_AWS_S3_REGION: ${{ secrets.TEST_AWS_REGION }}
REPOSITORY_TEMPLATE_PROVIDER_AWS_S3_PREFIX: ${{ secrets.TEST_AWS_BUCKET_PREFIX }}

AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
run: yarn test -- --coverage

- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets. SONAR_TOKEN }}

docker_build_job:
name: Containerize
needs:
- analyze_job
# if: github.ref == 'refs/heads/main'
permissions:
contents: read # for actions/checkout to fetch code
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
actions: read # only required for a private repository by gitHub/codeql-action/upload-sarif to get the Action run status
packages: write
runs-on: ubuntu-latest
environment: ci
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis

- name: Cache node modules
id: cache-npm
uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
path: |
'**/node_modules'
key: ${{ runner.os }}-yarn-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-${{ env.cache-name }}-
${{ runner.os }}-yarn-
${{ runner.os }}-

- name: Yarn install
run: yarn install

- name: Build project
run: yarn build

# - name: Set up QEMU
# uses: docker/setup-qemu-action@v2
#
# - name: Set up Docker Buildx
# uses: docker/setup-buildx-action@v2

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.TEST_AWS_REGION }}

- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1

- name: Build and push Docker image
# with:
# context: .
env:
REGISTRY: ${{ steps.login-ecr.outputs.registry }}
REPOSITORY: docs-func-template-list-v1
IMAGE_TAG: ${{ github.sha }}
run: |
docker build -t $REGISTRY/$REPOSITORY:$IMAGE_TAG .
docker push $REGISTRY/$REPOSITORY:$IMAGE_TAG

- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@master
with:
image-ref: '${{ steps.meta.outputs.tags }}'
format: 'template'
template: '@/contrib/sarif.tpl'
output: 'trivy-results.sarif'
severity: 'CRITICAL,HIGH'

- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: 'trivy-results.sarif'

4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,10 @@ dist
# SAM directories
.aws-sam
aws-toolkit-ts-output
aws-toolkit-tsconfig.json
built
gen

.husky


/src/.openapi-generator/
/src/api/
/src/model/
Expand Down
4 changes: 4 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx --no-install commitlint --edit ""
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 --no-install lint-staged
4 changes: 4 additions & 0 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx --no-install validate-branch-name
7 changes: 3 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
FROM public.ecr.aws/lambda/nodejs:18
WORKDIR ${LAMBDA_TASK_ROOT}

COPY app.ts package*.json ./
COPY dist/* ./

#RUN npm install
RUN npm ci --production
CMD ["index.handler"]

CMD ["app.lambdaHandler"]
Loading