Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Features + GitHub Actions Workflows + Dependency Manager Contract Files #1

Merged
merged 31 commits into from
Feb 5, 2025
Merged
Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
9cf191f
feat: create directory
OS-ricardomoreirasilva Jan 10, 2025
378450d
feat: delete directory
OS-ricardomoreirasilva Jan 13, 2025
1509ebf
chore: manage to be deprecated method
OS-ricardomoreirasilva Jan 13, 2025
6b600f3
feat: list directory
OS-ricardomoreirasilva Jan 13, 2025
27b8636
feat: read file
OS-ricardomoreirasilva Jan 14, 2025
0a41e63
feat: get file url
OS-ricardomoreirasilva Jan 14, 2025
b671e03
feat: delete file
OS-ricardomoreirasilva Jan 14, 2025
e3e8010
feat: save file
OS-ricardomoreirasilva Jan 15, 2025
f21cacb
feat: append data to file
OS-ricardomoreirasilva Jan 15, 2025
6d47495
feat: get item attributes
OS-ricardomoreirasilva Jan 15, 2025
613458c
feat: rename and copy item
OS-ricardomoreirasilva Jan 15, 2025
b843ad1
fix: Xcode 15 compatibility issue
OS-ricardomoreirasilva Jan 16, 2025
8d74194
chore: rename FLST to FILE
OS-ricardomoreirasilva Jan 16, 2025
db3207c
chore: add build folder to gitignore
OS-ricardomoreirasilva Jan 16, 2025
3e1cab0
chore: use URL instead of Path
OS-ricardomoreirasilva Jan 17, 2025
33876ce
feat: use directory types instead of search paths and add 2 new values
OS-ricardomoreirasilva Jan 20, 2025
2187e2c
chore: remove encoding from path
OS-ricardomoreirasilva Jan 22, 2025
26b101f
feat: add read file in chunks
OS-ricardomoreirasilva Jan 28, 2025
52345b6
chore: adapt chunk size to encoding type
OS-ricardomoreirasilva Jan 29, 2025
a973830
chore: add error when not able to handle file
OS-ricardomoreirasilva Jan 30, 2025
6b4f37b
chore: change naming
OS-ricardomoreirasilva Jan 30, 2025
4c4d1f8
chore: add GitHub Actions workflows
OS-ricardomoreirasilva Jan 30, 2025
f8aa0ae
chore: add SwiftPackageManager file
OS-ricardomoreirasilva Jan 30, 2025
1d8421b
chore: set initial project and marketing versions
OS-ricardomoreirasilva Jan 30, 2025
6048412
fix: failing workflow unit tests
OS-ricardomoreirasilva Jan 30, 2025
b12b002
chore: add CHANGELOG entries
OS-ricardomoreirasilva Jan 31, 2025
e4ee1b3
fix: add possibility to return byteBuffer on both read file methods
OS-ricardomoreirasilva Jan 31, 2025
0cf7202
chore: address PR comments
OS-ricardomoreirasilva Jan 31, 2025
9b56301
fix: address PR comments + refactors
OS-ricardomoreirasilva Feb 3, 2025
b527a42
chore: revert code for copy and rename
OS-ricardomoreirasilva Feb 3, 2025
c964bb2
chore: add descriptive message to all errors
OS-ricardomoreirasilva Feb 4, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .github/workflows/continuous_integration.yml
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
81 changes: 81 additions & 0 deletions .github/workflows/prepare_release.yml
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 }}
67 changes: 67 additions & 0 deletions .github/workflows/release_and_publish.yml
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 }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,5 @@ fastlane/report.xml
fastlane/Preview.html
fastlane/screenshots/**/*.png
fastlane/test_output

build/
1 change: 1 addition & 0 deletions .swiftlint.yml
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
Expand Down
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,15 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Features
- Add read operations, namely `readEntireFile(atURL:withEncoding:)`, `readFileInChunks(atURL:withEncoding:andChunkSize:)`, `listDirectory(atURL:)`, `getItemAttributes(atPath:)` and `getFileURL(atPath: withSearchPath:)`.
- Add write operations, namely `saveFile(atURL:withEncodingAndData:includeIntermediateDirectories:)` and `appendData(_:atURL:includeIntermediateDirectories:)`.
- Add directory operations, namely `createDirectory(atURL:includeIntermediateDirectories:)` and `removeDirectory(atURL:includeIntermediateDirectories:)`.
- Add file management operations, namely `deleteFile(atURL:)`, `renameItem(fromURL:toURL:)` and `copyItem(fromURL:toURL:)`.

### Chores
- Add dependency management contract file for CocoaPods and Swift Package Manager.
- Add GitHub Actions workflows.
- Create Repository
48 changes: 26 additions & 22 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,20 @@ GEM
artifactory (3.0.17)
atomos (0.1.3)
aws-eventstream (1.3.0)
aws-partitions (1.1034.0)
aws-sdk-core (3.214.1)
aws-partitions (1.1043.0)
aws-sdk-core (3.217.0)
aws-eventstream (~> 1, >= 1.3.0)
aws-partitions (~> 1, >= 1.992.0)
aws-sigv4 (~> 1.9)
jmespath (~> 1, >= 1.6.1)
aws-sdk-kms (1.96.0)
aws-sdk-core (~> 3, >= 3.210.0)
aws-sdk-kms (1.97.0)
aws-sdk-core (~> 3, >= 3.216.0)
aws-sigv4 (~> 1.5)
aws-sdk-s3 (1.177.0)
aws-sdk-core (~> 3, >= 3.210.0)
aws-sdk-s3 (1.179.0)
aws-sdk-core (~> 3, >= 3.216.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.5)
aws-sigv4 (1.10.1)
aws-sigv4 (1.11.0)
aws-eventstream (~> 1, >= 1.0.2)
babosa (1.0.4)
base64 (0.2.0)
Expand All @@ -47,10 +47,10 @@ GEM
colored2 (3.1.2)
commander (4.6.0)
highline (~> 2.0.0)
concurrent-ruby (1.3.4)
concurrent-ruby (1.3.5)
connection_pool (2.5.0)
declarative (0.0.20)
digest-crc (0.6.5)
digest-crc (0.7.0)
rake (>= 12.0.0, < 14.0.0)
domain_name (0.6.20240107)
dotenv (2.8.1)
Expand Down Expand Up @@ -171,7 +171,7 @@ GEM
http-cookie (1.0.8)
domain_name (~> 0.5)
httpclient (2.8.3)
i18n (1.14.6)
i18n (1.14.7)
concurrent-ruby (~> 1.0)
jmespath (1.6.2)
json (2.9.1)
Expand All @@ -180,25 +180,27 @@ GEM
logger (1.6.5)
mini_magick (4.13.2)
mini_mime (1.1.5)
mini_portile2 (2.8.8)
minitest (5.25.4)
multi_json (1.15.0)
multipart-post (2.4.1)
nanaimo (0.4.0)
naturally (2.2.1)
nkf (0.2.0)
nokogiri (1.18.1)
mini_portile2 (~> 2.8.2)
nokogiri (1.18.2-aarch64-linux-gnu)
racc (~> 1.4)
nokogiri (1.18.1-aarch64-linux-gnu)
nokogiri (1.18.2-aarch64-linux-musl)
racc (~> 1.4)
nokogiri (1.18.1-arm-linux-gnu)
nokogiri (1.18.2-arm-linux-gnu)
racc (~> 1.4)
nokogiri (1.18.1-arm64-darwin)
nokogiri (1.18.2-arm-linux-musl)
racc (~> 1.4)
nokogiri (1.18.1-x86_64-darwin)
nokogiri (1.18.2-arm64-darwin)
racc (~> 1.4)
nokogiri (1.18.1-x86_64-linux-gnu)
nokogiri (1.18.2-x86_64-darwin)
racc (~> 1.4)
nokogiri (1.18.2-x86_64-linux-gnu)
racc (~> 1.4)
nokogiri (1.18.2-x86_64-linux-musl)
racc (~> 1.4)
optparse (0.6.0)
os (1.1.4)
Expand Down Expand Up @@ -258,12 +260,14 @@ GEM
xcpretty (~> 0.2, >= 0.0.7)

PLATFORMS
aarch64-linux
arm-linux
aarch64-linux-gnu
aarch64-linux-musl
arm-linux-gnu
arm-linux-musl
arm64-darwin
x86-linux
x86_64-darwin
x86_64-linux
x86_64-linux-gnu
x86_64-linux-musl

DEPENDENCIES
fastlane
Expand Down
14 changes: 7 additions & 7 deletions OSFilesystemLib.podspec → IONFilesystemLib.podspec
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']
Expand Down
Loading
Loading