Skip to content

Commit

Permalink
Replace Fastlane with Shell scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
danielsaidi committed Oct 4, 2024
1 parent fd34eac commit 13ad9a5
Show file tree
Hide file tree
Showing 19 changed files with 409 additions and 106 deletions.
12 changes: 0 additions & 12 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1 @@
# These are supported funding model platforms

github: [danielsaidi]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
21 changes: 5 additions & 16 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,16 @@ on:
branches: ["main"]
pull_request:
branches: ["main"]

env:
SCHEME: OnboardingKit

jobs:
build:
runs-on: macos-13
runs-on: macos-15
steps:
- uses: actions/checkout@v3
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: '15.1.0'
- name: Build iOS
run: xcodebuild -scheme $SCHEME -derivedDataPath .build -destination 'generic/platform=iOS';
- name: Build macOS
run: xcodebuild -scheme $SCHEME -derivedDataPath .build -destination 'generic/platform=OS X';
- name: Build tvOS
run: xcodebuild -scheme $SCHEME -derivedDataPath .build -destination 'generic/platform=tvOS';
- name: Build watchOS
run: xcodebuild -scheme $SCHEME -derivedDataPath .build -destination 'generic/platform=watchOS';
- name: Build visionOS
run: xcodebuild -scheme $SCHEME -derivedDataPath .build -destination 'generic/platform=xrOS';
xcode-version: '16.0'
- name: Build all platforms
run: bash scripts/build.sh ${{ github.event.repository.name }}
- name: Test iOS
run: xcodebuild test -scheme $SCHEME -derivedDataPath .build -destination 'platform=iOS Simulator,name=iPhone 15,OS=17.2' -enableCodeCoverage YES;
run: bash scripts/test.sh ${{ github.event.repository.name }}
21 changes: 5 additions & 16 deletions .github/workflows/docc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,34 +24,23 @@ jobs:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: macos-13
runs-on: macos-15
steps:
- name: Checkout
uses: actions/checkout@v3
- id: pages
name: Setup Pages
uses: actions/configure-pages@v4
- name: Select Xcode 15.1
- name: Select Xcode version
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: '15.1.0'
xcode-version: '16.0'
- name: Build DocC
run: |
swift package resolve;
xcodebuild docbuild -scheme OnboardingKit -derivedDataPath /tmp/docbuild -destination 'generic/platform=iOS';
$(xcrun --find docc) process-archive \
transform-for-static-hosting /tmp/docbuild/Build/Products/Debug-iphoneos/OnboardingKit.doccarchive \
--output-path docs \
--hosting-base-path 'OnboardingKit';
echo "<script>window.location.href += \"/documentation/onboardingkit\"</script>" > docs/index.html;
run: bash scripts/docc.sh ${{ github.event.repository.name }}
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: 'docs'
path: '.build/docs'
- id: deployment
name: Deploy to GitHub Pages
uses: actions/deploy-pages@v4
53 changes: 0 additions & 53 deletions Fastlane/Fastfile

This file was deleted.

12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<p align="center">
<img src ="Resources/Logo_GitHub.png" alt="OnboardingKit Logo" title="OnboardingKit" />
<img src ="Resources/Logo_Rounded.png" alt="OnboardingKit Logo" title="OnboardingKit" />
</p>

<p align="center">
<img src="https://img.shields.io/github/v/release/danielsaidi/OnboardingKit?color=%2300550&sort=semver" alt="Version" />
<img src="https://img.shields.io/badge/Swift-5.9-orange.svg" alt="Swift 5.9" />
<img src="https://img.shields.io/badge/Swift-6.0-orange.svg" alt="Swift 5.9" />
<img src="https://img.shields.io/badge/platform-SwiftUI-blue.svg" alt="Swift UI" title="Swift UI" />
<img src="https://img.shields.io/github/license/danielsaidi/OnboardingKit" alt="MIT License" />
<a href="https://twitter.com/danielsaidi"><img src="https://img.shields.io/twitter/url?label=Twitter&style=social&url=https%3A%2F%2Ftwitter.com%2Fdanielsaidi" alt="Twitter: @danielsaidi" title="Twitter: @danielsaidi" /></a>
Expand Down Expand Up @@ -72,19 +72,19 @@ struct ContentView: View {

The onboarding will honor its own rules and remember any previous presentation, so `tryPresent` will only trigger when it makes sense for the onboarding.

For more information, please see the [getting started guide][Getting-Started].
See the online [getting started guide][Getting-Started] for more information.



## Documentation

The [online documentation][Documentation] has more information, articles, code examples, etc.
The online [documentation][Documentation] has more information, articles, code examples, etc.



## Demo Application

The demo app lets you explore the library. To try it out, just open and run the `Demo` project.
The `Demo` folder has an app that lets you explore the library.



Expand Down Expand Up @@ -124,7 +124,7 @@ OnboardingKit is available under the MIT license. See the [LICENSE][License] fil

[Gif]: https://github.com/danielsaidi/OnboardingKit/releases/download/8.0.0/Demo.gif

[Documentation]: https://danielsaidi.github.io/OnboardingKit/documentation/onboardingkit/
[Documentation]: https://danielsaidi.github.io/OnboardingKit
[Getting-Started]: https://danielsaidi.github.io/OnboardingKit/documentation/onboardingkit/getting-started

[License]: https://github.com/danielsaidi/OnboardingKit/blob/master/LICENSE
6 changes: 6 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ Breaking changes can still occur in minor updates, if there's a strong reason fo



## 8.1

This version updates the package for Swift 6.



## 8.0

This version adds support for strict concurrency and a new `OnboardingSlideshow` component.
Expand Down
File renamed without changes
3 changes: 0 additions & 3 deletions Version

This file was deleted.

47 changes: 47 additions & 0 deletions scripts/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/bin/bash

# Documentation:
# This script builds a <TARGET> for all supported platforms.

# Exit immediately if a command exits with a non-zero status
set -e

# Verify that all required arguments are provided
if [ $# -eq 0 ]; then
echo "Error: This script requires exactly one argument"
echo "Usage: $0 <TARGET>"
exit 1
fi

# Create local argument variables.
TARGET=$1

# Use the script folder to refer to other scripts.
FOLDER="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
SCRIPT="$FOLDER/build_platform.sh"

# Make the script executable
chmod +x $SCRIPT

# A function that builds a specific platform
build_platform() {
local platform=$1
echo "Building for $platform..."
if ! bash $SCRIPT $TARGET $platform; then
echo "Failed to build $platform"
return 1
fi
echo "Successfully built $platform"
}

# Array of platforms to build
platforms=("iOS" "macOS" "tvOS" "watchOS" "xrOS")

# Loop through platforms and build
for platform in "${platforms[@]}"; do
if ! build_platform "$platform"; then
exit 1
fi
done

echo "All platforms built successfully!"
16 changes: 16 additions & 0 deletions scripts/build_platform.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

# Documentation:
# This script builds a <TARGET> for a specific <PLATFORM>.

# Verify that all required arguments are provided
if [ $# -ne 2 ]; then
echo "Error: This script requires exactly two arguments"
echo "Usage: $0 <TARGET> <PLATFORM>"
exit 1
fi

TARGET=$1
PLATFORM=$2

xcodebuild -scheme $TARGET -derivedDataPath .build -destination generic/platform=$PLATFORM
26 changes: 26 additions & 0 deletions scripts/docc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash

# Documentation:
# This script build DocC for a <TARGET>.
# The documentation ends up in to .build/docs.

# Verify that all required arguments are provided
if [ $# -eq 0 ]; then
echo "Error: This script requires exactly one argument"
echo "Usage: $0 <TARGET>"
exit 1
fi

TARGET=$1
TARGET_LOWERCASED=$(echo "$1" | tr '[:upper:]' '[:lower:]')

swift package resolve;

xcodebuild docbuild -scheme $1 -derivedDataPath /tmp/docbuild -destination 'generic/platform=iOS';

$(xcrun --find docc) process-archive \
transform-for-static-hosting /tmp/docbuild/Build/Products/Debug-iphoneos/$1.doccarchive \
--output-path .build/docs \
--hosting-base-path "$TARGET";

echo "<script>window.location.href += \"/documentation/$TARGET_LOWERCASED\"</script>" > .build/docs/index.html;
47 changes: 47 additions & 0 deletions scripts/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/bin/bash

# Documentation:
# This script tests a <TARGET> for all supported platforms.

# Exit immediately if a command exits with a non-zero status
set -e

# Verify that all required arguments are provided
if [ $# -eq 0 ]; then
echo "Error: This script requires exactly one argument"
echo "Usage: $0 <TARGET>"
exit 1
fi

# Create local argument variables.
TARGET=$1

# Use the script folder to refer to other scripts.
FOLDER="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
SCRIPT="$FOLDER/test_platform.sh"

# Make the script executable
chmod +x $SCRIPT

# A function that tests a specific platform
test_platform() {
local platform=$1
echo "Testing for $platform..."
if ! bash $SCRIPT $TARGET $platform; then
echo "Failed to test $platform"
return 1
fi
echo "Successfully tested $platform"
}

# Array of platforms to test
platforms=("platform=iOS_Simulator,name=iPhone_16")

# Loop through platforms and build
for platform in "${platforms[@]}"; do
if ! test_platform "$platform"; then
exit 1
fi
done

echo "All platforms tested successfully!"
17 changes: 17 additions & 0 deletions scripts/test_platform.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

# Documentation:
# This script tests a <TARGET> for a specific platform.
# Use _ instead of spaces when passing in the <PLATFORM>.

# Verify that all required arguments are provided
if [ $# -ne 2 ]; then
echo "Error: This script requires exactly two arguments"
echo "Usage: $0 <TARGET> <PLATFORM>"
exit 1
fi

TARGET=$1
PLATFORM="${2//_/ }"

xcodebuild test -scheme $TARGET -derivedDataPath .build -destination "$PLATFORM" -enableCodeCoverage YES;
Loading

0 comments on commit 13ad9a5

Please sign in to comment.