Skip to content

Commit 4dd2f95

Browse files
committed
delete comments
rebase master
1 parent 301182c commit 4dd2f95

File tree

1 file changed

+138
-0
lines changed

1 file changed

+138
-0
lines changed
Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
name: time-tracker-ui-ci
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
pull_request:
9+
branches:
10+
- master
11+
12+
jobs:
13+
ci:
14+
runs-on: ubuntu-latest
15+
env:
16+
WORKING_DIR: infrastructure/
17+
DB_CONNECTION: ${{ secrets.DB_CONNECTION }}
18+
ARM_CLIENT_ID: ${{secrets.TF_ARM_CLIENT_ID}}
19+
ARM_CLIENT_SECRET: ${{secrets.TF_ARM_CLIENT_SECRET}}
20+
ARM_SUBSCRIPTION_ID: ${{secrets.TF_ARM_SUBSCRIPTION_ID}}
21+
ARM_TENANT_ID: ${{secrets.TF_ARM_TENANT_ID}}
22+
strategy:
23+
max-parallel: 5
24+
steps:
25+
- name: Checkout
26+
uses: actions/checkout@v3
27+
28+
- name: Authenticate with the TF modules repository
29+
uses: webfactory/[email protected]
30+
with:
31+
ssh-private-key: ${{ secrets.INFRA_TERRAFORM_MODULES_SSH_PRIV_KEY }}
32+
33+
- name: build docker
34+
run: make build
35+
36+
- name: Inject Secrets
37+
env:
38+
SCOPES: ${{ secrets.SCOPES }}
39+
CLIENT_ID: ${{ secrets.CLIENT_ID }}
40+
AUTHORITY: ${{ secrets.AUTHORITY }}
41+
STACK_EXCHANGE_ID: ${{ secrets.STACK_EXCHANGE_ID }}
42+
STACK_EXCHANGE_ACCESS_TOKEN: ${{ secrets.STACK_EXCHANGE_ACCESS_TOKEN }}
43+
AZURE_APP_CONFIGURATION_CONNECTION_STRING: ${{ secrets.AZURE_APP_CONFIGURATION_CONNECTION_STRING }}
44+
run: |
45+
chmod +x ./scripts/populate-keys.sh
46+
sh ./scripts/populate-keys.sh
47+
48+
- name: Running tests
49+
run: |
50+
chmod -R 777 ./$home
51+
make test
52+
- name: Generate coverage report
53+
env:
54+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
55+
run: bash <(curl -s https://codecov.io/bash)
56+
57+
- name: Setup terraform
58+
uses: hashicorp/setup-terraform@v1
59+
60+
- name: 'Terraform Init'
61+
id: init
62+
working-directory: ./${{ env.WORKING_DIR }}
63+
run: terraform init
64+
65+
- name: 'Terraform validate'
66+
id: validate
67+
working-directory: ./${{ env.WORKING_DIR }}
68+
run: terraform validate
69+
70+
- name: Terraform Plan Stage
71+
id: plan-stage
72+
if: github.event_name == 'pull_request'
73+
run: terraform plan -var-file=${{ env.TF_WORKSPACE }}.tfvars -var image_tag=latest -no-color
74+
continue-on-error: true
75+
working-directory: ./${{ env.WORKING_DIR }}
76+
env:
77+
TF_WORKSPACE: stage
78+
79+
- name: Terraform Plan Prod
80+
id: plan-prod
81+
if: github.event_name == 'pull_request'
82+
run: terraform plan -var-file=${{ env.TF_WORKSPACE }}.tfvars -no-color
83+
continue-on-error: true
84+
working-directory: ./${{ env.WORKING_DIR }}
85+
env:
86+
TF_WORKSPACE: prod
87+
88+
- name: Update Pull Request with Stage Plan
89+
uses: actions/[email protected]
90+
if: github.event_name == 'pull_request'
91+
env:
92+
PLAN: "terraform\n${{ steps.plan-stage.outputs.stdout }}"
93+
TF_WORKSPACE: stage
94+
with:
95+
github-token: ${{ secrets.GITHUB_TOKEN }}
96+
script: |
97+
const output = `#### [${{ env.WORKING_DIR }}][${{ env.TF_WORKSPACE }}] Terraform Plan 📖 \`${{ steps.plan-stage.outcome }}\`
98+
<details><summary>Show Plan</summary>
99+
\`\`\`\n
100+
${process.env.PLAN}
101+
\`\`\`
102+
</details>
103+
*Pusher: @${{ github.actor }}, Action: \`${{ github.event_name }}\`*`;
104+
github.issues.createComment({
105+
issue_number: context.issue.number,
106+
owner: context.repo.owner,
107+
repo: context.repo.repo,
108+
body: output
109+
})
110+
- name: Update Pull Request with Prod Plan
111+
uses: actions/[email protected]
112+
if: github.event_name == 'pull_request'
113+
env:
114+
PLAN: "terraform\n${{ steps.plan-prod.outputs.stdout }}"
115+
TF_WORKSPACE: prod
116+
with:
117+
github-token: ${{ secrets.GITHUB_TOKEN }}
118+
script: |
119+
const output = `#### [${{ env.WORKING_DIR }}][${{ env.TF_WORKSPACE }}] Terraform Plan 📖 \`${{ steps.plan-prod.outcome }}\`
120+
<details><summary>Show Plan</summary>
121+
\`\`\`\n
122+
${process.env.PLAN}
123+
\`\`\`
124+
</details>
125+
*Pusher: @${{ github.actor }}, Action: \`${{ github.event_name }}\`*`;
126+
github.issues.createComment({
127+
issue_number: context.issue.number,
128+
owner: context.repo.owner,
129+
repo: context.repo.repo,
130+
body: output
131+
})
132+
- name: Terraform Plan Stage Status
133+
if: steps.plan-stage.outcome == 'failure'
134+
run: exit 1
135+
136+
- name: Terraform Plan Prod Status
137+
if: steps.plan-prod.outcome == 'failure'
138+
run: exit 1

0 commit comments

Comments
 (0)