-
-
Notifications
You must be signed in to change notification settings - Fork 10
125 lines (107 loc) · 3.46 KB
/
ci-prod.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
name: ci-prod.yml
on:
push:
branches:
- main
workflow_dispatch:
permissions:
contents: write
deployments: write
jobs:
test:
if: ${{ github.actor != 'dependabot[bot]' }}
name: Test using Playwright
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18
- name: Install Dependencies
run: |
npm install
npx playwright install
- name: Install Playwright Browser
run: |
sudo apt-get update
npx playwright install-deps
- name: Run Playwright Tests
continue-on-error: true
run: |
npm run check
npm run test
env:
PUBLIC_API_URL: ${{ secrets.PUBLIC_API_URL }}
PUBLIC_WEBSOCKET_URL: ${{ secrets.PUBLIC_WEBSOCKET_URL }}
PUBLIC_X_API_KEY: ${{ secrets.PUBLIC_X_API_KEY }}
PUBLIC_CROSS_ORIGIN: ${{ secrets.PUBLIC_CROSS_ORIGIN }}
PUBLIC_ENV: ${{ secrets.PUBLIC_ENV }}
- name: Convert E2E Report to Coverage Report
run: |
npm install playwright-e2e-coverage-report
wget https://raw.githubusercontent.com/CodeCrowCorp/playwright-e2e-coverage-report/master/scripts/reportConverter.js
chmod u+x reportConverter.js
node ./reportConverter.js
- name: Upload Artifact
uses: actions/upload-artifact@v3.1.3
if: always()
with:
name: results.json
path: ./results.json
retention-days: 30
- name: Send to Codecov
uses: codecov/codecov-action@v3.1.4
with:
files: ./results.json
flags: "e2ecoverage"
deploy:
if: ${{ github.actor != 'dependabot[bot]' }}
name: Deploy to Cloudflare Pages (Production)
needs: [test]
runs-on: ubuntu-latest
permissions:
contents: read
deployments: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Node
uses: actions/setup-node@v3
with:
node-version: 18
- name: Install NPM and build
run: npm install && npm run build
env:
PUBLIC_API_URL: ${{ secrets.PUBLIC_API_URL }}
PUBLIC_WEBSOCKET_URL: ${{ secrets.PUBLIC_WEBSOCKET_URL }}
PUBLIC_X_API_KEY: ${{ secrets.PUBLIC_X_API_KEY }}
PUBLIC_CROSS_ORIGIN: ${{ secrets.PUBLIC_CROSS_ORIGIN }}
PUBLIC_ENV: ${{ secrets.PUBLIC_ENV }}
- name: Publish
uses: cloudflare/wrangler-action@v3.2.0
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
command: pages publish ".svelte-kit/cloudflare" --project-name=mage-website
create-tag:
if: ${{ github.actor != 'dependabot[bot]' }}
name: Create Tag and Release
runs-on: ubuntu-latest
needs: [deploy]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get NPM version
id: package-version
uses: martinbeentjes/npm-get-version-action@main
- name: Create a tag and release
uses: ncipollo/release-action@v1.13.0
with:
tag: ${{ steps.package-version.outputs.current-version }}
name: v${{ steps.package-version.outputs.current-version }}
token: ${{ secrets.GITHUB_TOKEN }}
generateReleaseNotes: true
continue-on-error: true