This repository has been archived by the owner on Sep 11, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
194 lines (152 loc) · 5.36 KB
/
ci.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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
name: CI
on:
workflow_dispatch:
pull_request:
branches: [main]
merge_group:
branches: [main]
concurrency:
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
lint_prettier:
name: Lint [prettier]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
- run: corepack enable yarn
- uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
with:
node-version-file: '.nvmrc'
cache: yarn
- run: yarn install --frozen-lockfile
- run: yarn prettier --check .
lint_eslint:
name: Lint [eslint]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
- run: corepack enable yarn
- uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
with:
node-version-file: '.nvmrc'
cache: yarn
- run: yarn install --frozen-lockfile
- run: yarn turbo run lint
drift_expo_install_check:
name: Drift [expo install --check]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
- run: corepack enable yarn
- uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
with:
node-version-file: '.nvmrc'
cache: yarn
- run: yarn install --frozen-lockfile
- run: yarn expo install --check
working-directory: ./app
export:
name: Export
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
- run: corepack enable yarn
- uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
with:
node-version-file: '.nvmrc'
cache: yarn
- run: yarn install --frozen-lockfile
- run: yarn turbo run export
build_version:
name: Build Version
runs-on: ubuntu-latest
outputs:
result: ${{ steps.calver.outputs.result }}
steps:
- name: CalVer
id: calver
run: |
export VERSION=$(date "+%Y.%m.%d")
echo ::set-output name=result::${VERSION}
eas_preview:
name: EAS Preview
environment: EAS Preview
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-latest
needs: [build_version]
permissions:
contents: read
pull-requests: write
steps:
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
- run: corepack enable yarn
- uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
with:
node-version-file: '.nvmrc'
cache: yarn
- uses: expo/expo-github-action@4479f0b3692e25169fa71a02c30d6586ec2f5601 # v8.0.0
with:
eas-version: latest
token: ${{ secrets.EXPO_TOKEN }}
- run: yarn install --frozen-lockfile
- run: yarn run version ${{ needs.build_version.outputs.result }}
working-directory: ./app
- run: yarn turbo run build
working-directory: ./app
- uses: expo/expo-github-action/preview@4479f0b3692e25169fa71a02c30d6586ec2f5601 # v8.0.0
with:
working-directory: ./app
command: eas update --branch pr-${{ github.event.number }} --message "PR ${{ github.event.number }} with commit ${{ github.sha }}"
test_playwright:
name: Test [Playwright]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
shardIndex: [1, 2]
shardTotal: [2]
steps:
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
- run: corepack enable yarn
- uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
with:
node-version-file: '.nvmrc'
cache: yarn
- run: yarn install --frozen-lockfile
- uses: actions/cache/restore@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
id: cache-restore
with:
path: ~/.cache/ms-playwright
key: playwright-${{ runner.os }}
- name: playwright install
working-directory: app
if: steps.cache-restore.outputs.cache-hit != 'true'
run: yarn playwright install --with-deps
- name: playwright test
working-directory: app
run: yarn playwright test --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }}
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
if: always()
with:
name: app-playwright
path: app/playwright/
retention-days: 7
- uses: actions/cache/save@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
if: always() && steps.cache-restore.outputs.cache-hit != 'true' && matrix.shardIndex == 1
with:
path: ~/.cache/ms-playwright
key: playwright-${{ runner.os }}
test_completed:
name: Test [completed]
runs-on: ubuntu-latest
if: always()
needs:
- test_playwright
steps:
- run: |
if ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'skipped') || contains(needs.*.result, 'cancelled') }} ; then
exit 1
fi