-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Features + GitHub Actions Workflows + Dependency Manager Contract…
… Files (#1) * feat: create directory Since it's the first feature to be implemented, it includes adding the new files. * feat: delete directory Includes a few refactors on create directory to keep structure as similar as possible. * chore: manage to be deprecated method Create a URLFactory that, depending on the current build iOS version, uses the new or current (to be deprecated) version of creating an URL based on a path string. * feat: list directory Refactor existing implementation to use the new method. * feat: read file Refactor project to make it easier to navigate. Add new swiftlint disabled rule. * feat: get file url Exchange URLFactory with an extension as there are now 2 methods being used and it makes sense to group it all. * feat: delete file * feat: save file * feat: append data to file * feat: get item attributes * feat: rename and copy item Split OSFLSTFileManagerTests file into different extensions to avoid SwiftLint warnings. * fix: Xcode 15 compatibility issue For Xcode 15, 'switch' statements may only be used as expression in return, throw, or as the source of an assignment. * chore: rename FLST to FILE * chore: add build folder to gitignore * chore: use URL instead of Path This makes the whole library simpler to use. Adapt tests accordingly. Remove redundant code. Add two missing tests, one for rename and another for copy, where the FileManager fails its operations. * feat: use directory types instead of search paths and add 2 new values These new values accommodate values required by the Cordova plugin. By having this, the name "SearchPath" doesn't make sense anymore, which justifies its update to DirectoryType. Add tests for these new types. * chore: remove encoding from path Apply some additional refactoring. * feat: add read file in chunks rename the old readFile method to readEntireFile for easier separation of concerns. * chore: adapt chunk size to encoding type Byte buffers, since they're Base64 data, need to be encoding in multiple of 3 sizes. * chore: add error when not able to handle file This is added to the OSFILEChunkSubscription flow. Add unit test to validate scenario. * chore: change naming Adopt the ION name instead of OS. Update Gemfile bundles. * chore: add GitHub Actions workflows * chore: add SwiftPackageManager file * chore: set initial project and marketing versions * fix: failing workflow unit tests Removed a readFileInChunks test as it proved unreliable for versions below iOS 18. * chore: add CHANGELOG entries * fix: add possibility to return byteBuffer on both read file methods This aligns the read methods with the approach already used for write. * chore: address PR comments * fix: address PR comments + refactors Remove the return statement from saveFile. Align getItemAttributes with the rest of the protocol's methods: to receive a URL instead of a plain-text path. Add the withSecurityScopedAccess verification to all operations. Add read file validations to validate the behaviour when the file doesn't exists. Refactor the code a bit, to remove unnecessary protocol logic. * chore: revert code for copy and rename This introduced a change in the logic so it reverts it. * chore: add descriptive message to all errors
- Loading branch information
1 parent
d3e1b71
commit 055e50b
Showing
30 changed files
with
1,999 additions
and
123 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,34 @@ | ||
name: Continuous Integration | ||
|
||
on: | ||
push: | ||
branches: | ||
- main, development | ||
pull_request: | ||
types: [opened, synchronize, reopened] | ||
|
||
jobs: | ||
sonarcloud: | ||
name: Unit-Tests | ||
runs-on: macos-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Link SwiftLint or install it | ||
run: brew link --overwrite swiftlint || brew install swiftlint | ||
|
||
- name: Set up XCode | ||
run: sudo xcode-select --switch /Applications/Xcode_15.0.app | ||
|
||
- name: Bundle Install | ||
run: bundle install | ||
|
||
- name: Unit tests | ||
run: bundle exec fastlane unit_tests | ||
|
||
- name: Code Coverage | ||
run: bundle exec fastlane coverage | ||
|
||
- name: Lint | ||
run: bundle exec fastlane lint |
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,81 @@ | ||
name: Prepare Release | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
versionBumpLevel: | ||
description: 'Version bump level (patch, minor, major)' | ||
required: true | ||
type: choice | ||
default: 'patch' | ||
options: | ||
- patch | ||
- minor | ||
- major | ||
|
||
jobs: | ||
build-and-release: | ||
if: github.ref == 'refs/heads/main' | ||
runs-on: macos-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Link SwiftLint or install it | ||
run: brew link --overwrite swiftlint || brew install swiftlint | ||
|
||
- name: Set up XCode | ||
run: sudo xcode-select --switch /Applications/Xcode_15.0.app | ||
|
||
- name: Set up Ruby | ||
uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: '3.3' | ||
|
||
- name: Bump version | ||
run: ruby ./scripts/bump_versions.rb ${{ github.event.inputs.versionBumpLevel }} | ||
|
||
- name: Build XCFramework | ||
run: ./scripts/build_framework.sh | ||
|
||
- name: Get new version | ||
id: version | ||
run: echo "VERSION=$(ruby -e 'puts File.read("./IONFilesystemLib.podspec").match(/spec.version.*=.*''(\d+\.\d+\.\d+)''/)[1]')" >> $GITHUB_ENV | ||
|
||
- name: Create new branch | ||
run: | | ||
git switch --create "prepare-new-release-${{ env.VERSION }}" | ||
- name: Move zip file to root and push changes | ||
run: | | ||
if [ -f IONFilesystemLib.zip ]; then | ||
rm IONFilesystemLib.zip | ||
else | ||
echo "File does not exist." | ||
fi | ||
mv build/IONFilesystemLib.zip . | ||
git config --global user.name 'github-actions[bot]' | ||
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | ||
git add . | ||
git commit -m "chore: Bump version to ${{ env.VERSION }}" | ||
git push origin HEAD:prepare-new-release-${{ env.VERSION }} | ||
- name: Create pull request | ||
id: create_pr | ||
run: | | ||
gh pr create -B main -H prepare-new-release-${{ env.VERSION }} --title 'Prepare `main` to Release `${{ env.VERSION }}`' --body 'Bumps version to `${{ env.VERSION }}`.<br/>Creates an updated and ready-to-be-released `IONFilesystemLib.zip`.' | ||
PR_NUMBER=$(gh pr view --json number --jq '.number') | ||
echo "PR_NUMBER=${PR_NUMBER}" >> $GITHUB_ENV | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Add label to the pull request | ||
run: | | ||
gh api \ | ||
--method POST \ | ||
-H "Accept: application/vnd.github+json" \ | ||
-H "X-GitHub-Api-Version: 2022-11-28" \ | ||
/repos/${{ github.repository }}/issues/${{ env.PR_NUMBER }}/labels \ | ||
-f "labels[]=release" | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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,67 @@ | ||
name: Release and Publish | ||
|
||
on: | ||
pull_request: | ||
types: [closed] | ||
branches: | ||
- 'main' | ||
|
||
jobs: | ||
post-merge: | ||
if: contains(github.event.pull_request.labels.*.name, 'release') && github.event.pull_request.merged == true | ||
runs-on: macos-latest | ||
|
||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Cocoapods | ||
run: gem install cocoapods | ||
|
||
- name: Get new version | ||
id: version | ||
run: echo "VERSION=$(ruby -e 'puts File.read("./IONFilesystemLib.podspec").match(/spec.version.*=.*''(\d+\.\d+\.\d+)''/)[1]')" >> $GITHUB_ENV | ||
|
||
- name: Extract release notes | ||
run: sh scripts/extract_release_notes.sh "${{ env.VERSION }}" >> release_notes.md | ||
|
||
- name: Create Tag | ||
id: create_tag | ||
run: | | ||
# Define the tag name and message | ||
TAG_NAME="${{ env.VERSION }}" | ||
TAG_MESSAGE="Tag for version ${{ env.VERSION }}" | ||
# Create the tag | ||
git tag -a "$TAG_NAME" -m "$TAG_MESSAGE" | ||
git push origin "$TAG_NAME" | ||
echo "Tag created: $TAG_NAME" | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Create Release | ||
run: | | ||
# Extract the tag name | ||
TAG_NAME="${{ env.VERSION }}" | ||
RELEASE_NOTES="$(cat release_notes.md)" | ||
# Create the release using GitHub CLI | ||
gh release create "$TAG_NAME" \ | ||
--title "$TAG_NAME" \ | ||
--notes "$RELEASE_NOTES" \ | ||
"IONFilesystemLib.zip" | ||
echo "Release created for tag: $TAG_NAME" | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Deploy to Cocoapods | ||
run: pod trunk push ./IONFilesystemLib.podspec --allow-warnings | ||
env: | ||
COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }} | ||
|
||
- name: Delete Release Branch | ||
run: git push origin --delete prepare-new-release-${{ env.VERSION }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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 |
---|---|---|
|
@@ -60,3 +60,5 @@ fastlane/report.xml | |
fastlane/Preview.html | ||
fastlane/screenshots/**/*.png | ||
fastlane/test_output | ||
|
||
build/ |
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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
disabled_rules: | ||
- trailing_whitespace | ||
- switch_case_alignment | ||
opt_in_rules: | ||
- empty_count | ||
- empty_string | ||
|
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
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
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 |
---|---|---|
@@ -1,21 +1,21 @@ | ||
Pod::Spec.new do |spec| | ||
spec.name = 'OSFilesystemLib' | ||
spec.name = 'IONFilesystemLib' | ||
spec.version = '0.0.1' | ||
|
||
spec.summary = 'The `OSFilesystemLib` is a template library.' | ||
spec.summary = 'The `IONFilesystemLib` is a template library.' | ||
spec.description = <<-DESC | ||
The `OSFilesystemLib` is a template library. | ||
The `IONFilesystemLib` is a template library. | ||
The `OSFilesystemLib` structure provides the main feature of the Library: | ||
The `IONFilesystemLib` structure provides the main feature of the Library: | ||
- ping: A simple echo function that returns the input string. | ||
DESC | ||
|
||
spec.homepage = 'https://github.com/ionic-team/OSFilesystemLib-iOS' | ||
spec.homepage = 'https://github.com/ionic-team/IONFilesystemLib-iOS' | ||
spec.license = { :type => 'MIT', :file => 'LICENSE' } | ||
spec.author = { 'OutSystems Mobile Ecosystem' => '[email protected]' } | ||
|
||
spec.source = { :http => "https://github.com/ionic-team/OSFilesystemLib-iOS/releases/download/#{spec.version}/OSFilesystemLib.zip", :type => "zip" } | ||
spec.vendored_frameworks = "OSFilesystemLib.xcframework" | ||
spec.source = { :http => "https://github.com/ionic-team/IONFilesystemLib-iOS/releases/download/#{spec.version}/IONFilesystemLib.zip", :type => "zip" } | ||
spec.vendored_frameworks = "IONFilesystemLib.xcframework" | ||
|
||
spec.ios.deployment_target = '14.0' | ||
spec.swift_versions = ['5.0', '5.1', '5.2', '5.3', '5.4', '5.5', '5.6', '5.7', '5.8', '5.9'] | ||
|
Oops, something went wrong.