generated from actions/typescript-action
-
Notifications
You must be signed in to change notification settings - Fork 0
127 lines (121 loc) · 3.66 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
name: 'build'
concurrency:
group: ${{ github.head_ref || github.ref_name }}
on:
pull_request:
push:
branches:
- develop
- 'releases/*'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- run: npm ci
- run: npm run all
test:
runs-on: ubuntu-latest
env:
AWS_REGION: us-east-1
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TEST_NAME: ${{ github.head_ref || github.ref_name }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- run: npm ci
working-directory: pulumi
- name: configure env
run: |
echo "DEV_TAG=dev-$TEST_NAME-1" >> $GITHUB_ENV
echo "PROD_TAG=prod-$TEST_NAME-1" >> $GITHUB_ENV
echo "DEV_STACK_NAME=$TEST_NAME-dev" >> $GITHUB_ENV
echo "PROD_STACK_NAME=$TEST_NAME-prod" >> $GITHUB_ENV
- name: create dev stack
uses: pulumi/actions@v3
with:
command: up
stack-name: ${{ env.DEV_STACK_NAME }}
upsert: true
work-dir: pulumi
env:
ENVIRONMENT_TAG: ${{ env.DEV_TAG }}
- name: create prod stack
uses: pulumi/actions@v3
with:
command: up
stack-name: ${{ env.PROD_STACK_NAME }}
upsert: true
work-dir: pulumi
env:
ENVIRONMENT_TAG: ${{ env.PROD_TAG }}
- name: assert both stacks
run: EXPECTED_STACKS=$DEV_STACK_NAME,$PROD_STACK_NAME npx ts-node assert-stacks
working-directory: pulumi
- name: 'test: cleanup dev stack [tags policy, config input]'
uses: ./
with:
working-directory: pulumi
config: |
policies:
dev:
match:
tags:
environment: 'dev-${{ env.TEST_NAME }}*'
ttl:
hours: 0
verbose: true
preview: false
- name: assert prod stack only
run: EXPECTED_STACKS=$PROD_STACK_NAME npx ts-node assert-stacks
working-directory: pulumi
- name: setup config file
run: envsubst < cleanup-prod-config.yml > cleanup-config.yml
working-directory: pulumi
- name: 'test: cleanup prod stack [tags policy, default config_file input]'
uses: ./
with:
working-directory: pulumi
verbose: true
preview: false
- name: assert zero stacks
run: EXPECTED_STACKS= npx ts-node assert-stacks
working-directory: pulumi
mutation-test:
runs-on: ubuntu-latest
env:
STRYKER_DASHBOARD_API_KEY: ${{ secrets.STRYKER_DASHBOARD_API_KEY }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- run: npm ci
- run: npm run test:mutate
check-dist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- name: Rebuild the dist/ directory
run: |
npm ci
npm run build
npm run package
- name: Compare the expected and actual dist/ directories
run: |
if [ "$(git diff --ignore-space-at-eol dist/ | wc -l)" -gt "0" ]; then
echo "Detected uncommitted changes after build. See status below:"
git diff
exit 1
fi