-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* unit tests * documentation
- Loading branch information
Łukasz Śliwinski
committed
May 20, 2022
1 parent
2bf7a85
commit 13b82fc
Showing
3 changed files
with
128 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- '*' | ||
workflow_dispatch: | ||
|
||
jobs: | ||
tests: | ||
runs-on: macos-12 | ||
strategy: | ||
matrix: | ||
xcode: [13.3] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: install xcbeautify | ||
run: brew install xcbeautify | ||
- name: Select Xcode ${{ matrix.xcode }} | ||
run: sudo xcode-select -s /Applications/Xcode_${{ matrix.xcode }}.app | ||
- name: Run tests | ||
run: xcodebuild test -project ./XcodeProject/UIEnvironment.xcodeproj -destination platform="iOS Simulator,name=iPhone 11 Pro Max" -scheme "App" CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO | xcbeautify |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
# Build and deploy DocC to GitHub pages. Based off of @karwa's work here: | ||
# https://github.com/karwa/swift-url/blob/main/.github/workflows/docs.yml | ||
name: Documentation | ||
|
||
on: | ||
release: | ||
types: | ||
- published | ||
push: | ||
branches: | ||
- main | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
runs-on: macos-12 | ||
steps: | ||
- name: Checkout Package | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Checkout swift-docc | ||
uses: actions/checkout@v2 | ||
with: | ||
repository: apple/swift-docc | ||
ref: main | ||
path: swift-docc | ||
- name: Cache DocC | ||
id: cache-docc | ||
uses: actions/cache@v2 | ||
with: | ||
key: swift-url-docc-build | ||
path: swift-docc/.build | ||
- name: Build swift-docc | ||
if: ${{ !steps.cache-docc.outputs.cache-hit }} | ||
run: | | ||
cd swift-docc; swift build --product docc -c release; cd .. | ||
- name: Checkout gh-pages Branch | ||
uses: actions/checkout@v2 | ||
with: | ||
ref: gh-pages | ||
path: docs-out | ||
|
||
- name: Build documentation | ||
run: > | ||
rm -rf docs-out/.git; | ||
rm -rf docs-out/main; | ||
for tag in $(echo "main"; git tag); | ||
do | ||
echo "⏳ Generating documentation for "$tag" release."; | ||
if [ -d "docs-out/$tag" ] | ||
then | ||
echo "✅ Documentation for "$tag" already exists."; | ||
else | ||
git checkout "$tag"; | ||
export DOCC_HTML_DIR="$(dirname $(xcrun --find docc))/../share/docc/render"; | ||
rm -rf .build; | ||
mkdir -p .build/symbol-graphs; | ||
mkdir -p .build/swift-docc-symbol-graphs; | ||
swift build --target UIEnvironment \ | ||
-Xswiftc "-sdk" \ | ||
-Xswiftc "`xcrun --sdk iphonesimulator --show-sdk-path`" \ | ||
-Xswiftc "-target" \ | ||
-Xswiftc "arm64-apple-ios15.4-simulator" \-Xswiftc -emit-symbol-graph \ | ||
-Xswiftc -emit-symbol-graph-dir -Xswiftc .build/symbol-graphs; | ||
if [ -z "$(ls -A .build/symbol-graphs)" ]; then | ||
echo "⚠️ Documentation skipped for "$tag". No symbol graphs."; | ||
else | ||
mv .build/symbol-graphs/UIEnvironment* .build/swift-docc-symbol-graphs; | ||
mkdir -p "docs-out/$tag"; | ||
|
||
swift-docc/.build/release/docc convert Sources/UIEnvironment/Documentation.docc \ | ||
--fallback-display-name UIEnvironment \ | ||
--fallback-bundle-identifier com.plum.UIEnvironment \ | ||
--fallback-bundle-version 1.0.0 \ | ||
--additional-symbol-graph-dir .build/swift-docc-symbol-graphs \ | ||
--transform-for-static-hosting \ | ||
--hosting-base-path /UIEnvironment/"$tag" \ | ||
--output-path docs-out/"$tag" \ | ||
&& echo "✅ Documentation generated for "$tag" release." \ | ||
|| echo "⚠️ Documentation skipped for "$tag"."; | ||
fi | ||
fi; | ||
done | ||
|
||
- name: Fix permissions | ||
run: 'sudo chown -R $USER docs-out' | ||
- name: Publish documentation to GitHub Pages | ||
uses: JamesIves/github-pages-deploy-action@4.1.7 | ||
with: | ||
branch: gh-pages | ||
folder: docs-out | ||
single-commit: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters