Skip to content

Commit 292b60f

Browse files
authored
Merge pull request #408 from stevenzeck/swiftui
2 parents f3bb753 + d53f695 commit 292b60f

File tree

576 files changed

+33850
-36183
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

576 files changed

+33850
-36183
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

-75
This file was deleted.

.github/ISSUE_TEMPLATE/bug_report.yml

+85
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
name: Bug report
2+
description: File a bug report to help improve the Readium toolkit
3+
title: "[Bug] "
4+
labels: ["bug", "triage"]
5+
body:
6+
- type: markdown
7+
attributes:
8+
value: |
9+
Thank you for filing a bug report! Please [search for existing issues](https://github.com/readium/swift-toolkit/issues?q=is:issue) before submitting.
10+
- type: textarea
11+
id: bug-description
12+
attributes:
13+
label: Describe the bug
14+
description: Also, please let us know what your expectations were.
15+
placeholder: A clear and concise description of what the bug is.
16+
validations:
17+
required: true
18+
- type: textarea
19+
id: bug-steps
20+
attributes:
21+
label: How to reproduce?
22+
description: |
23+
Step by step explanation to reproduce the issue in the Test App.
24+
25+
If you can, drag and drop:
26+
- the publication used to reproduce the problem, after zipping it.
27+
- screenshots or a screencast showing the issue
28+
29+
placeholder: |
30+
1. Open book X
31+
2. Go to chapter Y
32+
3. Swipe left twice
33+
4. See error
34+
...
35+
validations:
36+
required: true
37+
- type: input
38+
id: bug-readium-version
39+
attributes:
40+
label: Readium version
41+
description: What version of the Readium toolkit are you running?
42+
validations:
43+
required: true
44+
- type: input
45+
id: bug-os-version
46+
attributes:
47+
label: OS version
48+
description: On which OS version(s) did you reproduce the problem?
49+
placeholder: iOS 17.0.1
50+
validations:
51+
required: true
52+
- type: input
53+
id: bug-device
54+
attributes:
55+
label: Testing device
56+
description: On which Apple device did you reproduce the problem?
57+
placeholder: iPhone 15 Pro Max (emulator)
58+
validations:
59+
required: true
60+
- type: textarea
61+
id: bug-environment
62+
attributes:
63+
label: Environment
64+
description: |
65+
Run the following shell commands and paste the result here:
66+
```shell
67+
echo "macOS: `sw_vers -productVersion`"
68+
echo "platform: `uname -m`"
69+
echo "carthage: `carthage version`"
70+
xcodebuild -version
71+
```
72+
placeholder: |
73+
macOS: 14.1.2
74+
platform: arm64
75+
carthage: 0.39.1
76+
Xcode 15.1
77+
Build version 15C65
78+
render: bash
79+
- type: textarea
80+
id: bug-additional
81+
attributes:
82+
label: Additional context
83+
description: |
84+
Share additional code showing how you use Readium, if relevant. Output logs are useful as well.
85+
If you already went through the codebase to find the bug, you can explain your findings here.

.github/ISSUE_TEMPLATE/config.yml

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
blank_issues_enabled: false

.github/workflows/checks.yml

+76-36
Original file line numberDiff line numberDiff line change
@@ -13,125 +13,165 @@ env:
1313
jobs:
1414
build:
1515
name: Build
16-
runs-on: macos-latest
16+
runs-on: macos-12
17+
if: ${{ !github.event.pull_request.draft }}
1718
env:
1819
scheme: ${{ 'Readium-Package' }}
19-
DEVELOPER_DIR: /Applications/Xcode_12.4.app/Contents/Developer
20+
DEVELOPER_DIR: /Applications/Xcode_13.4.1.app/Contents/Developer
2021

2122
steps:
2223
- name: Checkout
23-
uses: actions/checkout@v2
24+
uses: actions/checkout@v3
2425
- name: Install dependencies
25-
run: brew install xcodegen
26+
run: |
27+
brew update
28+
brew install xcodegen
2629
- name: Check Carthage project
2730
run: |
2831
# Check that the Carthage project is up to date.
2932
make carthage-project
30-
git diff --exit-code --name-only Support/Carthage/Readium.xcodeproj
33+
git diff --exit-code Support/Carthage/Readium.xcodeproj
3134
- name: Build
3235
run: |
33-
xcodebuild build-for-testing -scheme "$scheme" -destination "platform=$platform,name=$device"
36+
set -eo pipefail
37+
xcodebuild build-for-testing -scheme "$scheme" -destination "platform=$platform,name=$device" | if command -v xcpretty &> /dev/null; then xcpretty; else cat; fi
3438
- name: Test
3539
run: |
36-
xcodebuild test-without-building -scheme "$scheme" -destination "platform=$platform,name=$device"
40+
set -eo pipefail
41+
xcodebuild test-without-building -scheme "$scheme" -destination "platform=$platform,name=$device" | if command -v xcpretty &> /dev/null; then xcpretty; else cat; fi
3742
3843
lint:
3944
name: Lint
40-
runs-on: macos-latest
45+
runs-on: macos-12
46+
if: ${{ !github.event.pull_request.draft }}
4147
env:
4248
scripts: ${{ 'Sources/Navigator/EPUB/Scripts' }}
4349

4450
steps:
4551
- name: Checkout
46-
uses: actions/checkout@v2
52+
uses: actions/checkout@v3
53+
- name: Install pnpm
54+
uses: pnpm/action-setup@v2
55+
with:
56+
package_json_file: Sources/Navigator/EPUB/Scripts/package.json
57+
run_install: false
58+
- name: Setup cache
59+
uses: actions/setup-node@v3
60+
with:
61+
node-version: 20
62+
cache: 'pnpm'
63+
cache-dependency-path: Sources/Navigator/EPUB/Scripts/pnpm-lock.yaml
4764
- name: Install dependencies
48-
run: yarn --cwd "$scripts" install --frozen-lockfile
49-
- name: Lint JavaScript
50-
run: yarn --cwd "$scripts" run lint
51-
- name: Check JavaScript formatting
52-
run: yarn --cwd "$scripts" run checkformat
65+
run: pnpm --dir "$scripts" install --frozen-lockfile
66+
- name: Lint
67+
run: pnpm --dir "$scripts" run lint
68+
- name: Check formatting
69+
run: pnpm --dir "$scripts" run checkformat
5370
- name: Check if bundled scripts are up-to-date
5471
run: |
5572
make scripts
5673
git diff --exit-code --name-only Sources/Navigator/EPUB/Assets/Static/scripts/*.js
74+
- name: Lint Swift formatting
75+
run: make lint-format
5776

5877
int-dev:
5978
name: Integration (Local)
60-
runs-on: macos-latest
79+
runs-on: macos-12
80+
if: ${{ !github.event.pull_request.draft }}
6181
defaults:
6282
run:
6383
working-directory: TestApp
6484
environment: LCP
6585
steps:
6686
- name: Checkout
67-
uses: actions/checkout@v2
87+
uses: actions/checkout@v3
6888
- name: Install dependencies
69-
run: brew install xcodegen
89+
run: |
90+
brew update
91+
brew install xcodegen
7092
- name: Generate project
7193
run: make dev lcp=${{ secrets.LCP_URL_SPM }}
7294
- name: Build
7395
run: |
74-
xcodebuild build -scheme TestApp -destination "platform=$platform,name=$device"
75-
76-
# The following integration jobs are run only when pushing to `develop` or `main`.
77-
# As they use a specific commit hash, they can't run properly from a pull request
78-
# opened from forks.
96+
set -eo pipefail
97+
xcodebuild build -scheme TestApp -destination "platform=$platform,name=$device" | if command -v xcpretty &> /dev/null; then xcpretty; else cat; fi
7998
8099
int-spm:
81100
name: Integration (Swift Package Manager)
82-
if: github.event_name == 'push'
83-
runs-on: macos-latest
101+
runs-on: macos-12
102+
if: ${{ !github.event.pull_request.draft }}
84103
defaults:
85104
run:
86105
working-directory: TestApp
87106
environment: LCP
88107
steps:
89108
- name: Checkout
90-
uses: actions/checkout@v2
109+
uses: actions/checkout@v3
110+
# We can't use the current github.sha with pull_request event, because they will
111+
# reference the merge commit which cannot be fetched with SPM.
112+
- name: Set commit SHA
113+
if: github.event_name == 'pull_request'
114+
run: |
115+
echo "commit_sha=${{ github.event.pull_request.head.sha }}" >> "$GITHUB_ENV"
91116
- name: Install dependencies
92-
run: brew install xcodegen
117+
run: |
118+
brew update
119+
brew install xcodegen
93120
- name: Generate project
94121
run: make spm lcp=${{ secrets.LCP_URL_SPM }} commit=$commit_sha
95122
- name: Build
96123
run: |
97-
xcodebuild build -scheme TestApp -destination "platform=$platform,name=$device"
124+
set -eo pipefail
125+
xcodebuild build -scheme TestApp -destination "platform=$platform,name=$device" | if command -v xcpretty &> /dev/null; then xcpretty; else cat; fi
98126
99127
int-carthage:
100128
name: Integration (Carthage)
101-
if: github.event_name == 'push'
102-
runs-on: macos-latest
129+
runs-on: macos-12
130+
if: ${{ !github.event.pull_request.draft }}
103131
defaults:
104132
run:
105133
working-directory: TestApp
106134
environment: LCP
107135
steps:
108136
- name: Checkout
109-
uses: actions/checkout@v2
137+
uses: actions/checkout@v3
138+
# We can't use the current github.sha with pull_request event, because they will
139+
# reference the merge commit which cannot be fetched with Carthage.
140+
- name: Set commit SHA
141+
if: github.event_name == 'pull_request'
142+
run: |
143+
echo "commit_sha=${{ github.event.pull_request.head.sha }}" >> "$GITHUB_ENV"
110144
- name: Install dependencies
111-
run: brew install xcodegen
145+
run: |
146+
brew update
147+
brew install xcodegen
112148
- name: Generate project
113149
run: make carthage lcp=${{ secrets.LCP_URL_CARTHAGE }} commit=$commit_sha
114150
- name: Build
115151
run: |
116-
xcodebuild build -scheme TestApp -destination "platform=$platform,name=$device"
152+
set -eo pipefail
153+
xcodebuild build -scheme TestApp -destination "platform=$platform,name=$device" | if command -v xcpretty &> /dev/null; then xcpretty; else cat; fi
117154
118155
# Warning: This job cannot actually test the state of the current commit,
119156
# but will check that the latest branch/tag set in the Podspecs are valid.
120157
int-cocoapods:
121158
name: Integration (CocoaPods)
122159
if: github.event_name == 'push'
123-
runs-on: macos-latest
160+
runs-on: macos-12
124161
defaults:
125162
run:
126163
working-directory: TestApp
127164
environment: LCP
128165
steps:
129166
- name: Checkout
130-
uses: actions/checkout@v2
167+
uses: actions/checkout@v3
131168
- name: Install dependencies
132-
run: brew install xcodegen
169+
run: |
170+
brew update
171+
brew install xcodegen
133172
- name: Generate project
134173
run: make cocoapods lcp=${{ secrets.LCP_URL_COCOAPODS }} commit=$commit_sha
135174
- name: Build
136175
run: |
137-
xcodebuild build -workspace TestApp.xcworkspace -scheme TestApp -destination "platform=$platform,name=$device"
176+
set -eo pipefail
177+
xcodebuild build -workspace TestApp.xcworkspace -scheme TestApp -destination "platform=$platform,name=$device" | if command -v xcpretty &> /dev/null; then xcpretty; else cat; fi

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# Swift Package Manager
55
.build/
66
.swiftpm/
7-
Package.resolved
7+
./Package.resolved
88

99
# Carthage
1010
./Carthage/

.swiftformat

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
--swiftversion 5.6
2+
--exclude Carthage
3+
--header "//\n// Copyright {year} Readium Foundation. All rights reserved.\n// Use of this source code is governed by the BSD-style license\n// available in the top-level LICENSE file of the project.\n//"
4+
--stripunusedargs closure-only

BuildTools/Empty.swift

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
//
2+
// Copyright 2024 Readium Foundation. All rights reserved.
3+
// Use of this source code is governed by the BSD-style license
4+
// available in the top-level LICENSE file of the project.
5+
//

0 commit comments

Comments
 (0)