-
Notifications
You must be signed in to change notification settings - Fork 58
74 lines (63 loc) · 2.1 KB
/
test.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
name: test
on:
pull_request:
push:
branches:
- master
workflow_dispatch:
env:
DEVELOPER_DIR: /Applications/Xcode_15.2.app
jobs:
validation:
name: Validation
runs-on: macos-13
steps:
- uses: actions/checkout@v4
- name: Get SwiftPM cache
uses: actions/cache@v2
with:
path: .build
key: ${{ runner.os }}-1-spm-${{ hashFiles('Package.resolved') }}
restore-keys: ${{ runner.os }}-1-spm
- name: Validate format
run: |
make format
if [ -n "$(git status --porcelain)" ]; then echo "Make sure that the code is formated by 'make format'."; exit 1; fi
make lint
env:
SPM_FORCE_BUILD: 1
- name: Validate example project
run: |
make proj
if [ -n "$(git status --porcelain)" ]; then echo "Make sure that example project is formated by 'make proj'."; exit 1; fi
env:
SPM_FORCE_BUILD: 1
test:
name: Test on macOS
runs-on: macos-13
steps:
- uses: actions/checkout@v4
- name: Show environments
run: |
swift --version
xcodebuild -version
git branch
git shortlog
- name: Get npm cache
id: npm-cache
uses: actions/cache@v2
with:
path: node_modules
key: ${{ runner.os }}-0-npm-${{ hashFiles('package-lock.json') }}
restore-keys: ${{ runner.os }}-0-npm-
- name: Install npm packages
if: steps.npm-cache.cache.outputs.cache-hit != 'true'
run: make npm
- name: Test library & Generate snapshots
run: set -o pipefail && xcodebuild test -scheme Playbook -destination 'platform=iOS Simulator,name=iPhone 15 Pro' | xcpretty -c
- name: Generate snapshots of example app
run: set -o pipefail && xcodebuild test -project Example/PlaybookExample.xcodeproj -scheme SamplePlaybook -destination 'platform=iOS Simulator,name=iPhone 15 Pro' | xcpretty -c
- name: Visual regression test
run: npx percy upload Snapshots
env:
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }}