-
Notifications
You must be signed in to change notification settings - Fork 3
163 lines (144 loc) · 6.17 KB
/
cicd.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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
name: CI/CD
on:
workflow_dispatch:
inputs:
forceTurboAll:
description: 'force turbo:all'
type: boolean
forceDeploy:
description: 'force a deploy'
type: boolean
push:
branches:
- main
paths-ignore:
- '**.md'
jobs:
check_and_deploy:
name: check and deploy
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Cache .turbo
uses: actions/cache@v4
with:
path: .turbo
key: ${{ runner.os }}-turbo-${{ github.sha }}
restore-keys: |
${{ runner.os }}-turbo-
- name: Setup pnpm
uses: pnpm/action-setup@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
cache: pnpm
node-version-file: '.nvmrc'
- name: pnpm install
run: pnpm install
# https://github.com/microsoft/playwright/issues/7249#issuecomment-1385567519
- name: Store Playwright's Version
run: |
PLAYWRIGHT_VERSION=$(pnpm ls @playwright/test --filter app-playwright --json | jq '.[0].devDependencies["@playwright/test"].version' --raw-output)
echo "Playwright's Version: $PLAYWRIGHT_VERSION"
echo "PLAYWRIGHT_VERSION=$PLAYWRIGHT_VERSION" >> $GITHUB_ENV
- name: Cache Playwright Browsers for Playwright's Version
id: cache-playwright-browsers
uses: actions/cache@v4
with:
path: ~/.cache/ms-playwright
key: playwright-browsers-${{ env.PLAYWRIGHT_VERSION }}
- name: Install Playwright Browsers
if: steps.cache-playwright-browsers.outputs.cache-hit != 'true'
working-directory: ./app-playwright
run: npx playwright install --with-deps
# https://github.com/microsoft/playwright/issues/30538#issuecomment-2185965508
- name: Install system dependencies for WebKit
# Some WebKit dependencies seem to lay outside the cache and will need to be installed separately
if: ${{ steps.cache-playwright-browsers.outputs.cache-hit == 'true' }}
working-directory: ./app-playwright
run: npx playwright install-deps webkit
- name: Install mkcert
shell: bash
run: |
curl -L -o mkcert "https://github.com/FiloSottile/mkcert/releases/download/v1.4.4/mkcert-v1.4.4-linux-amd64"
chmod +x mkcert
sudo mv mkcert /usr/local/bin/mkcert
sudo apt install libnss3-tools
mkcert -install
echo "NODE_EXTRA_CA_CERTS="$(mkcert -CAROOT)/rootCA.pem"" >> "$GITHUB_ENV"
- name: Override license server with local server
# run: sudo echo "127.0.0.1 license.automatisch.io" | sudo tee -a /etc/hosts
run: |
# sudo tee -a /etc/hosts < appendhosts
sudo mv appendhosts /etc/hosts
echo "+++++++++++++++++++++++++++++++++++++++++++++++++++"
sudo cat /etc/hosts
- name: envsubst
env:
cloudflareAccountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
productionPeerSyncPublicKey: ${{ secrets.PEER_SYNC_PUBLIC_KEY }}
VITE_PRODUCTION_AG_GRID_LICENSE: ${{ secrets.AG_GRID_LICENSE }}
VITE_PRODUCTION_HUB_DOMAIN: pentive.com
VITE_TEST_HUB_ORIGIN: https://pentive.localhost:3044
VITE_PRODUCTION_HUB_ORIGIN: https://pentive.com
productionHubOrigin: https://pentive.com
VITE_TEST_CWA_URL: https://cwa.pentive.localhost:3047/
VITE_PRODUCTION_CWA_URL: https://cwa.pentive.com/
VITE_TEST_AUGC_URL: https://user-generated-content-pentive.localhost:3049/
VITE_PRODUCTION_AUGC_URL: https://api-ugc-production.alexerrant.workers.dev/
VITE_TEST_APP_ORIGIN: https://app.pentive.localhost:3043
VITE_PRODUCTION_APP_ORIGIN: https://app.pentive.com
productionAppOrigin: https://app.pentive.com
VITE_TEST_HUB_UGC_ORIGIN: https://hub-user-generated-content-pentive.localhost:3046
VITE_PRODUCTION_HUB_UGC_ORIGIN: https://hub-ugc.pages.dev
VITE_TEST_APP_UGC_ORIGIN: https://app-user-generated-content-pentive.localhost:3045
VITE_PRODUCTION_APP_UGC_ORIGIN: https://app-ugc.pages.dev
VITE_TEST_PEER_PORT: 3048
VITE_PRODUCTION_PEER_HOST: 0.peerjs.com
VITE_PRODUCTION_PEER_PORT: 443
run: |
./mkcert.sh
envsubst < ./cwa/example.wrangler.toml > ./cwa/wrangler.toml
envsubst < ./api-ugc/example.wrangler.toml > ./api-ugc/wrangler.toml
envsubst < ./hub/example.wrangler.toml > ./hub/wrangler.toml
envsubst < ./hub/.example.env.production > ./hub/.env.production
envsubst < ./app/.example.env.production > ./app/.env.production
envsubst < ./app-playwright/.example.env > ./app-playwright/.env
- name: turbo
run: pnpm turbo:all --force $FORCE_TURBO_ALL
env:
FORCE_TURBO_ALL: ${{ inputs.forceTurboAll || 'false' }}
NODE_OPTIONS: '--max_old_space_size=8192' # https://github.com/actions/runner-images/issues/70
- name: curl1
if: always()
run: |
npx turbo buildTest
env:
NODE_OPTIONS: '--max_old_space_size=8192' # https://github.com/actions/runner-images/issues/70
- name: curl
if: always()
env:
NODE_OPTIONS: '--max_old_space_size=8192' # https://github.com/actions/runner-images/issues/70
run: |
npx turbo previewTest &
for i in {1..20}
do
sleep 5
echo $i
curl https://app-user-generated-content-pentive.localhost:3045/ | wc
curl https://app.pentive.localhost:3043/ | wc
done
- name: Upload App Playwright report
uses: actions/upload-artifact@v4
if: always()
with:
name: app-playwright-report
path: app-playwright/playwright-report/
retention-days: 30
- name: deploy
run: pnpm run deploy-only --force $FORCE_DEPLOY
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
FORCE_DEPLOY: ${{ inputs.forceDeploy || 'false' }}