Skip to content

Commit

Permalink
fix: CI Artifact Names and Android
Browse files Browse the repository at this point in the history
  • Loading branch information
Soap-141 committed Jun 4, 2024
1 parent e8fe0a4 commit 832aac5
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 16 deletions.
14 changes: 8 additions & 6 deletions build/azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,15 @@ stages:
androidArtifactName: 'GeneratedAndroidArtifact_Staging'
androidKeyPropertiesFile: $(InternalKeyProperties)
androidVariableGroup: 'FlutterApplicationTemplate.Distribution.Internal.Android'
iosArtifactName: 'GeneratediOSArtifact_Staging'
iosProvisioningProfileFile: $(InternalProvisioningProfile)
iosExportOptionsFile: $(InternalExportOptions)
iosCertificateFile: $(InternalCertificate)
iosVariableGroup: 'FlutterApplicationTemplate.Distribution.Internal.iOS'
releaseNotesArtifactName: 'GeneratedReleaseNotes_Staging'

- stage: Publish_Template_Package
condition: and(succeeded(), eq(variables['IsLightBuild'], 'false'), eq(variables['IsReleaseBranch'], 'true'))
condition: and(succeeded(), eq(variables['IsPullRequestBuild'], 'false'), eq(variables['IsReleaseBranch'], 'true'))
dependsOn:
- CopyTool_GeneratedApp
- Build_Staging_GeneratedApp
Expand All @@ -80,7 +82,7 @@ stages:
BannerVersionNameText: 'STAGING'

- stage: AppCenter_TestFlight_Staging
condition: and(succeeded(), eq(variables['IsLightBuild'], 'false'))
condition: and(succeeded(), eq(variables['IsPullRequestBuild'], 'false'))
dependsOn: Build_Staging
jobs:
- template: stage-release-appcenter.yml
Expand All @@ -100,7 +102,7 @@ stages:

- stage: Build_Production
dependsOn: Build_Staging
condition: and(succeeded(), eq(variables['IsLightBuild'], 'false'))
condition: and(succeeded(), eq(variables['IsPullRequestBuild'], 'false'))
jobs:
- template: stage-build.yml
parameters:
Expand All @@ -114,7 +116,7 @@ stages:
iosVariableGroup: 'FlutterApplicationTemplate.Distribution.AppStore'

- stage: AppCenter_Production
condition: and(succeeded(), eq(variables['IsLightBuild'], 'false'))
condition: and(succeeded(), eq(variables['IsPullRequestBuild'], 'false'))
dependsOn: Build_Production
jobs:
- template: stage-release-appcenter.yml
Expand All @@ -128,7 +130,7 @@ stages:
appCenterDistributionGroup: $(AppCenterDistributionGroup)

- stage: AppStore
condition: and(succeeded(), eq(variables['IsLightBuild'], 'false'))
condition: and(succeeded(), eq(variables['IsPullRequestBuild'], 'false'))
dependsOn: Build_Production
jobs:
- template: stage-release-appstore.yml
Expand All @@ -137,7 +139,7 @@ stages:
deploymentEnvironment: AppStore

- stage: GooglePlay
condition: and(succeeded(), eq(variables['IsLightBuild'], 'false'))
condition: and(succeeded(), eq(variables['IsPullRequestBuild'], 'false'))
dependsOn: Build_Production
jobs:
- template: stage-release-googleplay.yml
Expand Down
8 changes: 7 additions & 1 deletion build/stage-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
- name: androidArtifactName
type: string
default: $(AndroidArtifactName)_$(applicationEnvironment)
- name: iosArtifactName
type: string
default: $(iOSArtifactName)_$(applicationEnvironment)
- name: androidKeyStoreFile
type: string
default: ''
Expand Down Expand Up @@ -35,6 +38,9 @@
- name: removeHyperlinksFromReleaseNotes
type: boolean
default: false
- name: releaseNotesArtifactName
type: string
default: $(ReleaseNotesArtifactName)
- name: pathToSrc
type: string
default: '$(Build.SourcesDirectory)/src'
Expand All @@ -50,7 +56,7 @@ jobs:
pool:
vmImage : $(windowsHostedAgentImage)
variables:
ArtifactName: ReleaseNotes_${{ parameters.artifactName }}
ArtifactName: ${{ parameters.releaseNotesArtifactName }}
ApplicationEnvironment: ${{ parameters.applicationEnvironment }}
steps:
- template: steps-build-release-notes.yml
Expand Down
4 changes: 4 additions & 0 deletions build/steps-build-android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ steps:
inputs:
secureFile: ${{ parameters.androidKeyStorePropertiesFile }}

# TODO: If Production -> Download the google-services.json for production.

# The file copied inside the source directory must be aligned with the name chosen in '/src/app/lib/android/app/build.gradle' where 'key.properties' is loaded.
- task: PowerShell@2
displayName: Copy Signing Configuration Files
Expand All @@ -56,6 +58,8 @@ steps:
Copy-Item -Path '$(keyStore.secureFilePath)' -Destination '${{ parameters.pathToSrc }}\app\android\app\${{ parameters.androidKeystoreFile }}'
Write-Host 'Key store copied to ${{ parameters.pathToSrc }}/app/android/app/${{ parameters.androidKeystoreFile }}.'
# TODO: If Production -> Copy downloaded the google-services.json for production in the Android application folder.

- template: templates/flutter-prepare.yml
parameters:
projectDirectory: '${{ parameters.pathToSrc }}/app'
Expand Down
4 changes: 2 additions & 2 deletions build/steps-build-ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ steps:
condition: failed()

- task: Xcode@5
condition: and(succeeded(), eq(variables['IsLightBuild'], 'false'))
condition: and(succeeded(), eq(variables['IsPullRequestBuild'], 'false'))
displayName: 'Xcode Archive iOS'
inputs:
actions: 'archive'
Expand All @@ -115,7 +115,7 @@ steps:
provisioningProfileName: '$(provisioningProfile.provisioningProfileName)'

- task: CopyFiles@2
condition: and(succeeded(), eq(variables['IsLightBuild'], 'false'))
condition: and(succeeded(), eq(variables['IsPullRequestBuild'], 'false'))
displayName: 'Copy Binary Files'
inputs:
sourceFolder: '${{ parameters.pathToSrc }}/app'
Expand Down
5 changes: 3 additions & 2 deletions build/variables.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,10 @@
iOSArtifactName: iOS
WindowsArtifactName: Windows
TestsArtifactName: Tests
ReleaseNotesArtifactName: ReleaseNotes

# For Application.Building.Light optimizations.
IsLightBuild: $[eq(variables['Build.Reason'], 'PullRequest')]
# To know if it's a Pull Request build.
IsPullRequestBuild: $[eq(variables['Build.Reason'], 'PullRequest')]

# Pipeline configuration (Disable shallow fetch).
# See https://dev.to/kkazala/azure-devops-pipelines-shallow-fetch-1-is-now-default-4656 for more details.
Expand Down
10 changes: 5 additions & 5 deletions doc/AzurePipelines.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ It also runs automated tests during the build steps.
### Pull request runs

Due to the length of mobile builds, pipelines are configured to behave a little differently when building in a context of **pull request (PR) build validation**.
To reduce the build time, some stages and steps are disabled for PR builds.
This requires a specific variable called `IsLightBuild` to be set, hence why it is appearing in the pipeline.
To reduce the CI/CD utilization time, some stages and steps are disabled for PR builds.
This requires a specific variable called `IsPullRequestBuild` to be set, hence why it is appearing in the pipeline.

Also, all release stages are disabled in the context of PR build validation because, with the optimizations differences, the resulting application would not represent the real thing.
Also, all release stages are disabled in the context of PR build validation.

### Release runs

Pipeline runs **triggered on the main branch** don't qualify for `IsLightBuild` and build the application with the goal of releasing it.
Pipeline runs **triggered on the main branch** don't qualify for `IsPullRequestBuild` and build the application with the goal of releasing it.
All stages are therefore enabled.

## Stages and Steps
Expand Down Expand Up @@ -67,7 +67,7 @@ This is where the exact build steps are defined. These vary depending on the pla
1. Install and run [GitVersion](https://gitversion.net/) to calculate the semantic version based on the Git history.
1. Install the proper signing certificates (depending on the platform).
1. Build the application.
1. Archive the application (if on iOS and depending on `IsLightBuild`).
1. Archive the application (if on iOS and depending on `IsPullRequestBuild`).
1. Run the tests and publish both the test results and the code coverage results.
1. Push the built artifacts (.ipa, .aab, release notes, etc.).
1. Cleanup.
Expand Down
3 changes: 3 additions & 0 deletions src/cli/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)

Prefix your items with `(Template)` if the change is about the template and not the resulting application.

## 0.19.4
- Fix CI/CD artifact name for iOS.

## 0.19.2
- Cleanup documentation.

Expand Down

0 comments on commit 832aac5

Please sign in to comment.