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

Build Pipelines #176

Merged
merged 69 commits into from
Mar 18, 2020
Merged
Show file tree
Hide file tree
Changes from 65 commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
d1232c0
url property is now null-aware
bhl09 Jan 27, 2020
9ca7bcd
Merge pull request #156 from builttoroam/uri_null_aware
bhl09 Jan 27, 2020
7dfa1b6
fixed nullable allDay error
fmatera-duckma Jan 28, 2020
a2438e2
allDay hotfix and version update
bhl09 Jan 29, 2020
9106be6
Merge pull request #159 from builttoroam/allday_hotfix
bhl09 Jan 30, 2020
bdfbd2f
"&" to "&&"
bhl09 Feb 3, 2020
742f325
updated version/changelog
bhl09 Feb 3, 2020
ffc23d4
Removed unecessary import
bhl09 Feb 3, 2020
5537a32
Merge pull request #163 from builttoroam/allday_hotfix2
bhl09 Feb 3, 2020
c4cbb89
Initial strcture of the CI | CD pipeline
mkieres Mar 3, 2020
2100474
Commenting out macOS pool agent
mkieres Mar 3, 2020
eea6d7b
Add flutter install/build and dry run
bhl09 Mar 3, 2020
dd23424
Update pool
bhl09 Mar 3, 2020
624a097
Update build path
bhl09 Mar 3, 2020
c04fb12
Update dry run command
bhl09 Mar 3, 2020
cd3b7c5
Update flutter path
bhl09 Mar 3, 2020
bcc6c05
Add working directory for command line
bhl09 Mar 3, 2020
ec434bf
Update command line
bhl09 Mar 3, 2020
6354452
Fix path
bhl09 Mar 3, 2020
b057a96
Change to Windows
bhl09 Mar 3, 2020
931725e
Testing versioning
bhl09 Mar 3, 2020
775dd61
Fix wrong variable
bhl09 Mar 3, 2020
a6c8602
Update task name
bhl09 Mar 3, 2020
03f77ae
Fix indenting
bhl09 Mar 3, 2020
30dec31
Update regex and fix typo
bhl09 Mar 3, 2020
48f9345
Update regex
bhl09 Mar 3, 2020
264f204
Update regex
bhl09 Mar 3, 2020
fad6fca
Update powershell script
bhl09 Mar 3, 2020
72e15bd
GitHub tagging
bhl09 Mar 3, 2020
1789362
Testing version
bhl09 Mar 4, 2020
c9a8c06
Update powershell
bhl09 Mar 4, 2020
f63b352
Testing GitHub release
bhl09 Mar 4, 2020
b9828c3
Add release title
bhl09 Mar 4, 2020
908d81c
Clean up CI & Add display names
bhl09 Mar 4, 2020
29ea33c
Testing CI and CD
bhl09 Mar 4, 2020
e54a268
Disable codesign for ios build
bhl09 Mar 4, 2020
16c3fe7
Add assets to github release
bhl09 Mar 4, 2020
d73107a
Add --force command for publish
bhl09 Mar 4, 2020
aa817e3
Update design
bhl09 Mar 4, 2020
c2713a2
Update pre-release versioning
bhl09 Mar 4, 2020
44e02dd
Update condition for testing
bhl09 Mar 4, 2020
b07c20c
Update versioning powershell
bhl09 Mar 4, 2020
c49668c
Update get version path
bhl09 Mar 4, 2020
8d83057
Pipeline ready
bhl09 Mar 4, 2020
13d77f2
Add path filter
bhl09 Mar 4, 2020
2e7ccad
Update pre-release changelog
bhl09 Mar 4, 2020
934756c
Fix spacing
bhl09 Mar 5, 2020
d764d1e
Add logging
bhl09 Mar 5, 2020
4c741b7
Fix scripts
bhl09 Mar 5, 2020
dbb0508
Fix variable
bhl09 Mar 5, 2020
22d94ab
Test dry run
bhl09 Mar 5, 2020
ae0329e
Update test script
bhl09 Mar 5, 2020
f7b3a97
Fix script
bhl09 Mar 5, 2020
b364e81
Remove test methods
bhl09 Mar 5, 2020
38828df
Add spacing
bhl09 Mar 5, 2020
9476f67
Naming and positioning update
bhl09 Mar 5, 2020
625b282
Update to aab and get version summary
bhl09 Mar 5, 2020
228061b
Merge branch 'master' into azure-pipelines
bhl09 Mar 5, 2020
c59e992
Added version summary
bhl09 Mar 5, 2020
8adf76b
Applying minor bug fixes in develop branch
bhl09 Mar 5, 2020
7f3bbac
Update GitHub release
bhl09 Mar 6, 2020
68270a1
Addded a dash
bhl09 Mar 6, 2020
35d7ff7
Add conditions
bhl09 Mar 6, 2020
31abc54
Update variables
bhl09 Mar 13, 2020
592d438
Update namings
bhl09 Mar 13, 2020
302fc55
Update variables
bhl09 Mar 16, 2020
58c4b7e
Removed header comments
bhl09 Mar 18, 2020
777a7bc
Publish first than GitHub tag
bhl09 Mar 18, 2020
a9226d8
Update to publish hotfix as well
bhl09 Mar 18, 2020
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
187 changes: 187 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
# Starter pipeline
bhl09 marked this conversation as resolved.
Show resolved Hide resolved
# Start with a minimal pipeline that you can customize to build and deploy your code.
# Add steps that build, run tests, deploy, and more:
# https://aka.ms/yaml

variables:
# The $(FlutterToolPath) variable is generated by the FlutterInstall task
# See code in the Flutter Build task https://github.com/aloisdeniel/vsts-flutter-tasks/blob/master/tasks/build/index.ts
flutterExecPath: $(FlutterToolPath)/flutter.bat
versionNumberRegex: '(?<=version: ).*'

trigger:
batch: 'true'
branches:
include:
- develop
- release
- hotfix
- master
bhl09 marked this conversation as resolved.
Show resolved Hide resolved
paths:
include:
- device_calendar/*

stages:
# ----------- CI -----------
- stage: Build
jobs:
- job: BuildAndroidAndIos
pool:
vmImage: 'macOS-latest'
steps:
- task: FlutterInstall@0
displayName: 'Flutter install'
inputs:
channel: 'stable'
version: 'latest'

- task: FlutterBuild@0
displayName: 'Flutter build - Android'
inputs:
target: 'aab'
projectDirectory: 'device_calendar/example'

- task: FlutterBuild@0
displayName: 'Flutter build - iOS'
inputs:
target: 'ios'
projectDirectory: 'device_calendar/example'
iosCodesign: false

# -----------CD Pre-release -----------
- stage: DevelopmentRelease
dependsOn: Build
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'ref/release'), eq(variables['Build.SourceBranch'], 'refs/hotfix'))
jobs:
- job: ReleaseDevelopmentVersion
pool:
vmImage: 'windows-latest'
steps:
- task: FlutterInstall@0
displayName: 'Flutter install'
inputs:
channel: 'stable'
version: 'latest'

- task: PowerShell@2
condition: eq(variables['Build.SourceBranch'], 'ref/release')
displayName: 'Pre-release versioning - pubspec.yaml'
inputs:
targetType: 'inline'
script: |
[string] $version = select-string -path "$(Build.SourcesDirectory)/device_calendar/pubspec.yaml" -pattern "$(versionGetRegex)" | %{ $_.Matches[0].Value }
Write-Host "##vso[task.setvariable variable=currentVersion]$version"

[string] $pubspecContent = Get-Content -Path "$(Build.SourcesDirectory)/device_calendar/pubspec.yaml" -Raw
bhl09 marked this conversation as resolved.
Show resolved Hide resolved

Write-Host " (i) Current version: $version"
Write-Host " (i) Original pubspec.yaml content: $pubspecContent"

[string] $newPubspecContent = $pubspecContent -replace $version, "$version-dev.$(Build.BuildID)"
bhl09 marked this conversation as resolved.
Show resolved Hide resolved

Write-Host " (i) Updated pubspec.yaml content: $newPubspecContent"

$newPubspecContent | Set-Content -Path "$(Build.SourcesDirectory)/device_calendar/pubspec.yaml"

- task: PowerShell@2
condition: eq(variables['Build.SourceBranch'], 'ref/release')
displayName: 'Pre-release versioning - CHANGELOG.md'
inputs:
targetType: 'inline'
script: |
[string] $changelogContent = Get-Content -Path "$(Build.SourcesDirectory)/device_calendar/CHANGELOG.md" -Raw

Write-Host " (i) Current version: $env.currentVersion"
Write-Host " (i) Original CHANGELOG.md content: $changelogContent"

[string] $newChangelogContent = $changelogContent -replace $env:currentVersion, "$env:currentVersion-dev.$(Build.BuildID)"

Write-Host " (i) Updated CHANGELOG.md content: $newChangelogContent"

$newChangelogContent | Set-Content -Path "$(Build.SourcesDirectory)/device_calendar/CHANGELOG.md"

- task: CmdLine@2
displayName: 'Dry run publish'
inputs:
workingDirectory: '$(Build.SourcesDirectory)/device_calendar'
script: '$(flutterExecPath) pub publish --dry-run'

- task: CmdLine@2
bhl09 marked this conversation as resolved.
Show resolved Hide resolved
condition: eq(variables['Build.SourceBranch'], 'ref/release')
displayName: 'Publish'
inputs:
workingDirectory: '$(Build.SourcesDirectory)/device_calendar'
script: '$(flutterExecPath) pub publish --force'

# ----------- CD Production -----------
- stage: Release
dependsOn: Build
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/master'))
bhl09 marked this conversation as resolved.
Show resolved Hide resolved
jobs:
- job: Release
pool:
vmImage: 'windows-latest'
steps:
- task: FlutterInstall@0
displayName: 'Flutter install'
inputs:
channel: 'stable'
version: 'latest'

- task: PowerShell@2
displayName: 'Get version from pubspec.yaml'
inputs:
targetType: 'inline'
script: |
[string] $version = select-string -path "$(Build.SourcesDirectory)/device_calendar/pubspec.yaml" -pattern $(versionGetRegex) | %{ $_.Matches[0].Value }

Write-Host "##vso[task.setvariable variable=currentVersion]$version"

- task: PowerShell@2
displayName: 'Get version summary from CHANGELOG.md'
inputs:
targetType: 'inline'
script: |
[string] $summary = select-string -path "$(Build.SourcesDirectory)/device_calendar/CHANGELOG.md" -pattern "($([regex]::escape($env:currentVersion))).*" | %{ $_.Matches[0].Value }

Write-Host "##vso[task.setvariable variable=versionSummary]$summary"

- task: GitHubReleasePublish@1
displayName: 'Tag a release to GitHub'
inputs:
githubEndpoint: 'GitHub Tagging'
manuallySetRepository: false
bhl09 marked this conversation as resolved.
Show resolved Hide resolved
githubRepository: 'builttoroam/flutter_plugins'
githubTag: 'v$(currentVersion)'
githubReleaseTitle: '$(versionSummary)'
githubReleaseDraft: false
githubReleasePrerelease: false
githubIgnoreAssets: false
githubReleaseAsset: '$(Build.ArtifactStagingDirectory)/*'
nickrandolph marked this conversation as resolved.
Show resolved Hide resolved
githubReuseRelease: false
githubReuseDraftOnly: false
githubSkipDuplicatedAssets: false
githubEditRelease: false
githubDeleteEmptyTag: false

- task: CmdLine@2
bhl09 marked this conversation as resolved.
Show resolved Hide resolved
displayName: 'Dry run publish'
inputs:
workingDirectory: '$(Build.SourcesDirectory)/device_calendar'
script: '$(flutterExecPath) pub publish --dry-run'
bhl09 marked this conversation as resolved.
Show resolved Hide resolved

- task: CmdLine@2
displayName: 'Publish'
inputs:
workingDirectory: '$(Build.SourcesDirectory)/device_calendar'
script: '$(flutterExecPath) pub publish --force'

- task: GitHubRelease@1
displayName: 'Remove GitHub tag when publish fails'
condition: failed()
bhl09 marked this conversation as resolved.
Show resolved Hide resolved
inputs:
gitHubConnection: 'GitHub Tagging'
repositoryName: 'builttoroam/flutter_plugins'
action: 'delete'
tag: 'v$(currentVersion)'

14 changes: 13 additions & 1 deletion device_calendar/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Changelog

## 3.1.0
## 3.1.0 6th March 2020 - Bug fixes and new features

* Boolean variable `isDefault` added for issue [145](https://github.com/builttoroam/flutter_plugins/issues/145) (**NOTE**: This is not supported Android API 16 or lower, `isDefault` will always be false)
* Events with 'null' title now defaults to 'New Event', issue [126](https://github.com/builttoroam/flutter_plugins/issues/126)
Expand All @@ -11,6 +11,18 @@
* Added to retrieve colour for calendars. Thanks to [nadavfima](https://github.com/nadavfima) for the contribution and PR to add colour support for both Android and iOS
* Added compatibility with a new Flutter plugin for Android. Thanks to the PR submitted by [RohitKumarMishra](https://github.com/RohitKumarMishra)

## 3.0.0+3 3rd February 2020

* Fixed all day conditional check for issue [162](https://github.com/builttoroam/flutter_plugins/issues/162)

## 3.0.0+2 30th January 2020

* Updated `event.allDay` property in `createOrUpdateEvent` method to be null-aware

## 3.0.0+1 28th January 2020

* Updated `event.url` property in `createOrUpdateEvent` method to be null-aware for issue [152](https://github.com/builttoroam/flutter_plugins/issues/152)

## 3.0.0 21st January 2020

* **BREAKING CHANGE** Properties for the attendee model in `attendee.dart` file have been changed:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,9 @@ class CalendarDelegate : PluginRegistry.RequestPermissionsResultListener {
val uri: Uri = CalendarContract.Calendars.CONTENT_URI

val cursor: Cursor? = if (atLeastAPI(17)) {
contentResolver?.query(uri, CALENDAR_PROJECTION, null, null, null)
contentResolver?.query(ContentUris.withAppendedId(uri, calendarIdNumber), CALENDAR_PROJECTION, null, null, null)
} else {
contentResolver?.query(uri, CALENDAR_PROJECTION_OLDER_API, null, null, null)
contentResolver?.query(ContentUris.withAppendedId(uri, calendarIdNumber), CALENDAR_PROJECTION_OLDER_API, null, null, null)
}

try {
Expand Down
8 changes: 4 additions & 4 deletions device_calendar/lib/src/device_calendar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -167,16 +167,16 @@ class DeviceCalendarPlugin {
final res = Result<String>();

// Setting time to 0 for all day events
if (event.allDay) {
if (event.allDay == true) {
event.start = DateTime(event.start.year, event.start.month, event.start.day, 0, 0, 0);
event.end = DateTime(event.end.year, event.end.month, event.end.day, 0, 0, 0);
}

if (event.allDay && (event?.calendarId?.isEmpty ?? true) || event.start == null || event.end == null) {
if (event.allDay == true && (event?.calendarId?.isEmpty ?? true) || event.start == null || event.end == null) {
res.errorMessages.add('[${ErrorCodes.invalidArguments}] ${ErrorMessages.createOrUpdateEventInvalidArgumentsMessageAllDay}');
return res;
}
else if (!event.allDay & ((event?.calendarId?.isEmpty ?? true) || event.start == null || event.end == null || event.start.isAfter(event.end))) {
else if (event.allDay != true && ((event?.calendarId?.isEmpty ?? true) || event.start == null || event.end == null || event.start.isAfter(event.end))) {
res.errorMessages.add('[${ErrorCodes.invalidArguments}] ${ErrorMessages.createOrUpdateEventInvalidArgumentsMessage}');
return res;
}
Expand All @@ -193,7 +193,7 @@ class DeviceCalendarPlugin {
'eventStartDate': event.start.millisecondsSinceEpoch,
'eventEndDate': event.end.millisecondsSinceEpoch,
'eventLocation': event.location,
'eventURL': event.url.data.contentText,
'eventURL': event.url?.data?.contentText,
'recurrenceRule': event.recurrenceRule?.toJson(),
'attendees': event.attendees?.map((a) => a.toJson())?.toList(),
'reminders': event.reminders?.map((r) => r.toJson())?.toList()
Expand Down
2 changes: 1 addition & 1 deletion device_calendar/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ dependencies:
flutter:
sdk: flutter
meta: ^1.1.8
collection: any
collection: ^1.4.11

dev_dependencies:
flutter_test:
Expand Down