Skip to content

Commit 00b37ee

Browse files
authored
Merge pull request #5 from playbook-ui/ci
Introduce CI with GitHub Actions
2 parents 7dc1c39 + 2d0ef5a commit 00b37ee

File tree

14 files changed

+3245
-786
lines changed

14 files changed

+3245
-786
lines changed

.github/workflows/publish.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Publish
2+
on:
3+
release:
4+
types: [published]
5+
jobs:
6+
publish:
7+
name: Publish
8+
runs-on: macOS-11.0
9+
steps:
10+
- name: Checkout
11+
uses: actions/checkout@v2
12+
with:
13+
ref: ${{ github.ref }}
14+
15+
- name: Validation
16+
run: true && [ "${GITHUB_REF##*/}" = "$(cat .version)" ]
17+
18+
- name: Get ruby gem cache
19+
id: gem-cache
20+
uses: actions/cache@v2
21+
with:
22+
path: vendor/bundle
23+
key: ${{ runner.os }}-1-gem-${{ hashFiles('Gemfile.lock') }}
24+
restore-keys: ${{ runner.os }}-1-gem-
25+
26+
- name: Install ruby gems
27+
if: steps.gem-cache.cache.outputs.cache-hit != 'true'
28+
run: make gem
29+
30+
- name: CocoaPods trunk push
31+
run: make pod-release
32+
env:
33+
COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }}

.github/workflows/test.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: GitHub Actions
2+
on:
3+
pull_request:
4+
push:
5+
branches:
6+
- main
7+
jobs:
8+
test:
9+
name: Test on macOS
10+
runs-on: macOS-11.0
11+
strategy:
12+
matrix:
13+
xcode_version:
14+
- "12.2"
15+
env:
16+
DEVELOPER_DIR: /Applications/Xcode_${{ matrix.xcode_version }}.app
17+
steps:
18+
- uses: actions/checkout@v2
19+
- name: Show environments
20+
run: |
21+
swift --version
22+
xcodebuild -version
23+
24+
- name: Get ruby gem cache
25+
id: gem-cache
26+
uses: actions/cache@v2
27+
with:
28+
path: vendor/bundle
29+
key: ${{ runner.os }}-1-gem-${{ hashFiles('Gemfile.lock') }}
30+
restore-keys: ${{ runner.os }}-1-gem-
31+
32+
- name: Get npm cache
33+
id: npm-cache
34+
uses: actions/cache@v2
35+
with:
36+
path: node_modules
37+
key: ${{ runner.os }}-0-npm-${{ hashFiles('package-lock.json') }}
38+
restore-keys: ${{ runner.os }}-0-npm-
39+
40+
- name: Get SwiftPM cache
41+
uses: actions/cache@v2
42+
with:
43+
path: Tools/.build
44+
key: ${{ runner.os }}-${{ matrix.xcode_version }}-2-spm-${{ hashFiles('Tools/Package.resolved') }}
45+
restore-keys: ${{ runner.os }}-${{ matrix.xcode_version }}-2-spm-
46+
47+
- name: Get CocoaPods cache
48+
id: cocoapods-cache
49+
uses: actions/cache@v2
50+
with:
51+
path: Pods
52+
key: ${{ runner.os }}-1-cocoapods-${{ hashFiles('Example/Podfile.lock') }}
53+
restore-keys: ${{ runner.os }}-1-cocoapods-
54+
55+
- name: Install npm packages
56+
if: steps.npm-cache.cache.outputs.cache-hit != 'true'
57+
run: make npm
58+
59+
- name: Install ruby gems
60+
if: steps.gem-cache.cache.outputs.cache-hit != 'true'
61+
run: make gem
62+
63+
- name: Podspec lint
64+
run: make pod-lib-lint
65+
66+
- name: Validation
67+
run: make all && [ -z "$(git status --porcelain)" ] && make lint
68+
env:
69+
SPM_FORCE_BUILD: 1
70+
71+
- name: Generate snapshots
72+
run: set -o pipefail && xcodebuild build-for-testing test-without-building -workspace Example/Example.xcworkspace -scheme SampleApp -configuration Release -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 12 Pro' ENABLE_TESTABILITY=YES | xcpretty -c
73+
74+
- name: Visual regression test
75+
run: npx percy upload Example/Snapshots
76+
env:
77+
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }}

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ build/
2020
archive/
2121
*.xcframework
2222
*.xcworkspacedata
23+
*.xcworkspace
24+
*.xcodeproj
2325

2426
## Gem
2527
.bundle

Example/Example.xcodeproj/project.pbxproj

Lines changed: 0 additions & 624 deletions
This file was deleted.

Example/Example.xcodeproj/xcshareddata/xcschemes/SampleApp.xcscheme

Lines changed: 0 additions & 137 deletions
This file was deleted.

Example/Example.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist

Lines changed: 0 additions & 8 deletions
This file was deleted.

Example/Podfile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
use_frameworks!
21
platform :ios, '14.0'
32
source 'https://cdn.cocoapods.org/'
3+
use_frameworks!
4+
inhibit_all_warnings!
5+
6+
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
47

58
target 'SampleApp' do
69
inherit! :search_paths
@@ -11,6 +14,5 @@ end
1114
target 'SampleAccessibilitySnapshot' do
1215
inherit! :search_paths
1316

14-
pod 'PlaybookSnapshot', '~> 0.2.0'
1517
pod 'PlaybookAccessibilitySnapshot', :path => '../PlaybookAccessibilitySnapshot.podspec'
1618
end

Example/Podfile.lock

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ PODS:
1212
DEPENDENCIES:
1313
- Playbook (~> 0.2.0)
1414
- PlaybookAccessibilitySnapshot (from `../PlaybookAccessibilitySnapshot.podspec`)
15-
- PlaybookSnapshot (~> 0.2.0)
1615

1716
SPEC REPOS:
1817
trunk:
@@ -32,6 +31,6 @@ SPEC CHECKSUMS:
3231
PlaybookAccessibilitySnapshot: a2c8e153a1bae7e9e1527d5f37f272bd3f3cdfcd
3332
PlaybookSnapshot: 5a1caa4eab596c0da23613b15c506bdbeeedc8c0
3433

35-
PODFILE CHECKSUM: faa37e96a1de8eb0b94cdf3058d4e2a635174bf9
34+
PODFILE CHECKSUM: f338bdd8abed3a3355aaa32bab8dc4ee0137d714
3635

3736
COCOAPODS: 1.10.0

Example/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# How to Run
22

3-
1. Run `make all` at the root of this repository.
3+
1. Run `make proj` at the root of this repository.
44
1. Open `Example.xcworkspace` via Xcode.
55
1. Test (⌘+U) `SampleApp` scheme to generate accessibility snapshot images.

Makefile

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,25 @@ GITHUB_RAW_CONTENT_PATH := https://raw.githubusercontent.com/playbook-ui/accessi
33
GITHUB_TREE_PATH := https://github.com/playbook-ui/accessibility-snapshot-ios/main/
44

55
.PHONY: all
6-
all: proj pod-install mod format
6+
all: proj format
77

88
.PHONY: proj
99
proj:
1010
$(SWIFT_TOOL) xcodegen --spec Example/project.yml --project Example
11+
make pod-install
1112

1213
.PHONY: pod-install
1314
pod-install:
14-
bundle exec pod install --project-directory=Example
15-
16-
.PHONY: mod
17-
mod:
18-
$(SWIFT_TOOL) swift-mod
15+
bundle exec pod install --project-directory=Example || bundle exec pod install --repo-update --project-directory=Example
1916

2017
.PHONY: format
2118
format:
22-
$(SWIFT_TOOL) swift-format --configuration .swift-format.json -i -r -m format Sources Example/SampleApp Example/SampleAccessibilitySnapshot
19+
$(SWIFT_TOOL) swift-mod
20+
$(SWIFT_TOOL) swift-format --configuration .swift-format.json -i -r -m format Sources Example/SampleAccessibilitySnapshot
2321

2422
.PHONY: lint
2523
lint:
26-
$(SWIFT_TOOL) swift-format --configuration .swift-format.json -r -m lint Sources Example/SampleApp Example/SampleAccessibilitySnapshot
24+
$(SWIFT_TOOL) swift-format --configuration .swift-format.json -r -m lint Sources Example/SampleAccessibilitySnapshot
2725

2826
.PHONY: pod-lib-lint
2927
pod-lib-lint:
@@ -38,6 +36,10 @@ gem:
3836
bundle config path vendor/bundle
3937
bundle install --jobs 4 --retry 3
4038

39+
.PHONY: npm
40+
npm:
41+
npm i
42+
4143
.PHONY: docs
4244
docs:
4345
$(SWIFT_TOOL) swift-doc generate Sources -n PlaybookAccessibilitySnapshot -f html -o docs

0 commit comments

Comments
 (0)