declapract-typescript-ehmpathy 0.21.2 → 0.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/practices/cicd-deploy-package/best-practice/.github/workflows/{publish-on-tag.yml → .publish-npm.yml} +7 -12
- package/dist/practices/cicd-deploy-package/best-practice/.github/workflows/publish.yml +21 -0
- package/dist/practices/cicd-deploy-service/best-practice/.github/workflows/.deploy-sls.yml +67 -0
- package/dist/practices/cicd-deploy-service/best-practice/.github/workflows/.sql-schema-control.yml +168 -0
- package/dist/practices/cicd-deploy-service/best-practice/.github/workflows/.terraform.yml +119 -0
- package/dist/practices/cicd-deploy-service/best-practice/.github/workflows/deploy.yml +45 -0
- package/dist/practices/cicd-deploy-service/best-practice/.github/workflows/provision.yml +72 -0
- package/dist/practices/cicd-integrate/best-practice/.github/workflows/{test-on-commit.yml → .test.yml} +50 -84
- package/dist/practices/cicd-integrate/best-practice/.github/workflows/{pr-release-on-main.yml → release.yml} +1 -1
- package/dist/practices/cicd-integrate/best-practice/.github/workflows/test.yml +19 -0
- package/dist/practices/persist-with-rds/best-practice/package.json +2 -2
- package/dist/practices/serverless/best-practice/package.json +2 -1
- package/dist/practices/terraform/best-practice/provision/github/product/repository.tf +8 -8
- package/package.json +3 -2
- package/dist/practices/cicd-deploy-service/best-practice/.github/workflows/deploy-dev-on-main.yml +0 -61
- package/dist/practices/cicd-deploy-service/best-practice/.github/workflows/deploy-prod-on-tag.yml +0 -76
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
name: publish-
|
|
1
|
+
name: .publish-npm
|
|
2
2
|
|
|
3
3
|
on:
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
-
|
|
4
|
+
workflow_call:
|
|
5
|
+
secrets:
|
|
6
|
+
npm-auth-token:
|
|
7
|
+
required: true
|
|
8
|
+
description: required credentials to authenticate with the aws account under which to publish
|
|
7
9
|
|
|
8
10
|
jobs:
|
|
9
|
-
|
|
11
|
+
publish:
|
|
10
12
|
runs-on: ubuntu-20.04
|
|
11
13
|
steps:
|
|
12
14
|
- name: checkout
|
|
13
15
|
uses: actions/checkout@v2
|
|
14
|
-
with:
|
|
15
|
-
fetch-depth: 0 # we need all commits to test:commits
|
|
16
16
|
|
|
17
17
|
- name: read nvmrc
|
|
18
18
|
id: nvmrc
|
|
@@ -28,11 +28,6 @@ jobs:
|
|
|
28
28
|
- name: install
|
|
29
29
|
run: npm ci
|
|
30
30
|
|
|
31
|
-
- name: tests
|
|
32
|
-
run: npm run test
|
|
33
|
-
env:
|
|
34
|
-
FORCE_COLOR: true # ensure colors are saved in jest snapshots, to be consistent with local development
|
|
35
|
-
|
|
36
31
|
- name: publish
|
|
37
32
|
run: npm publish
|
|
38
33
|
env:
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
name: publish
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- v*
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
test:
|
|
10
|
+
uses: ./.github/workflows/.test.yml
|
|
11
|
+
with:
|
|
12
|
+
aws-region: us-east-1
|
|
13
|
+
aws-account-id: '@declapract{variable.awsAccountId.dev}'
|
|
14
|
+
secrets:
|
|
15
|
+
aws-access-key-id: ${{ secrets.DEV_AWS_ACCESS_KEY_ID }}
|
|
16
|
+
aws-secret-access-key: ${{ secrets.DEV_AWS_SECRET_ACCESS_KEY }}
|
|
17
|
+
|
|
18
|
+
publish:
|
|
19
|
+
uses: ./.github/workflows/.publish-npm.yml
|
|
20
|
+
secrets:
|
|
21
|
+
npm-auth-token: ${{ secrets.NPM_TOKEN }}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
name: .deploy-sls
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_call:
|
|
5
|
+
inputs:
|
|
6
|
+
stage:
|
|
7
|
+
type: string
|
|
8
|
+
description: 'the stage to deploy to'
|
|
9
|
+
required: true
|
|
10
|
+
github-environment:
|
|
11
|
+
type: string
|
|
12
|
+
description: 'the github environment that the apply step will be executed in'
|
|
13
|
+
required: true
|
|
14
|
+
aws-region:
|
|
15
|
+
type: string
|
|
16
|
+
description: the aws region within which we should access
|
|
17
|
+
required: true
|
|
18
|
+
aws-account-id:
|
|
19
|
+
type: string
|
|
20
|
+
description: the id of the account the credentials are expected to access
|
|
21
|
+
required: true
|
|
22
|
+
secrets:
|
|
23
|
+
aws-access-key-id:
|
|
24
|
+
required: true
|
|
25
|
+
description: required credentials to authenticate with aws provider and state persistance
|
|
26
|
+
aws-secret-access-key:
|
|
27
|
+
required: true
|
|
28
|
+
description: required credentials to authenticate with aws provider and state persistance
|
|
29
|
+
|
|
30
|
+
jobs:
|
|
31
|
+
plan:
|
|
32
|
+
runs-on: ubuntu-latest
|
|
33
|
+
steps:
|
|
34
|
+
- name: checkout
|
|
35
|
+
uses: actions/checkout@v3
|
|
36
|
+
|
|
37
|
+
- name: read nvmrc
|
|
38
|
+
id: nvmrc
|
|
39
|
+
run: echo ::set-output name=NODE_VERSION::$(cat .nvmrc)
|
|
40
|
+
|
|
41
|
+
- name: set node version
|
|
42
|
+
uses: actions/setup-node@v2
|
|
43
|
+
with:
|
|
44
|
+
node-version: ${{ steps.nvmrc.outputs.NODE_VERSION }}
|
|
45
|
+
|
|
46
|
+
- name: configure aws credentials
|
|
47
|
+
uses: aws-actions/configure-aws-credentials@v1
|
|
48
|
+
id: credentials
|
|
49
|
+
with:
|
|
50
|
+
aws-access-key-id: ${{ secrets.aws-access-key-id }}
|
|
51
|
+
aws-secret-access-key: ${{ secrets.aws-secret-access-key }}
|
|
52
|
+
aws-region: ${{ inputs.aws-region }}
|
|
53
|
+
|
|
54
|
+
- name: confirm aws credentials
|
|
55
|
+
run: |
|
|
56
|
+
[[ ${{steps.credentials.outputs.aws-account-id}} != ${{ inputs.aws-account-id }} ]] \
|
|
57
|
+
&& echo 'wrong aws account' && exit 1 \
|
|
58
|
+
|| echo 'correct aws account';
|
|
59
|
+
|
|
60
|
+
- name: install
|
|
61
|
+
run: npm ci --ignore-scripts
|
|
62
|
+
|
|
63
|
+
- name: deploy
|
|
64
|
+
run: STAGE=${{ inputs.stage }} DEPLOYER_NAME=$GITHUB_ACTOR npm run deploy
|
|
65
|
+
|
|
66
|
+
- name: test:acceptance
|
|
67
|
+
run: STAGE=${{ inputs.stage }} npm run test:acceptance
|
package/dist/practices/cicd-deploy-service/best-practice/.github/workflows/.sql-schema-control.yml
ADDED
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
name: .sql-schema-control
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_call:
|
|
5
|
+
inputs:
|
|
6
|
+
stage:
|
|
7
|
+
type: string
|
|
8
|
+
description: 'the stage to execute against'
|
|
9
|
+
required: true
|
|
10
|
+
github-environment:
|
|
11
|
+
type: string
|
|
12
|
+
description: 'the github environment that the apply step will be executed in'
|
|
13
|
+
allow-apply:
|
|
14
|
+
type: boolean
|
|
15
|
+
description: 'whether the apply step is enabled. defaults to true on main'
|
|
16
|
+
default: ${{ github.ref == 'refs/heads/main' }}
|
|
17
|
+
aws-region:
|
|
18
|
+
type: string
|
|
19
|
+
description: the aws region within which we should access
|
|
20
|
+
aws-account-id:
|
|
21
|
+
type: string
|
|
22
|
+
description: the id of the account the credentials are expected to access
|
|
23
|
+
secrets:
|
|
24
|
+
aws-access-key-id:
|
|
25
|
+
required: true
|
|
26
|
+
description: required credentials to authenticate with aws provider for db credentials
|
|
27
|
+
aws-secret-access-key:
|
|
28
|
+
required: true
|
|
29
|
+
description: required credentials to authenticate with aws provider for db credentials
|
|
30
|
+
open-vpn-config:
|
|
31
|
+
required: true
|
|
32
|
+
description: complete openvpn config required to enter the vpn
|
|
33
|
+
|
|
34
|
+
jobs:
|
|
35
|
+
plan:
|
|
36
|
+
runs-on: ubuntu-latest
|
|
37
|
+
outputs:
|
|
38
|
+
has-changes-planned: ${{ steps.evaluate-plan.output.has-changes-planned }}
|
|
39
|
+
steps:
|
|
40
|
+
- name: checkout
|
|
41
|
+
uses: actions/checkout@v3
|
|
42
|
+
|
|
43
|
+
- name: read nvmrc
|
|
44
|
+
id: nvmrc
|
|
45
|
+
run: echo ::set-output name=NODE_VERSION::$(cat .nvmrc)
|
|
46
|
+
|
|
47
|
+
- name: set node version
|
|
48
|
+
uses: actions/setup-node@v2
|
|
49
|
+
with:
|
|
50
|
+
node-version: ${{ steps.nvmrc.outputs.NODE_VERSION }}
|
|
51
|
+
|
|
52
|
+
- name: install
|
|
53
|
+
run: npm ci --ignore-scripts
|
|
54
|
+
|
|
55
|
+
- name: configure aws credentials
|
|
56
|
+
uses: aws-actions/configure-aws-credentials@v1
|
|
57
|
+
id: credentials
|
|
58
|
+
with:
|
|
59
|
+
aws-access-key-id: ${{ secrets.aws-access-key-id }}
|
|
60
|
+
aws-secret-access-key: ${{ secrets.aws-secret-access-key }}
|
|
61
|
+
aws-region: ${{ inputs.aws-region }}
|
|
62
|
+
|
|
63
|
+
- name: confirm aws credentials
|
|
64
|
+
run: |
|
|
65
|
+
[[ ${{steps.credentials.outputs.aws-account-id}} != ${{ inputs.aws-account-id }} ]] \
|
|
66
|
+
&& echo 'wrong aws account' && exit 1 \
|
|
67
|
+
|| echo 'correct aws account';
|
|
68
|
+
|
|
69
|
+
- name: vpn:prepare
|
|
70
|
+
run: |
|
|
71
|
+
sudo apt update \
|
|
72
|
+
&& sudo apt-get install openvpn openvpn-systemd-resolved \
|
|
73
|
+
&& mkdir ~/.vpn \
|
|
74
|
+
&& echo "${{ secrets.open-vpn-config }}" | base64 -d > ~/.vpn/vpn.connection.ovpn
|
|
75
|
+
|
|
76
|
+
- name: vpn:connect
|
|
77
|
+
run: |
|
|
78
|
+
# create the log file, so that we have permissions to read it
|
|
79
|
+
touch openvpn.log
|
|
80
|
+
|
|
81
|
+
# start openvpn in the background
|
|
82
|
+
sudo openvpn --config ~/.vpn/vpn.connection.ovpn --daemon --log openvpn.log
|
|
83
|
+
|
|
84
|
+
# wait until we've confirmed that it successfully connected; https://superuser.com/a/900134/425694
|
|
85
|
+
( tail -f -n0 openvpn.log & ) | grep -q "Initialization Sequence Completed"
|
|
86
|
+
|
|
87
|
+
- name: plan
|
|
88
|
+
run: STAGE=${{ inputs.stage }} npm run provision:schema:plan | tee ./plan.log
|
|
89
|
+
|
|
90
|
+
- name: evaluate plan
|
|
91
|
+
id: evaluate-plan
|
|
92
|
+
run: |
|
|
93
|
+
# check that there was not a connection error
|
|
94
|
+
if grep "connect ETIMEDOUT" ./plan.log
|
|
95
|
+
then
|
|
96
|
+
echo "🛑 connection timed out, could not execute plan. is vpn working?"
|
|
97
|
+
exit 1
|
|
98
|
+
fi
|
|
99
|
+
|
|
100
|
+
# check whether it said there were required changes
|
|
101
|
+
if grep "Everything is up to date" ./plan.log
|
|
102
|
+
then
|
|
103
|
+
echo "has-changes-planned=false" >> "$GITHUB_OUTPUT"
|
|
104
|
+
else
|
|
105
|
+
echo "has-changes-planned=true" >> "$GITHUB_OUTPUT"
|
|
106
|
+
fi
|
|
107
|
+
|
|
108
|
+
- name: vpn:disconnect
|
|
109
|
+
run: sudo killall openvpn
|
|
110
|
+
|
|
111
|
+
apply:
|
|
112
|
+
runs-on: ubuntu-latest
|
|
113
|
+
environment: ${{ inputs.github-environment }}
|
|
114
|
+
needs: plan
|
|
115
|
+
if: ${{ inputs.allow-apply == true && needs.plan.outputs.has-changes-planned == 'true' }}
|
|
116
|
+
steps:
|
|
117
|
+
- name: checkout
|
|
118
|
+
uses: actions/checkout@v3
|
|
119
|
+
|
|
120
|
+
- name: read nvmrc
|
|
121
|
+
id: nvmrc
|
|
122
|
+
run: echo ::set-output name=NODE_VERSION::$(cat .nvmrc)
|
|
123
|
+
|
|
124
|
+
- name: set node version
|
|
125
|
+
uses: actions/setup-node@v2
|
|
126
|
+
with:
|
|
127
|
+
node-version: ${{ steps.nvmrc.outputs.NODE_VERSION }}
|
|
128
|
+
|
|
129
|
+
- name: install
|
|
130
|
+
run: npm ci --ignore-scripts
|
|
131
|
+
|
|
132
|
+
- name: configure aws credentials
|
|
133
|
+
uses: aws-actions/configure-aws-credentials@v1
|
|
134
|
+
id: credentials
|
|
135
|
+
with:
|
|
136
|
+
aws-access-key-id: ${{ secrets.aws-access-key-id }}
|
|
137
|
+
aws-secret-access-key: ${{ secrets.aws-secret-access-key }}
|
|
138
|
+
aws-region: ${{ inputs.aws-region }}
|
|
139
|
+
|
|
140
|
+
- name: confirm aws credentials
|
|
141
|
+
run: |
|
|
142
|
+
[[ ${{steps.credentials.outputs.aws-account-id}} != ${{ inputs.aws-account-id }} ]] \
|
|
143
|
+
&& echo 'wrong aws account' && exit 1 \
|
|
144
|
+
|| echo 'correct aws account';
|
|
145
|
+
|
|
146
|
+
- name: vpn:prepare
|
|
147
|
+
run: |
|
|
148
|
+
sudo apt update \
|
|
149
|
+
&& sudo apt-get install openvpn openvpn-systemd-resolved \
|
|
150
|
+
&& mkdir ~/.vpn \
|
|
151
|
+
&& echo "${{ secrets.open-vpn-config }}" | base64 -d > ~/.vpn/vpn.connection.ovpn
|
|
152
|
+
|
|
153
|
+
- name: vpn:connect
|
|
154
|
+
run: |
|
|
155
|
+
# create the log file, so that we have permissions to read it
|
|
156
|
+
touch openvpn.log
|
|
157
|
+
|
|
158
|
+
# start openvpn in the background
|
|
159
|
+
sudo openvpn --config ~/.vpn/vpn.connection.ovpn --daemon --log openvpn.log
|
|
160
|
+
|
|
161
|
+
# wait until we've confirmed that it successfully connected; https://superuser.com/a/900134/425694
|
|
162
|
+
( tail -f -n0 openvpn.log & ) | grep -q "Initialization Sequence Completed"
|
|
163
|
+
|
|
164
|
+
- name: apply
|
|
165
|
+
run: STAGE=${{ inputs.stage }} npm run provision:schema:apply
|
|
166
|
+
|
|
167
|
+
- name: vpn:disconnect
|
|
168
|
+
run: sudo killall openvpn
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
name: .terraform
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_call:
|
|
5
|
+
inputs:
|
|
6
|
+
working-directory:
|
|
7
|
+
type: string
|
|
8
|
+
description: 'the directory from within which to execute terraform commands'
|
|
9
|
+
github-environment:
|
|
10
|
+
type: string
|
|
11
|
+
description: 'the github environment that the apply step will be executed in'
|
|
12
|
+
allow-apply:
|
|
13
|
+
type: boolean
|
|
14
|
+
description: 'whether the apply step is enabled. defaults to true on main'
|
|
15
|
+
default: ${{ github.ref == 'refs/heads/main' }}
|
|
16
|
+
aws-region:
|
|
17
|
+
type: string
|
|
18
|
+
description: the aws region within which we should access
|
|
19
|
+
aws-account-id:
|
|
20
|
+
type: string
|
|
21
|
+
description: the id of the account the credentials are expected to access
|
|
22
|
+
secrets:
|
|
23
|
+
aws-access-key-id:
|
|
24
|
+
required: true
|
|
25
|
+
description: required credentials to authenticate with aws provider and state persistance
|
|
26
|
+
aws-secret-access-key:
|
|
27
|
+
required: true
|
|
28
|
+
description: required credentials to authenticate with aws provider and state persistance
|
|
29
|
+
github-token:
|
|
30
|
+
required: false
|
|
31
|
+
description: optional credentials to support authenticating with github provider
|
|
32
|
+
|
|
33
|
+
jobs:
|
|
34
|
+
plan:
|
|
35
|
+
runs-on: ubuntu-latest
|
|
36
|
+
defaults:
|
|
37
|
+
run:
|
|
38
|
+
working-directory: ${{ inputs.working-directory }}
|
|
39
|
+
outputs:
|
|
40
|
+
has-changes-planned: ${{ steps.evaluate-plan.output.has-changes-planned }}
|
|
41
|
+
steps:
|
|
42
|
+
- name: checkout
|
|
43
|
+
uses: actions/checkout@v3
|
|
44
|
+
|
|
45
|
+
- name: configure aws credentials
|
|
46
|
+
uses: aws-actions/configure-aws-credentials@v1
|
|
47
|
+
id: credentials
|
|
48
|
+
with:
|
|
49
|
+
aws-access-key-id: ${{ secrets.aws-access-key-id }}
|
|
50
|
+
aws-secret-access-key: ${{ secrets.aws-secret-access-key }}
|
|
51
|
+
aws-region: ${{ inputs.aws-region }}
|
|
52
|
+
|
|
53
|
+
- name: confirm aws credentials
|
|
54
|
+
run: |
|
|
55
|
+
[[ ${{steps.credentials.outputs.aws-account-id}} != ${{ inputs.aws-account-id }} ]] \
|
|
56
|
+
&& echo 'wrong aws account' && exit 1 \
|
|
57
|
+
|| echo 'correct aws account';
|
|
58
|
+
|
|
59
|
+
- name: setup terraform
|
|
60
|
+
uses: hashicorp/setup-terraform@v2
|
|
61
|
+
|
|
62
|
+
- name: terraform init
|
|
63
|
+
run: terraform init
|
|
64
|
+
|
|
65
|
+
- name: terraform validate
|
|
66
|
+
run: terraform validate
|
|
67
|
+
|
|
68
|
+
- name: terraform plan
|
|
69
|
+
id: plan
|
|
70
|
+
run: terraform plan | tee ./plan.log
|
|
71
|
+
env:
|
|
72
|
+
GITHUB_TOKEN: ${{ secrets.github-token }} # allow specifying a github token to pass to the terraform command
|
|
73
|
+
|
|
74
|
+
- name: evaluate plan
|
|
75
|
+
id: evaluate-plan
|
|
76
|
+
run: |
|
|
77
|
+
if grep "infrastructure matches the configuration" ./plan.log
|
|
78
|
+
then
|
|
79
|
+
echo "has-changes-planned=false" >> "$GITHUB_OUTPUT"
|
|
80
|
+
else
|
|
81
|
+
echo "has-changes-planned=true" >> "$GITHUB_OUTPUT"
|
|
82
|
+
fi
|
|
83
|
+
|
|
84
|
+
apply:
|
|
85
|
+
runs-on: ubuntu-latest
|
|
86
|
+
environment: ${{ inputs.github-environment }}
|
|
87
|
+
needs: plan
|
|
88
|
+
if: ${{ inputs.allow-apply == true && needs.plan.outputs.has-changes-planned == 'true' }}
|
|
89
|
+
defaults:
|
|
90
|
+
run:
|
|
91
|
+
working-directory: ${{ inputs.working-directory }}
|
|
92
|
+
steps:
|
|
93
|
+
- name: checkout
|
|
94
|
+
uses: actions/checkout@v3
|
|
95
|
+
|
|
96
|
+
- name: configure aws credentials
|
|
97
|
+
uses: aws-actions/configure-aws-credentials@v1
|
|
98
|
+
id: credentials
|
|
99
|
+
with:
|
|
100
|
+
aws-access-key-id: ${{ secrets.aws-access-key-id }}
|
|
101
|
+
aws-secret-access-key: ${{ secrets.aws-secret-access-key }}
|
|
102
|
+
aws-region: ${{ inputs.aws-region }}
|
|
103
|
+
|
|
104
|
+
- name: confirm aws credentials
|
|
105
|
+
run: |
|
|
106
|
+
[[ ${{ steps.credentials.outputs.aws-account-id }} != ${{ inputs.aws-account-id }} ]] \
|
|
107
|
+
&& echo 'wrong aws account' && exit 1 \
|
|
108
|
+
|| echo 'correct aws account';
|
|
109
|
+
|
|
110
|
+
- name: setup terraform
|
|
111
|
+
uses: hashicorp/setup-terraform@v2
|
|
112
|
+
|
|
113
|
+
- name: terraform init
|
|
114
|
+
run: terraform init
|
|
115
|
+
|
|
116
|
+
- name: terraform apply
|
|
117
|
+
run: terraform apply
|
|
118
|
+
env:
|
|
119
|
+
GITHUB_TOKEN: ${{ secrets.github-token }} # allow specifying a github token to pass to the terraform command
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
name: deploy
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- v*
|
|
7
|
+
branches:
|
|
8
|
+
- 'main'
|
|
9
|
+
- 'master'
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
test:
|
|
13
|
+
uses: ./.github/workflows/.test.yml
|
|
14
|
+
with:
|
|
15
|
+
aws-region: us-east-1
|
|
16
|
+
aws-account-id: '@declapract{variable.awsAccountId.dev}'
|
|
17
|
+
secrets:
|
|
18
|
+
aws-access-key-id: ${{ secrets.DEV_AWS_ACCESS_KEY_ID }}
|
|
19
|
+
aws-secret-access-key: ${{ secrets.DEV_AWS_SECRET_ACCESS_KEY }}
|
|
20
|
+
|
|
21
|
+
dev:
|
|
22
|
+
uses: ./.github/workflows/.deploy-sls.yml
|
|
23
|
+
if: github.ref == 'refs/heads/main'
|
|
24
|
+
needs: [test]
|
|
25
|
+
with:
|
|
26
|
+
stage: dev
|
|
27
|
+
github-environment: dev
|
|
28
|
+
aws-region: us-east-1
|
|
29
|
+
aws-account-id: '@declapract{variable.awsAccountId.dev}'
|
|
30
|
+
secrets:
|
|
31
|
+
aws-access-key-id: ${{ secrets.DEV_AWS_ACCESS_KEY_ID }}
|
|
32
|
+
aws-secret-access-key: ${{ secrets.DEV_AWS_SECRET_ACCESS_KEY }}
|
|
33
|
+
|
|
34
|
+
prod:
|
|
35
|
+
uses: ./.github/workflows/.deploy-sls.yml
|
|
36
|
+
if: startsWith(github.ref, 'refs/tags/')
|
|
37
|
+
needs: [test]
|
|
38
|
+
with:
|
|
39
|
+
stage: prod
|
|
40
|
+
github-environment: prod
|
|
41
|
+
aws-region: us-east-1
|
|
42
|
+
aws-account-id: '@declapract{variable.awsAccountId.prod}'
|
|
43
|
+
secrets:
|
|
44
|
+
aws-access-key-id: ${{ secrets.PROD_AWS_ACCESS_KEY_ID }}
|
|
45
|
+
aws-secret-access-key: ${{ secrets.PROD_AWS_SECRET_ACCESS_KEY }}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
name: provision
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- v*
|
|
7
|
+
branches:
|
|
8
|
+
- 'main'
|
|
9
|
+
- 'master'
|
|
10
|
+
pull_request:
|
|
11
|
+
workflow_dispatch:
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
aws-dev:
|
|
15
|
+
uses: ./.github/workflows/.terraform.yml
|
|
16
|
+
with:
|
|
17
|
+
working-directory: provision/aws/environments/dev
|
|
18
|
+
github-environment: dev
|
|
19
|
+
aws-region: us-east-1
|
|
20
|
+
aws-account-id: '@declapract{variable.awsAccountId.dev}'
|
|
21
|
+
secrets:
|
|
22
|
+
aws-access-key-id: ${{ secrets.DEV_AWS_ACCESS_KEY_ID }}
|
|
23
|
+
aws-secret-access-key: ${{ secrets.DEV_AWS_SECRET_ACCESS_KEY }}
|
|
24
|
+
|
|
25
|
+
aws-prod:
|
|
26
|
+
uses: ./.github/workflows/.terraform.yml
|
|
27
|
+
with:
|
|
28
|
+
working-directory: provision/aws/environments/prod
|
|
29
|
+
github-environment: prod
|
|
30
|
+
aws-region: us-east-1
|
|
31
|
+
aws-account-id: '@declapract{variable.awsAccountId.prod}'
|
|
32
|
+
allow-apply: ${{ startsWith(github.ref, 'refs/tags/') }} # only apply to prod on tags
|
|
33
|
+
secrets:
|
|
34
|
+
aws-access-key-id: ${{ secrets.PROD_AWS_ACCESS_KEY_ID }}
|
|
35
|
+
aws-secret-access-key: ${{ secrets.PROD_AWS_SECRET_ACCESS_KEY }}
|
|
36
|
+
|
|
37
|
+
github:
|
|
38
|
+
uses: ./.github/workflows/.terraform.yml
|
|
39
|
+
with:
|
|
40
|
+
working-directory: provision/github/environment
|
|
41
|
+
github-environment: prod
|
|
42
|
+
aws-region: us-east-1
|
|
43
|
+
aws-account-id: '@declapract{variable.awsAccountId.prod}'
|
|
44
|
+
secrets:
|
|
45
|
+
aws-access-key-id: ${{ secrets.PROD_AWS_ACCESS_KEY_ID }}
|
|
46
|
+
aws-secret-access-key: ${{ secrets.PROD_AWS_SECRET_ACCESS_KEY }}
|
|
47
|
+
github-token: ${{ secrets.PROVISION_GITHUB_GITHUB_TOKEN }}
|
|
48
|
+
|
|
49
|
+
sql-schema-dev:
|
|
50
|
+
uses: ./.github/workflows/.sql-schema-control.yml
|
|
51
|
+
with:
|
|
52
|
+
stage: dev
|
|
53
|
+
github-environment: dev
|
|
54
|
+
aws-region: us-east-1
|
|
55
|
+
aws-account-id: '@declapract{variable.awsAccountId.dev}'
|
|
56
|
+
secrets:
|
|
57
|
+
aws-access-key-id: ${{ secrets.DEV_AWS_ACCESS_KEY_ID }}
|
|
58
|
+
aws-secret-access-key: ${{ secrets.DEV_AWS_SECRET_ACCESS_KEY }}
|
|
59
|
+
open-vpn-config: ${{ secrets.DEV_OPEN_VPN_CONFIG }}
|
|
60
|
+
|
|
61
|
+
sql-schema-prod:
|
|
62
|
+
uses: ./.github/workflows/.sql-schema-control.yml
|
|
63
|
+
with:
|
|
64
|
+
stage: prod
|
|
65
|
+
github-environment: prod
|
|
66
|
+
aws-region: us-east-1
|
|
67
|
+
aws-account-id: '@declapract{variable.awsAccountId.prod}'
|
|
68
|
+
allow-apply: ${{ startsWith(github.ref, 'refs/tags/') }} # only apply to prod on tags
|
|
69
|
+
secrets:
|
|
70
|
+
aws-access-key-id: ${{ secrets.PROD_AWS_ACCESS_KEY_ID }}
|
|
71
|
+
aws-secret-access-key: ${{ secrets.PROD_AWS_SECRET_ACCESS_KEY }}
|
|
72
|
+
open-vpn-config: ${{ secrets.PROD_OPEN_VPN_CONFIG }}
|
|
@@ -1,19 +1,27 @@
|
|
|
1
|
-
name: test
|
|
1
|
+
name: .test
|
|
2
2
|
|
|
3
3
|
on:
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
4
|
+
workflow_call:
|
|
5
|
+
inputs:
|
|
6
|
+
aws-region:
|
|
7
|
+
type: string
|
|
8
|
+
description: the aws region within which we should run the tests
|
|
9
|
+
required: true
|
|
10
|
+
aws-account-id:
|
|
11
|
+
type: string
|
|
12
|
+
description: the id of the account the credentials are expected to access
|
|
13
|
+
required: true
|
|
14
|
+
secrets:
|
|
15
|
+
aws-access-key-id:
|
|
16
|
+
required: true
|
|
17
|
+
description: required credentials to authenticate with aws the aws account against which to run the tests
|
|
18
|
+
aws-secret-access-key:
|
|
19
|
+
required: true
|
|
20
|
+
description: required credentials to authenticate with aws the aws account against which to run the tests
|
|
13
21
|
|
|
14
22
|
jobs:
|
|
15
23
|
install:
|
|
16
|
-
runs-on: ubuntu-
|
|
24
|
+
runs-on: ubuntu-latest
|
|
17
25
|
steps:
|
|
18
26
|
- name: checkout
|
|
19
27
|
uses: actions/checkout@v2
|
|
@@ -22,14 +30,13 @@ jobs:
|
|
|
22
30
|
id: nvmrc
|
|
23
31
|
run: echo ::set-output name=NODE_VERSION::$(cat .nvmrc)
|
|
24
32
|
|
|
25
|
-
- name:
|
|
33
|
+
- name: set node version
|
|
26
34
|
uses: actions/setup-node@v2
|
|
27
35
|
with:
|
|
28
36
|
node-version: ${{ steps.nvmrc.outputs.NODE_VERSION }}
|
|
29
|
-
cache: 'npm'
|
|
30
37
|
|
|
31
38
|
- name: install
|
|
32
|
-
run: npm ci
|
|
39
|
+
run: npm ci --ignore-scripts
|
|
33
40
|
|
|
34
41
|
- name: cache node modules
|
|
35
42
|
uses: actions/cache@v2
|
|
@@ -39,7 +46,7 @@ jobs:
|
|
|
39
46
|
|
|
40
47
|
# run tests in parallel
|
|
41
48
|
test-commits:
|
|
42
|
-
runs-on: ubuntu-
|
|
49
|
+
runs-on: ubuntu-latest
|
|
43
50
|
needs: [install]
|
|
44
51
|
steps:
|
|
45
52
|
- name: checkout
|
|
@@ -51,11 +58,10 @@ jobs:
|
|
|
51
58
|
id: nvmrc
|
|
52
59
|
run: echo ::set-output name=NODE_VERSION::$(cat .nvmrc)
|
|
53
60
|
|
|
54
|
-
- name:
|
|
61
|
+
- name: set node version
|
|
55
62
|
uses: actions/setup-node@v2
|
|
56
63
|
with:
|
|
57
64
|
node-version: ${{ steps.nvmrc.outputs.NODE_VERSION }}
|
|
58
|
-
cache: 'npm'
|
|
59
65
|
|
|
60
66
|
- name: grab node_modules from cache
|
|
61
67
|
uses: actions/cache@v2
|
|
@@ -67,7 +73,7 @@ jobs:
|
|
|
67
73
|
run: npm run test:commits
|
|
68
74
|
|
|
69
75
|
test-types:
|
|
70
|
-
runs-on: ubuntu-
|
|
76
|
+
runs-on: ubuntu-latest
|
|
71
77
|
needs: [install]
|
|
72
78
|
steps:
|
|
73
79
|
- name: checkout
|
|
@@ -77,11 +83,10 @@ jobs:
|
|
|
77
83
|
id: nvmrc
|
|
78
84
|
run: echo ::set-output name=NODE_VERSION::$(cat .nvmrc)
|
|
79
85
|
|
|
80
|
-
- name:
|
|
86
|
+
- name: set node version
|
|
81
87
|
uses: actions/setup-node@v2
|
|
82
88
|
with:
|
|
83
89
|
node-version: ${{ steps.nvmrc.outputs.NODE_VERSION }}
|
|
84
|
-
cache: 'npm'
|
|
85
90
|
|
|
86
91
|
- name: grab node_modules from cache
|
|
87
92
|
uses: actions/cache@v2
|
|
@@ -93,7 +98,7 @@ jobs:
|
|
|
93
98
|
run: npm run test:types
|
|
94
99
|
|
|
95
100
|
test-format:
|
|
96
|
-
runs-on: ubuntu-
|
|
101
|
+
runs-on: ubuntu-latest
|
|
97
102
|
needs: [install]
|
|
98
103
|
steps:
|
|
99
104
|
- name: checkout
|
|
@@ -103,11 +108,10 @@ jobs:
|
|
|
103
108
|
id: nvmrc
|
|
104
109
|
run: echo ::set-output name=NODE_VERSION::$(cat .nvmrc)
|
|
105
110
|
|
|
106
|
-
- name:
|
|
111
|
+
- name: set node version
|
|
107
112
|
uses: actions/setup-node@v2
|
|
108
113
|
with:
|
|
109
114
|
node-version: ${{ steps.nvmrc.outputs.NODE_VERSION }}
|
|
110
|
-
cache: 'npm'
|
|
111
115
|
|
|
112
116
|
- name: grab node_modules from cache
|
|
113
117
|
uses: actions/cache@v2
|
|
@@ -119,7 +123,7 @@ jobs:
|
|
|
119
123
|
run: npm run test:format
|
|
120
124
|
|
|
121
125
|
test-lint:
|
|
122
|
-
runs-on: ubuntu-
|
|
126
|
+
runs-on: ubuntu-latest
|
|
123
127
|
needs: [install]
|
|
124
128
|
steps:
|
|
125
129
|
- name: checkout
|
|
@@ -129,11 +133,10 @@ jobs:
|
|
|
129
133
|
id: nvmrc
|
|
130
134
|
run: echo ::set-output name=NODE_VERSION::$(cat .nvmrc)
|
|
131
135
|
|
|
132
|
-
- name:
|
|
136
|
+
- name: set node version
|
|
133
137
|
uses: actions/setup-node@v2
|
|
134
138
|
with:
|
|
135
139
|
node-version: ${{ steps.nvmrc.outputs.NODE_VERSION }}
|
|
136
|
-
cache: 'npm'
|
|
137
140
|
|
|
138
141
|
- name: grab node_modules from cache
|
|
139
142
|
uses: actions/cache@v2
|
|
@@ -145,7 +148,7 @@ jobs:
|
|
|
145
148
|
run: npm run test:lint
|
|
146
149
|
|
|
147
150
|
test-unit:
|
|
148
|
-
runs-on: ubuntu-
|
|
151
|
+
runs-on: ubuntu-latest
|
|
149
152
|
needs: [install]
|
|
150
153
|
steps:
|
|
151
154
|
- name: checkout
|
|
@@ -155,11 +158,10 @@ jobs:
|
|
|
155
158
|
id: nvmrc
|
|
156
159
|
run: echo ::set-output name=NODE_VERSION::$(cat .nvmrc)
|
|
157
160
|
|
|
158
|
-
- name:
|
|
161
|
+
- name: set node version
|
|
159
162
|
uses: actions/setup-node@v2
|
|
160
163
|
with:
|
|
161
164
|
node-version: ${{ steps.nvmrc.outputs.NODE_VERSION }}
|
|
162
|
-
cache: 'npm'
|
|
163
165
|
|
|
164
166
|
- name: grab node_modules from cache
|
|
165
167
|
uses: actions/cache@v2
|
|
@@ -169,11 +171,9 @@ jobs:
|
|
|
169
171
|
|
|
170
172
|
- name: test:unit
|
|
171
173
|
run: npm run test:unit
|
|
172
|
-
env:
|
|
173
|
-
FORCE_COLOR: true # ensure colors are saved in jest snapshots, to be consistent with local development
|
|
174
174
|
|
|
175
175
|
test-integration:
|
|
176
|
-
runs-on: ubuntu-
|
|
176
|
+
runs-on: ubuntu-latest
|
|
177
177
|
needs: [install]
|
|
178
178
|
steps:
|
|
179
179
|
- name: checkout
|
|
@@ -183,11 +183,10 @@ jobs:
|
|
|
183
183
|
id: nvmrc
|
|
184
184
|
run: echo ::set-output name=NODE_VERSION::$(cat .nvmrc)
|
|
185
185
|
|
|
186
|
-
- name:
|
|
186
|
+
- name: set node version
|
|
187
187
|
uses: actions/setup-node@v2
|
|
188
188
|
with:
|
|
189
189
|
node-version: ${{ steps.nvmrc.outputs.NODE_VERSION }}
|
|
190
|
-
cache: 'npm'
|
|
191
190
|
|
|
192
191
|
- name: grab node_modules from cache
|
|
193
192
|
uses: actions/cache@v2
|
|
@@ -199,20 +198,24 @@ jobs:
|
|
|
199
198
|
uses: aws-actions/configure-aws-credentials@v1
|
|
200
199
|
id: credentials
|
|
201
200
|
with:
|
|
202
|
-
aws-access-key-id: ${{ secrets.
|
|
203
|
-
aws-secret-access-key: ${{ secrets.
|
|
201
|
+
aws-access-key-id: ${{ secrets.aws-access-key-id }}
|
|
202
|
+
aws-secret-access-key: ${{ secrets.aws-secret-access-key }}
|
|
204
203
|
aws-region: us-east-1
|
|
205
204
|
|
|
205
|
+
- name: confirm aws credentials
|
|
206
|
+
run: |
|
|
207
|
+
[[ ${{steps.credentials.outputs.aws-account-id}} != ${{ inputs.aws-account-id }} ]] \
|
|
208
|
+
&& echo 'wrong aws account' && exit 1 \
|
|
209
|
+
|| echo 'correct aws account';
|
|
210
|
+
|
|
206
211
|
- name: provision:integration-test-db
|
|
207
212
|
run: npm run provision:integration-test-db
|
|
208
213
|
|
|
209
214
|
- name: test:integration
|
|
210
215
|
run: npm run test:integration
|
|
211
|
-
env:
|
|
212
|
-
FORCE_COLOR: true # ensure colors are saved in jest snapshots, to be consistent with local development
|
|
213
216
|
|
|
214
217
|
test-acceptance-locally:
|
|
215
|
-
runs-on: ubuntu-
|
|
218
|
+
runs-on: ubuntu-latest
|
|
216
219
|
needs: [install]
|
|
217
220
|
steps:
|
|
218
221
|
- name: checkout
|
|
@@ -222,11 +225,10 @@ jobs:
|
|
|
222
225
|
id: nvmrc
|
|
223
226
|
run: echo ::set-output name=NODE_VERSION::$(cat .nvmrc)
|
|
224
227
|
|
|
225
|
-
- name:
|
|
228
|
+
- name: set node version
|
|
226
229
|
uses: actions/setup-node@v2
|
|
227
230
|
with:
|
|
228
231
|
node-version: ${{ steps.nvmrc.outputs.NODE_VERSION }}
|
|
229
|
-
cache: 'npm'
|
|
230
232
|
|
|
231
233
|
- name: grab node_modules from cache
|
|
232
234
|
uses: actions/cache@v2
|
|
@@ -238,54 +240,18 @@ jobs:
|
|
|
238
240
|
uses: aws-actions/configure-aws-credentials@v1
|
|
239
241
|
id: credentials
|
|
240
242
|
with:
|
|
241
|
-
aws-access-key-id: ${{ secrets.
|
|
242
|
-
aws-secret-access-key: ${{ secrets.
|
|
243
|
-
aws-region: us-east-1
|
|
244
|
-
|
|
245
|
-
- name: provision:integration-test-db
|
|
246
|
-
run: npm run provision:integration-test-db
|
|
247
|
-
|
|
248
|
-
- name: test:acceptance:locally
|
|
249
|
-
run: npm run test:acceptance:locally
|
|
250
|
-
env:
|
|
251
|
-
FORCE_COLOR: true # ensure colors are saved in jest snapshots, to be consistent with local development
|
|
252
|
-
|
|
253
|
-
check-provisions-github:
|
|
254
|
-
runs-on: ubuntu-20.04
|
|
255
|
-
defaults:
|
|
256
|
-
run:
|
|
257
|
-
working-directory: ./provision/github/environment
|
|
258
|
-
steps:
|
|
259
|
-
- name: checkout
|
|
260
|
-
uses: actions/checkout@v2
|
|
261
|
-
|
|
262
|
-
- name: setup terraform
|
|
263
|
-
uses: hashicorp/setup-terraform@v1
|
|
264
|
-
|
|
265
|
-
- name: configure aws credentials
|
|
266
|
-
uses: aws-actions/configure-aws-credentials@v1
|
|
267
|
-
id: credentials
|
|
268
|
-
with:
|
|
269
|
-
aws-access-key-id: ${{ secrets.PROD_AWS_ACCESS_KEY_ID }}
|
|
270
|
-
aws-secret-access-key: ${{ secrets.PROD_AWS_SECRET_ACCESS_KEY }}
|
|
243
|
+
aws-access-key-id: ${{ secrets.aws-access-key-id }}
|
|
244
|
+
aws-secret-access-key: ${{ secrets.aws-secret-access-key }}
|
|
271
245
|
aws-region: us-east-1
|
|
272
246
|
|
|
273
247
|
- name: confirm aws credentials
|
|
274
248
|
run: |
|
|
275
|
-
[[ ${{steps.credentials.outputs.aws-account-id}} !=
|
|
249
|
+
[[ ${{steps.credentials.outputs.aws-account-id}} != ${{ inputs.aws-account-id }} ]] \
|
|
276
250
|
&& echo 'wrong aws account' && exit 1 \
|
|
277
251
|
|| echo 'correct aws account';
|
|
278
252
|
|
|
279
|
-
- name:
|
|
280
|
-
|
|
281
|
-
run: terraform init
|
|
282
|
-
|
|
283
|
-
- name: terraform validate
|
|
284
|
-
id: validate
|
|
285
|
-
run: terraform validate -no-color
|
|
253
|
+
- name: provision:integration-test-db
|
|
254
|
+
run: npm run provision:integration-test-db
|
|
286
255
|
|
|
287
|
-
- name:
|
|
288
|
-
|
|
289
|
-
run: terraform plan -no-color -detailed-exitcode
|
|
290
|
-
env:
|
|
291
|
-
GITHUB_TOKEN: ${{ secrets.PROVISION_GITHUB_GITHUB_TOKEN }}
|
|
256
|
+
- name: test:acceptance:locally
|
|
257
|
+
run: npm run test:acceptance:locally
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
name: test
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_call:
|
|
5
|
+
push:
|
|
6
|
+
branches-ignore:
|
|
7
|
+
- 'main' # exclude main branch, since deploy workflow triggers on main, and calls the test workflow inside of it already
|
|
8
|
+
tags-ignore:
|
|
9
|
+
- v* # exclude tags, since deploy workflow triggers on tags, and calls the test workflow inside of it already
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
suite:
|
|
13
|
+
uses: ./.github/workflows/.test.yml
|
|
14
|
+
with:
|
|
15
|
+
aws-region: us-east-1
|
|
16
|
+
aws-account-id: '@declapract{variable.awsAccountId.dev}'
|
|
17
|
+
secrets:
|
|
18
|
+
aws-access-key-id: ${{ secrets.DEV_AWS_ACCESS_KEY_ID }}
|
|
19
|
+
aws-secret-access-key: ${{ secrets.DEV_AWS_SECRET_ACCESS_KEY }}
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
},
|
|
14
14
|
"scripts": {
|
|
15
15
|
"generate:dao": "npx sql-dao-generator generate && npm run fix:format",
|
|
16
|
-
"generate:schema": "npx sql-schema-generator generate -c codegen.sql.schema.yml",
|
|
17
|
-
"generate:types-from-sql": "npx sql-code-generator generate -c codegen.sql.types.yml",
|
|
16
|
+
"generate:schema": "npx sql-schema-generator generate -c codegen.sql.schema.yml && npm run fix:format",
|
|
17
|
+
"generate:types-from-sql": "npx sql-code-generator generate -c codegen.sql.types.yml && npm run fix:format",
|
|
18
18
|
"provision:docker:clear": "docker rm -f $(docker ps -a -f 'publish=7821' -q) 2>/dev/null || true && echo 'ensured port is available 👍'",
|
|
19
19
|
"provision:docker:up": "docker-compose -f ./provision/docker/integration-test-db/docker-compose.yml up -d --force-recreate --build --renew-anon-volumes",
|
|
20
20
|
"provision:docker:await": "docker-compose -f ./provision/docker/integration-test-db/docker-compose.yml exec -T postgres /root/wait-for-postgres.sh",
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
"deploy:release": "npm run build && sls deploy --verbose --stage $STAGE",
|
|
7
7
|
"deploy:send-notification": "curl -X POST -H 'Content-type: application/json' --data \"{\\\"text\\\":\\\"$([ -z $DEPLOYER_NAME ] && git config user.name || echo $DEPLOYER_NAME) has deployed $npm_package_name@v$npm_package_version:\nhttps://github.com/@declapract{variable.organizationName}/$npm_package_name/tree/v$npm_package_version\\\"}\" @declapract{variable.slackWebhookUrl}",
|
|
8
8
|
"deploy:dev": "STAGE=dev npm run deploy:release",
|
|
9
|
-
"deploy:prod": "STAGE=prod npm run deploy:release && npm run deploy:send-notification"
|
|
9
|
+
"deploy:prod": "STAGE=prod npm run deploy:release && npm run deploy:send-notification",
|
|
10
|
+
"deploy": "if-env STAGE=prod && npm run deploy:prod || if-env STAGE=dev && npm run deploy:dev || echo '🛑 invalid STAGE, must be prod or dev'"
|
|
10
11
|
}
|
|
11
12
|
}
|
|
@@ -52,18 +52,18 @@ resource "github_branch_protection" "main_branch" {
|
|
|
52
52
|
enforce_admins = true # yes, even admins need to follow this (note: they can still take the time to go and change the settings temporarily for the exceptions)
|
|
53
53
|
allows_deletions = false # dont allow the `main` branch to be deleted
|
|
54
54
|
allows_force_pushes = false # dont allow `main` branch to be force pushed to
|
|
55
|
-
required_linear_history = true
|
|
55
|
+
required_linear_history = true # no ugly merge commits, woo! 🎉
|
|
56
56
|
|
|
57
57
|
required_status_checks {
|
|
58
58
|
strict = true # branch must be up to date. otherwise, we dont know if it will really pass once it is merged
|
|
59
59
|
contexts = [
|
|
60
|
-
"test-commits",
|
|
61
|
-
"test-types",
|
|
62
|
-
"test-format",
|
|
63
|
-
"test-lint",
|
|
64
|
-
"test-unit",
|
|
65
|
-
"test-integration",
|
|
66
|
-
"test-acceptance-locally"
|
|
60
|
+
"suite / test-commits",
|
|
61
|
+
"suite / test-types",
|
|
62
|
+
"suite / test-format",
|
|
63
|
+
"suite / test-lint",
|
|
64
|
+
"suite / test-unit",
|
|
65
|
+
"suite / test-integration",
|
|
66
|
+
"suite / test-acceptance-locally"
|
|
67
67
|
]
|
|
68
68
|
}
|
|
69
69
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "declapract-typescript-ehmpathy",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.22.0",
|
|
4
4
|
"description": "declapract best practices declarations for typescript",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"repository": "ehmpathy/declapract-typescript-ehmpathy",
|
|
@@ -34,12 +34,13 @@
|
|
|
34
34
|
"domain-objects": "0.7.5",
|
|
35
35
|
"dynamodb-dao-generator": "1.0.0",
|
|
36
36
|
"expect": "29.4.2",
|
|
37
|
+
"flat": "5.0.2",
|
|
37
38
|
"lodash.uniq": "4.5.0",
|
|
38
39
|
"type-fns": "0.7.0",
|
|
39
40
|
"uuid": "3.4.0"
|
|
40
41
|
},
|
|
41
42
|
"peerDependencies": {
|
|
42
|
-
"declapract": "~0.10.
|
|
43
|
+
"declapract": "~0.10.10"
|
|
43
44
|
},
|
|
44
45
|
"devDependencies": {
|
|
45
46
|
"@commitlint/cli": "13.1.0",
|
package/dist/practices/cicd-deploy-service/best-practice/.github/workflows/deploy-dev-on-main.yml
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
name: deploy-dev-on-main
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
branches: # only on main branch
|
|
6
|
-
- 'main'
|
|
7
|
-
- 'master'
|
|
8
|
-
|
|
9
|
-
concurrency:
|
|
10
|
-
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
|
11
|
-
cancel-in-progress: true
|
|
12
|
-
|
|
13
|
-
jobs:
|
|
14
|
-
test-and-deploy:
|
|
15
|
-
runs-on: ubuntu-20.04
|
|
16
|
-
steps:
|
|
17
|
-
- name: checkout
|
|
18
|
-
uses: actions/checkout@v2
|
|
19
|
-
with:
|
|
20
|
-
fetch-depth: 0 # we need all commits to test:commits
|
|
21
|
-
|
|
22
|
-
- name: read nvmrc
|
|
23
|
-
id: nvmrc
|
|
24
|
-
run: echo ::set-output name=NODE_VERSION::$(cat .nvmrc)
|
|
25
|
-
|
|
26
|
-
- name: setup node
|
|
27
|
-
uses: actions/setup-node@v2
|
|
28
|
-
with:
|
|
29
|
-
node-version: ${{ steps.nvmrc.outputs.NODE_VERSION }}
|
|
30
|
-
cache: 'npm'
|
|
31
|
-
|
|
32
|
-
- name: install
|
|
33
|
-
run: npm ci
|
|
34
|
-
|
|
35
|
-
- name: configure aws credentials
|
|
36
|
-
uses: aws-actions/configure-aws-credentials@v1
|
|
37
|
-
id: credentials
|
|
38
|
-
with:
|
|
39
|
-
aws-access-key-id: ${{ secrets.DEV_AWS_ACCESS_KEY_ID }}
|
|
40
|
-
aws-secret-access-key: ${{ secrets.DEV_AWS_SECRET_ACCESS_KEY }}
|
|
41
|
-
aws-region: us-east-1
|
|
42
|
-
|
|
43
|
-
- name: confirm aws credentials
|
|
44
|
-
run: |
|
|
45
|
-
[[ ${{steps.credentials.outputs.aws-account-id}} != '@declapract{variable.awsAccountId.dev}' ]] \
|
|
46
|
-
&& echo 'wrong aws account' && exit 1 \
|
|
47
|
-
|| echo 'correct aws account';
|
|
48
|
-
|
|
49
|
-
- name: provision:integration-test-db
|
|
50
|
-
run: npm run provision:integration-test-db
|
|
51
|
-
|
|
52
|
-
- name: test
|
|
53
|
-
run: npm run test
|
|
54
|
-
env:
|
|
55
|
-
FORCE_COLOR: true # ensure colors are saved in jest snapshots, to be consistent with local development
|
|
56
|
-
|
|
57
|
-
- name: deploy
|
|
58
|
-
run: DEPLOYER_NAME=$GITHUB_ACTOR npm run deploy:dev
|
|
59
|
-
|
|
60
|
-
- name: test:acceptance
|
|
61
|
-
run: STAGE=dev npm run test:acceptance
|
package/dist/practices/cicd-deploy-service/best-practice/.github/workflows/deploy-prod-on-tag.yml
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
name: deploy-prod-on-tag
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
tags:
|
|
6
|
-
- v*
|
|
7
|
-
|
|
8
|
-
concurrency:
|
|
9
|
-
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
|
10
|
-
cancel-in-progress: true
|
|
11
|
-
|
|
12
|
-
jobs:
|
|
13
|
-
test-and-deploy:
|
|
14
|
-
runs-on: ubuntu-20.04
|
|
15
|
-
steps:
|
|
16
|
-
- name: checkout
|
|
17
|
-
uses: actions/checkout@v2
|
|
18
|
-
with:
|
|
19
|
-
fetch-depth: 0 # we need all commits to test:commits
|
|
20
|
-
|
|
21
|
-
- name: read nvmrc
|
|
22
|
-
id: nvmrc
|
|
23
|
-
run: echo ::set-output name=NODE_VERSION::$(cat .nvmrc)
|
|
24
|
-
|
|
25
|
-
- name: setup node
|
|
26
|
-
uses: actions/setup-node@v2
|
|
27
|
-
with:
|
|
28
|
-
node-version: ${{ steps.nvmrc.outputs.NODE_VERSION }}
|
|
29
|
-
cache: 'npm'
|
|
30
|
-
|
|
31
|
-
- name: install
|
|
32
|
-
run: npm ci
|
|
33
|
-
|
|
34
|
-
# test in dev env
|
|
35
|
-
- name: configure aws credentials
|
|
36
|
-
uses: aws-actions/configure-aws-credentials@v1
|
|
37
|
-
id: credentials-dev
|
|
38
|
-
with:
|
|
39
|
-
aws-access-key-id: ${{ secrets.DEV_AWS_ACCESS_KEY_ID }}
|
|
40
|
-
aws-secret-access-key: ${{ secrets.DEV_AWS_SECRET_ACCESS_KEY }}
|
|
41
|
-
aws-region: us-east-1
|
|
42
|
-
|
|
43
|
-
- name: confirm aws credentials
|
|
44
|
-
run: |
|
|
45
|
-
[[ ${{steps.credentials-dev.outputs.aws-account-id}} != '@declapract{variable.awsAccountId.dev}' ]] \
|
|
46
|
-
&& echo 'wrong aws account' && exit 1 \
|
|
47
|
-
|| echo 'correct aws account';
|
|
48
|
-
|
|
49
|
-
- name: provision:integration-test-db
|
|
50
|
-
run: npm run provision:integration-test-db
|
|
51
|
-
|
|
52
|
-
- name: test
|
|
53
|
-
run: npm run test
|
|
54
|
-
env:
|
|
55
|
-
FORCE_COLOR: true # ensure colors are saved in jest snapshots, to be consistent with local development
|
|
56
|
-
|
|
57
|
-
# deploy in prod env
|
|
58
|
-
- name: configure aws credentials
|
|
59
|
-
uses: aws-actions/configure-aws-credentials@v1
|
|
60
|
-
id: credentials-prod
|
|
61
|
-
with:
|
|
62
|
-
aws-access-key-id: ${{ secrets.PROD_AWS_ACCESS_KEY_ID }}
|
|
63
|
-
aws-secret-access-key: ${{ secrets.PROD_AWS_SECRET_ACCESS_KEY }}
|
|
64
|
-
aws-region: us-east-1
|
|
65
|
-
|
|
66
|
-
- name: confirm aws credentials
|
|
67
|
-
run: |
|
|
68
|
-
[[ ${{steps.credentials-prod.outputs.aws-account-id}} != '@declapract{variable.awsAccountId.prod}' ]] \
|
|
69
|
-
&& echo 'wrong aws account' && exit 1 \
|
|
70
|
-
|| echo 'correct aws account';
|
|
71
|
-
|
|
72
|
-
- name: deploy
|
|
73
|
-
run: DEPLOYER_NAME=$GITHUB_ACTOR npm run deploy:prod
|
|
74
|
-
|
|
75
|
-
- name: test:acceptance
|
|
76
|
-
run: STAGE=prod npm run test:acceptance
|