Skip to content

Commit 3fb243f

Browse files
committed
Initial commit
0 parents  commit 3fb243f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+3390
-0
lines changed

.eslintignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules

.eslintrc.js

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
module.exports = {
2+
"extends": ["eslint:recommended"],
3+
"plugins": [],
4+
"parserOptions": {},
5+
"env": {
6+
"browser": false,
7+
"es6": true,
8+
"node": true,
9+
"mocha": true
10+
},
11+
"globals": {},
12+
"rules":{
13+
"indent": [
14+
"error",
15+
4
16+
],
17+
"linebreak-style": [
18+
"error",
19+
"unix"
20+
],
21+
"quotes": [
22+
"error",
23+
"single"
24+
],
25+
"semi": [
26+
"error",
27+
"never"
28+
],
29+
"no-console":0
30+
}
31+
}

.gitignore

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Node/NPM/YARN
2+
## Logs
3+
logs
4+
*.log
5+
npm-debug.log*
6+
yarn-debug.log*
7+
yarn-error.log*
8+
## Dependency directories
9+
node_modules
10+
## Optional npm cache directory
11+
.npm
12+
## dotenv environment variables file
13+
.env
14+
## Optional eslint cache
15+
.eslintcache
16+
17+
# AWS SAM
18+
## Transformed templates' directory
19+
.sam/*
20+
!.gitkeep
21+
22+
# Application parameters
23+
env/*
24+
!env/example.env
25+
26+
# IDE
27+
.vscode

.sam/.gitkeep

Whitespace-only changes.

.yarnclean

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# test directories
2+
__tests__
3+
test
4+
tests
5+
powered-test
6+
7+
# asset directories
8+
docs
9+
doc
10+
website
11+
images
12+
assets
13+
14+
# examples
15+
example
16+
examples
17+
18+
# code coverage directories
19+
coverage
20+
.nyc_output
21+
22+
# build scripts
23+
Makefile
24+
Gulpfile.js
25+
Gruntfile.js
26+
27+
# configs
28+
.tern-project
29+
.gitattributes
30+
.editorconfig
31+
.*ignore
32+
.eslintrc
33+
.jshintrc
34+
.flowconfig
35+
.documentup.json
36+
.yarn-metadata.json
37+
.*.yml
38+
*.yml
39+
40+
# misc
41+
*.gz
42+
*.md

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2017 toricls
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

Makefile

+83
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
##################################################################
2+
#
3+
# Makefile for building tabiiku-batch and packaging docker image.
4+
#
5+
# General usage:
6+
# - make help
7+
# - make build
8+
# - make test ENV_FILE_PATH=env/example.env
9+
# - make package ENV_FILE_PATH=env/example.env
10+
# - make deploy ENV_FILE_PATH=env/example.env
11+
# - make destroy ENV_FILE_PATH=env/example.env
12+
# - make clean
13+
#
14+
##################################################################
15+
include $(ENV_FILE_PATH)
16+
export $$(shell sed 's/=.*//' $(ENV_FILE_PATH))
17+
18+
.PHONY: help build test package deploy destroy clean
19+
.DEFAULT_GOAL := help
20+
21+
build: dependency-dev ## Install all dependencies including development packages
22+
23+
test: validate-envvars validate dependency-dev lint-code unit-test ## Validating and linting CloudFormation templates and Lambda functions
24+
25+
validate-envvars: # Test if required environment variables exist
26+
ifeq ($(GITHUB_REPOSITORY_URL),)
27+
$(error missing the 'GITHUB_REPOSITORY_URL' environment variable, or 'ENV_FILE_PATH' does not exist)
28+
endif
29+
ifeq ($(GITHUB_PERSONAL_ACCESS_TOKEN),)
30+
$(error missing the 'GITHUB_PERSONAL_ACCESS_TOKEN' environment variable, or 'ENV_FILE_PATH' does not exist)
31+
endif
32+
ifeq ($(GITHUB_TARGET_RESOURCE),)
33+
$(error missing the 'GITHUB_TARGET_RESOURCE' environment variable, or 'ENV_FILE_PATH' does not exist)
34+
endif
35+
ifeq ($(AWS_DEFAULT_REGION),)
36+
$(error missing the 'AWS_DEFAULT_REGION' environment variable, or 'ENV_FILE_PATH' does not exist)
37+
endif
38+
ifeq ($(CODEBUILD_PROJECT_NAME),)
39+
$(error missing the 'CODEBUILD_PROJECT_NAME' environment variable, or 'ENV_FILE_PATH' does not exist)
40+
endif
41+
ifeq ($(CODEBUILD_PROJECT_REGION),)
42+
$(error missing the 'CODEBUILD_PROJECT_REGION' environment variable, or 'ENV_FILE_PATH' does not exist)
43+
endif
44+
45+
validate:
46+
@./scripts/validate $(ENV_FILE_PATH)
47+
48+
dependency:
49+
@./scripts/dependency production
50+
51+
dependency-dev:
52+
@./scripts/dependency
53+
54+
lint-code:
55+
@./scripts/lint
56+
57+
unit-test:
58+
@./scripts/test
59+
60+
package: validate-envvars validate clean dependency package-sam ## Install all dependencies and package stuffs
61+
62+
package-sam:
63+
ifeq ($(S3_SAM_ARTIFACTS_BUCKET_NAME),)
64+
$(error missing the 'S3_SAM_ARTIFACTS_BUCKET_NAME' environment variable, or 'ENV_FILE_PATH' does not exist)
65+
endif
66+
@./scripts/package $(S3_SAM_ARTIFACTS_BUCKET_NAME) $(CODEBUILD_PROJECT_NAME)
67+
68+
deploy: package deploy-sam ## Deploy all CloudFormation templates and Lambda functions
69+
70+
deploy-sam:
71+
ifeq ($(S3_SAM_ARTIFACTS_BUCKET_NAME),)
72+
$(error missing the 'S3_SAM_ARTIFACTS_BUCKET_NAME' environment variable, or 'ENV_FILE_PATH' does not exist)
73+
endif
74+
@./scripts/deploy $(ENV_FILE_PATH)
75+
76+
clean: ## Remove local generated files and dependencies
77+
@./scripts/clean
78+
79+
destroy: ## Remove provisioned resources on AWS
80+
@./scripts/destroy $(ENV_FILE_PATH)
81+
82+
help:
83+
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-10s\033[0m %s\n", $$1, $$2}'

0 commit comments

Comments
 (0)