-
-
Notifications
You must be signed in to change notification settings - Fork 15
134 lines (128 loc) · 5.17 KB
/
verify.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
128
129
130
131
132
133
name: Verify PR
on:
pull_request:
types: [ opened, synchronize, reopened ]
env:
LEFTHOOK: 0
GITHUB_STEP_SUMMARY: $GITHUB_STEP_SUMMARY
REF_NAME: ${{ github.head_ref == '' && github.ref_name || github.head_ref }}
jobs:
verify:
concurrency:
group: one-at-a-time
cancel-in-progress: true
name: 🧪 Verify PR
uses: meza/shared-github-workflows/.github/workflows/default-node-npm-ci.yml@main
with:
command: "install --no-audit --no-fund"
node-version: "latest"
junit-report-path: "reports/junit.xml"
cobertura-report-path: "reports/**/cobertura-coverage.xml"
secrets:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
deploy:
concurrency:
group: ${{ github.head_ref == '' && github.ref_name || github.head_ref }}
cancel-in-progress: false
environment: Ephemeral
needs: [ verify ]
name: Ephemeral deployment
runs-on: 'ubuntu-latest'
steps:
- name: ⏬ Checkout
uses: actions/checkout@v3
- name: 🔧 Set up node
uses: meza/action-setup-node-npm@main
with:
command: "install --no-audit --no-fund"
node-version: latest
cache-name: ${{ needs.verify.outputs.cache-name }}
- name: 🔂 CDK Cache
if: contains( github.event.pull_request.labels.*.name, 'runtime dependencies')
uses: actions/cache@v3
with:
path: ./cdk.out
key: cdk-${{ env.REF_NAME }}-${{ hashFiles('deployment/**/*.ts') }}
- name: 🔢 Set version
run: npm version --no-git-tag-version 0.0.0-ephemeral.${{ github.run_number }}
- name: 🔨 Build
run: npm run build -- --sourcemap
env:
NODE_ENV: production
AUTH0_DOMAIN: ${{ secrets.AUTH0_DOMAIN }}
AUTH0_CLIENT_ID: ${{ secrets.AUTH0_CLIENT_ID }}
AUTH0_CLIENT_SECRET: ${{ secrets.AUTH0_CLIENT_SECRET }}
GOOGLE_ANALYTICS_ID: ${{ vars.GOOGLE_ANALYTICS_ID }}
SPLIT_SERVER_TOKEN: ${{ secrets.SPLIT_SERVER_TOKEN }}
SESSION_SECRET: ${{ secrets.SESSION_SECRET }}
HOTJAR_ID: ${{ vars.HOTJAR_ID }}
POSTHOG_TOKEN: ${{ vars.POSTHOG_TOKEN }}
POSTHOG_API: ${{ vars.POSTHOG_API }}
COOKIEYES_TOKEN: ${{ vars.COOKIEYES_TOKEN }}
SENTRY_DSN: ${{ vars.SENTRY_DSN }}
I18N_DEBUG: 'true'
SPLIT_DEBUG: 'true'
- name: Sentry Sourcemaps
if: contains( github.event.pull_request.labels.*.name, 'runtime dependencies')
run: npx sentry-upload-sourcemaps --release 0.0.0-ephemeral.${{ github.run_number }}
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
- name: Remove Sourcemaps from the deployment
if: contains( github.event.pull_request.labels.*.name, 'runtime dependencies')
run: rm -rf ./public/**/*.map ./build/**/*.map
- name: 📦 Deploy ${{ env.REF_NAME }}
if: contains( github.event.pull_request.labels.*.name, 'runtime dependencies')
run: npx cdk deploy remix-trance-stack-ephemeral -O /tmp/deployment.result.json --require-approval never --context environmentName=${{ env.REF_NAME }} --context domainName=${{ vars.AWS_DOMAIN_NAME }} --context certificateArn=${{ secrets.AWS_CERT_ARN }} --context hostedZoneName=${{ vars.AWS_HOSTED_ZONE_NAME }}
env:
GITHUB_STEP_SUMMARY: $GITHUB_STEP_SUMMARY
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- name: ✍️ Publish deployment results
if: contains( github.event.pull_request.labels.*.name, 'runtime dependencies')
run: npx ts-node --prefer-ts-exts deployment/githubActionSupport.ts /tmp/deployment.result.json
env:
ISSUE_NUMBER: ${{ github.event.pull_request.number }}
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
- name: Upload server js
uses: actions/upload-artifact@v2
with:
name: Generated Sources
path: |
./server/index.js
./public/build
outputs:
APP_DOMAIN: ${{ steps.deployment-data.outputs.APP_DOMAIN }}
test:
name: "Playwright Tests"
concurrency:
group: ${{ github.head_ref == '' && github.ref_name || github.head_ref }}
cancel-in-progress: true
timeout-minutes: 20
needs: [ deploy ]
runs-on: ubuntu-latest
env:
APP_DOMAIN: ${{ needs.deploy.outputs.APP_DOMAIN }}
PW_PASS: ${{ secrets.PW_PASS }}
steps:
- uses: actions/checkout@v3
- name: Set up node
if: ${{ needs.deploy.outputs.APP_DOMAIN }}
uses: meza/action-setup-node-npm@main
with:
command: "install --no-audit --no-fund"
node-version: latest
cache-name: npm
- name: Install Playwright Browsers
if: ${{ needs.deploy.outputs.APP_DOMAIN }}
run: npm run playwright:install
- name: Run Playwright tests
if: ${{ needs.deploy.outputs.APP_DOMAIN }}
run: npm run int
- uses: actions/upload-artifact@v3
if: always()
with:
name: playwright-report
path: reports/e2e
retention-days: 30