-
Notifications
You must be signed in to change notification settings - Fork 9
133 lines (126 loc) · 4.39 KB
/
e2e.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: E2E Tests
on: [deployment_status]
jobs:
Setup:
if: github.event.deployment_status.state == 'success'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: pipx install pipenv
- uses: actions/setup-python@v5
with:
python-version: "3.10"
# Can't use cache because of https://github.com/actions/cache/issues/319
# cache: 'pipenv'
- name: Install bootstrapper dependencies
run: pipenv install --dev --deploy
- run: |
config_file=$(./scripts/vue_or_react.sh)
pipenv run cookiecutter . --config-file $config_file --no-input -f
cat $config_file
- uses: actions/upload-artifact@v4
with:
name: my_project
path: my_project/
retention-days: 1
Playwright:
needs: Setup
timeout-minutes: 60
runs-on: ubuntu-latest
if: github.event.deployment_status.state == 'success'
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: my_project
path: my_project/
- uses: actions/setup-node@v4
with:
node-version: 18
- name: 📦 Install frontend dependencies
working-directory: ./my_project/client
run: npm install
- name: 🎭 Install Playwright
working-directory: ./my_project/client
run: npx playwright install --with-deps
- name: Run Playwright tests against ${{ github.event.deployment_status.environment_url }}
working-directory: ./my_project/client
run: npx playwright test --reporter=html
env:
NPM_CONFIG_PRODUCTION: false
PLAYWRIGHT_TEST_BASE_URL: ${{ github.event.deployment_status.environment_url }}
PLAYWRIGHT_TEST_USER_PASS: ${{ secrets.CYPRESS_TEST_USER_PASS }}
- uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-report
path: my_project/client/playwright-report/
retention-days: 30
configuremobile:
needs: Setup
runs-on: ubuntu-latest
outputs:
BUILD_MOBILE_APP: ${{ steps.checkdiff.outputs.BUILD_MOBILE_APP }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 5
name: check diff
- id: checkdiff
run: |
git fetch origin main
echo $(git diff --name-only origin/main -- | grep "/clients/mobile/react-native/" | wc -l)
echo "BUILD_MOBILE_APP=$(git diff --name-only origin/main -- | grep "/clients/mobile/react-native/" | wc -l)" >> $GITHUB_OUTPUT
getprnumber:
runs-on: ubuntu-latest
needs: configuremobile
if: needs.configuremobile.outputs.BUILD_MOBILE_APP != 0
steps:
- uses: jwalton/gh-find-current-pr@master
id: findPr
- name: Set name for PR
if: success() && steps.findPr.outputs.number
run: echo "PR=pr-${PR}" >> $GITHUB_ENV
env:
PR: ${{ steps.findPr.outputs.pr }}
outputs:
PR: ${{ env.PR }}
publish:
runs-on: ubuntu-latest
needs: getprnumber
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: my_project
path: my_project/
- uses: actions/cache@v4
with:
path: "**/node_modules"
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
- name: 🏗 Setup Node
uses: actions/setup-node@v4
with:
node-version: 18.x
- name: 🏗 Setup Expo and EAS
uses: expo/expo-github-action@v7
with:
expo-version: latest
eas-version: latest
token: ${{ secrets.EXPO_TOKEN }}
- name: 📦 Install dependencies
working-directory: ./my_project/mobile
run: yarn install
- name: Copy Config files
run: |
ls
cp resources/app-bs.config.js my_project/mobile/app.config.js
cp resources/eas-bs.json my_project/mobile/eas.json
- name: 🚀 Publish preview
working-directory: ./my_project/mobile
run: |
eas update --branch="${{ needs.getprnumber.outputs.PR }}" --non-interactive --auto
echo "${{ env.BACKEND_SERVER_URL }} and ${{ needs.getprnumber.outputs.PR }}"
env:
EXPO_PUBLIC_BACKEND_SERVER_URL: "${{ github.event.deployment_status.environment_url }}"
EXPO_PUBLIC_ROLLBAR_ACCESS_TOKEN: "1a19e5da05b2435b802d5a81aba2bbd7"