Skip to content

Commit

Permalink
Re-initiate branch
Browse files Browse the repository at this point in the history
  • Loading branch information
berviantoleo committed Apr 14, 2024
0 parents commit 8c6869a
Show file tree
Hide file tree
Showing 26 changed files with 1,025 additions and 0 deletions.
41 changes: 41 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
version: 2

updates:
- package-ecosystem: nuget
directory: "/"
schedule:
interval: weekly
day: saturday
time: "08:00"
timezone: Asia/Jakarta
open-pull-requests-limit: 100
reviewers:
- berviantoleo
assignees:
- berviantoleo

- package-ecosystem: github-actions
directory: "/"
schedule:
interval: weekly
day: saturday
time: "08:00"
timezone: Asia/Jakarta
open-pull-requests-limit: 100
reviewers:
- berviantoleo
assignees:
- berviantoleo

- package-ecosystem: terraform
directory: "/"
schedule:
interval: weekly
day: saturday
time: "08:00"
timezone: Asia/Jakarta
open-pull-requests-limit: 100
reviewers:
- berviantoleo
assignees:
- berviantoleo
139 changes: 139 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
name: Deploy
on:
push:
branches: [ main ]
tags:
- v*
pull_request:
env:
IMAGE_NAME: 'lambda-sharp'
PROJECT_ID: ${{ secrets.AWS_ACCOUNT_ID }}
jobs:
build:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Setup .NET Core SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: '7.0.x'
- name: .NET Restore
run: dotnet restore
- name: Build
run: dotnet build --no-restore
build-push-docker:
runs-on: ubuntu-22.04
if: ${{ github.event_name == 'push' }}
permissions:
id-token: write # This is required for requesting the JWT
contents: read
steps:
- uses: actions/checkout@v4
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4 # More information on this action can be found below in the 'AWS Credentials' section
with:
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
role-session-name: ${{ secrets.AWS_ROLE_SESSION_NAME }}
aws-region: 'ap-southeast-1'
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2
with:
registries: ${{ secrets.AWS_ACCOUNT_ID }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.ECR_REGISTRY }}/${{ env.IMAGE_NAME }}
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
- name: Build and push Docker images
uses: docker/build-push-action@v5
with:
context: src/SimpleAPI
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
terraform-deploy:
name: 'Terraform Deploy'
needs: build-push-docker
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Terraform
uses: hashicorp/setup-terraform@v3
with:
cli_config_credentials_token: ${{ secrets.TF_API_TOKEN }}
- name: Terraform Format
id: fmt
run: terraform fmt -check
working-directory: ./terraform
- name: Terraform Init
id: init
run: terraform init
working-directory: ./terraform
- name: Terraform Validate
id: validate
run: terraform validate -no-color
working-directory: ./terraform
- name: Terraform Apply
working-directory: ./terraform
run: terraform apply -auto-approve
terraform-test:
name: 'Terraform Test'
needs: build
if: github.event_name == 'pull_request'
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Terraform
uses: hashicorp/setup-terraform@v3
with:
cli_config_credentials_token: ${{ secrets.TF_API_TOKEN }}
- name: Terraform Format
id: fmt
run: terraform fmt -check
working-directory: ./terraform
- name: Terraform Init
id: init
run: terraform init
working-directory: ./terraform
- name: Terraform Validate
id: validate
run: terraform validate -no-color
working-directory: ./terraform
- name: Terraform Plan
id: plan
run: terraform plan -no-color
continue-on-error: true
working-directory: ./terraform
- name: Update Pull Request
uses: actions/github-script@v7.0.1
if: github.event_name == 'pull_request'
env:
PLAN: "terraform\n${{ steps.plan.outputs.stdout }}"
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const output = `#### Terraform Format and Style 🖌\`${{ steps.fmt.outcome }}\`
#### Terraform Initialization ⚙️\`${{ steps.init.outcome }}\`
#### Terraform Plan 📖\`${{ steps.plan.outcome }}\`
#### Terraform Validation 🤖\`${{ steps.validate.outcome }}\`
<details><summary>Show Plan</summary>
\`\`\`\n
${process.env.PLAN}
\`\`\`
</details>
*Pusher: @${{ github.actor }}, Action: \`${{ github.event_name }}\`*`;
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: output
})
- name: Terraform Plan Status
if: steps.plan.outcome == 'failure'
run: exit 1
73 changes: 73 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
*.swp
*.*~
project.lock.json
.DS_Store
*.pyc
nupkg/

# Visual Studio Code
.vscode

# Rider
.idea

# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates

# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
build/
bld/
[Bb]in/
[Oo]bj/
[Oo]ut/
msbuild.log
msbuild.err
msbuild.wrn

# Visual Studio 2015
.vs/
.env.sh

# Local .terraform directories
**/.terraform/*

# .tfstate files
*.tfstate
*.tfstate.*

# Crash log files
crash.log
crash.*.log

# Exclude all .tfvars files, which are likely to contain sensitive data, such as
# password, private keys, and other secrets. These should not be part of version
# control as they are data points which are potentially sensitive and subject
# to change depending on the environment.
*.tfvars
*.tfvars.json

# Ignore override files as they are usually used to override resources locally and so
# are not checked in
override.tf
override.tf.json
*_override.tf
*_override.tf.json

# Include override files you do wish to add to version control using negated pattern
# !example_override.tf

# Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan
# example: *tfplan*

# Ignore CLI configuration files
.terraformrc
terraform.rc
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2022 Bervianto Leo Pratama's Personal Projects

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Lambda Sharp Demo

Demo for Lambda Containerized .NET

# LICENSE

MIT
40 changes: 40 additions & 0 deletions lambda-sharp.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30114.105
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SimpleAPI", "SimpleAPI", "{2E234498-6EE8-4B2B-B32A-27AB1BC077DB}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{598E8886-0B06-41D5-9C01-3051B8140B9F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SimpleAPI", "src\SimpleAPI\SimpleAPI.csproj", "{4609928B-A222-40EF-AE6F-D19194D3E612}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{2A5F88CD-8FF7-48D1-B824-9813D4857FD7}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SimpleAPI.Tests", "test\SimpleAPI.Tests\SimpleAPI.Tests.csproj", "{42649AD6-E83C-491C-90C1-E81DA72C0907}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{4609928B-A222-40EF-AE6F-D19194D3E612}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4609928B-A222-40EF-AE6F-D19194D3E612}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4609928B-A222-40EF-AE6F-D19194D3E612}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4609928B-A222-40EF-AE6F-D19194D3E612}.Release|Any CPU.Build.0 = Release|Any CPU
{42649AD6-E83C-491C-90C1-E81DA72C0907}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{42649AD6-E83C-491C-90C1-E81DA72C0907}.Debug|Any CPU.Build.0 = Debug|Any CPU
{42649AD6-E83C-491C-90C1-E81DA72C0907}.Release|Any CPU.ActiveCfg = Release|Any CPU
{42649AD6-E83C-491C-90C1-E81DA72C0907}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{598E8886-0B06-41D5-9C01-3051B8140B9F} = {2E234498-6EE8-4B2B-B32A-27AB1BC077DB}
{4609928B-A222-40EF-AE6F-D19194D3E612} = {598E8886-0B06-41D5-9C01-3051B8140B9F}
{2A5F88CD-8FF7-48D1-B824-9813D4857FD7} = {2E234498-6EE8-4B2B-B32A-27AB1BC077DB}
{42649AD6-E83C-491C-90C1-E81DA72C0907} = {2A5F88CD-8FF7-48D1-B824-9813D4857FD7}
EndGlobalSection
EndGlobal

0 comments on commit 8c6869a

Please sign in to comment.