-
Notifications
You must be signed in to change notification settings - Fork 628
173 lines (147 loc) Β· 5.15 KB
/
macstadium-tests.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
name: iOS e2e tests
on: [pull_request, workflow_dispatch]
jobs:
# Job to install dependencies
install-deps:
runs-on: ["self-hosted"]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Set up github keys
run: git config core.sshCommand "ssh -i ~/.ssh/id_ed25519 -F /dev/null"
- name: Clean iOS app
run: yarn cache clean && yarn clean:ios > /dev/null 2>&1 || true
- name: Set up ENV vars & scripts
env:
CI_SCRIPTS: ${{ secrets.CI_SCRIPTS }}
run: |
source ~/.zshrc
git clone [email protected]:rainbow-me/rainbow-env.git
mv rainbow-env/dotenv .env && rm -rf rainbow-env
eval $CI_SCRIPTS
- name: Get Yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
- name: Cache Yarn dependencies
uses: actions/cache@v4
with:
path: |
${{ steps.yarn-cache-dir-path.outputs.dir }}
.yarn/cache
.yarn/install-state.gz
!.eslintcache # Exclude eslint cache
key: ${{ runner.os }}-yarn-${{ github.sha }} # Cache per commit
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies
run: |
yarn install && yarn setup
- name: Set sanitized branch name
id: sanitize
run: echo "SANITIZED_REF_NAME=${GITHUB_REF_NAME//\//-}" >> $GITHUB_ENV
- name: Upload Yarn cache
uses: actions/upload-artifact@v4
with:
name: yarn-cache-${{ env.SANITIZED_REF_NAME }}
path: |
.yarn/cache
.yarn/install-state.gz
# Job for linting and unit tests
linting-and-unit-tests:
runs-on: ["self-hosted"]
permissions:
contents: read
needs: install-deps
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Set up github keys
run: git config core.sshCommand "ssh -i ~/.ssh/id_ed25519 -F /dev/null"
- name: Set sanitized branch name
id: sanitize
run: echo "SANITIZED_REF_NAME=${GITHUB_REF_NAME//\//-}" >> $GITHUB_ENV
- name: Download Yarn cache
uses: actions/download-artifact@v4
with:
name: yarn-cache-${{ env.SANITIZED_REF_NAME }}
path: .yarn
- name: Set up ENV vars & scripts
env:
CI_SCRIPTS: ${{ secrets.CI_SCRIPTS }}
run: |
source ~/.zshrc
git clone [email protected]:rainbow-me/rainbow-env.git
mv rainbow-env/dotenv .env && rm -rf rainbow-env
eval $CI_SCRIPTS
- name: Install dependencies
run: |
yarn install && yarn setup
- name: Check for frozen lockfile
run: ./scripts/check-lockfile.sh
- name: Audit CI
run: yarn audit-ci --config audit-ci.jsonc
- name: Remove ESLint cache
run: rm -f .eslintcache
- name: Lint
run: yarn lint:ci
- name: Unit tests
run: yarn test
# iOS build and e2e tests
e2e-ios:
runs-on: ["self-hosted"]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
timeout-minutes: 90
needs: install-deps
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Set up github keys
run: git config core.sshCommand "ssh -i ~/.ssh/id_ed25519 -F /dev/null"
- name: Set sanitized branch name
id: sanitize
run: echo "SANITIZED_REF_NAME=${GITHUB_REF_NAME//\//-}" >> $GITHUB_ENV
- name: Download Yarn cache
uses: actions/download-artifact@v4
with:
name: yarn-cache-${{ env.SANITIZED_REF_NAME }}
path: .yarn
- name: Set up ENV vars & scripts
env:
CI_SCRIPTS: ${{ secrets.CI_SCRIPTS }}
run: |
source ~/.zshrc
git clone [email protected]:rainbow-me/rainbow-env.git
mv rainbow-env/dotenv .env && rm -rf rainbow-env
eval $CI_SCRIPTS
- name: Install dependencies
run: |
yarn install && yarn setup
- name: Rebuild detox cache
run: ./node_modules/.bin/detox clean-framework-cache && ./node_modules/.bin/detox build-framework-cache
- name: Version debug
run: |
npx react-native info
- name: Install pods
run: |
rm -rf /Users/administrator/.cocoapods/repos/cocoapods/.git/index.lock
yarn install-bundle && yarn install-pods
- uses: irgaly/xcode-cache@v1
with:
key: xcode-cache-deriveddata-${{ github.workflow }}-${{ github.sha }}
restore-keys: xcode-cache-deriveddata-${{ github.workflow }}-
- name: Modify env and build app in release mode
run: |
sed -i'' -e "s/IS_TESTING=false/IS_TESTING=true/" .env && rm -f .env-e
yarn detox build --configuration ios.sim.release
- name: Detox iOS e2e tests
run: |
./scripts/run-retry-tests.sh 3