Skip to content

Commit

Permalink
Merge branch 'master' into feature/day-view-calendar
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidMartel12 committed Sep 16, 2024
2 parents 451bc1a + 128d76c commit 13f159c
Show file tree
Hide file tree
Showing 202 changed files with 1,623 additions and 2,841 deletions.
51 changes: 51 additions & 0 deletions .github/composite/ci-build/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: "CI Build"
description: "Build the application on the CI"
inputs:
target:
description: The target OS {iOS, Android}
required: true
build-target:
description: The build target {ios or apk}
required: true
build-args:
description: The arguments for flutter build
required: false
build-path:
required: true
asset-extension:
required: true
default: zip
github-api-token:
description: the Github API token
required: true
app-name:
required: true
app-path:
required: true

runs:
using: "composite"
steps:
- name: Build the application
shell: bash
run: flutter build -v ${{ inputs.build-target }} ${{ inputs.build-args }} --release --dart-define=GH_API_TOKEN=${{ inputs.github-api-token }}

- name: Rename Android build
if: inputs.target == 'Android'
shell: bash
run: mv app-release.${{ inputs.asset-extension }} ${{ inputs.app-path }}
working-directory: ${{ inputs.build-path }}

- name: Compress iOS build
if: inputs.target == 'iOS'
shell: bash
run: |
mv Runner.app ${{ inputs.app-name }}.app
ditto -c -k --sequesterRsrc --keepParent ${{ inputs.app-name }}.app ${{ inputs.app-path }}
working-directory: ${{ inputs.build-path }}

- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.target }}
path: ${{ inputs.app-path }}
86 changes: 86 additions & 0 deletions .github/composite/flutter-setup/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: "Flutter setup"
description: "Setup flutter"
inputs:
encrypted-signets-api-cert-password:
required: true
encrypted-google-service-password:
required: true
encrypted-etsmobile-keystore-password:
required: true
encrypted-keystore-properties-password:
required: true
encrypted-android-service-account-credentials-password:
required: false
encrypted-ios-service-account-credentials-password:
required: false
encrypted-ios-matchfile-password:
required: false
target:
description: "Build target: {Android, iOS}"
required: false
default: 'Android'

runs:
using: "composite"
steps:
- uses: subosito/flutter-action@v2
with:
flutter-version: '3.19.x'
channel: 'stable'
cache: true

# Get flutter dependencies.
- name: Get flutter dependencies
shell: bash
run: flutter pub get

- name: Install Android dependencies
if: ${{ inputs.target == 'Android' }}
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'

- name: Install iOS dependencies
if: ${{ inputs.target == 'iOS' }}
shell: bash
run: |
cd ios
pod update
- name: Commit pod updates
if: ${{ inputs.target == 'iOS' }}
id: commit_pod_versions
uses: stefanzweifel/git-auto-commit-action@v5
with:
file_pattern: "ios/*"
commit_user_name: github-actions[bot]
commit_user_email: 41898282+github-actions[bot]@users.noreply.github.com
commit_message: "[BOT] Applying pod update."
add_options: '-u'

# Fail workflow, because new commit will execute workflow
- if: ${{ inputs.target == 'iOS' && steps.commit_pod_versions.outputs.changes_detected == 'true' }}
name: Fail workflow if pod version change
shell: bash
run: |
echo 'Pod update applied, running bot commit workflow'
exit 1
- name: Run flutter doctor
shell: bash
run: flutter doctor

- name: Decrypt SignETS certificate and Google Services files
shell: bash
run: |
chmod +x ./scripts/decrypt.sh
./scripts/decrypt.sh
env:
ENCRYPTED_SIGNETS_API_CERT_PASSWORD: ${{ inputs.encrypted-signets-api-cert-password }}
ENCRYPTED_GOOGLE_SERVICE_PASSWORD: ${{ inputs.encrypted-google-service-password }}
ENCRYPTED_ETSMOBILE_KEYSTORE_PASSWORD: ${{ inputs.encrypted-etsmobile-keystore-password }}
ENCRYPTED_KEYSTORE_PROPERTIES_PASSWORD: ${{ inputs.encrypted-keystore-properties-password }}
ENCRYPTED_ANDROID_SERVICE_ACCOUNT_CREDENTIALS_PASSWORD: ${{ inputs.encrypted-android-service-account-credentials-password }}
ENCRYPTED_IOS_SERVICE_ACCOUNT_CREDENTIALS_PASSWORD: ${{ inputs.encrypted-ios-service-account-credentials-password }}
ENCRYPTED_IOS_MATCHFILE_PASSWORD: ${{ inputs.encrypted-ios-matchfile-password }}
32 changes: 32 additions & 0 deletions .github/composite/tag-validation/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: "Tag validation"
description: "Check if the tag already exists."
outputs:
version:
description: "The version in the pubspec.yaml file."
value: ${{ steps.split.outputs._0 }}

runs:
using: "composite"
steps:
- name: Get the version from the pubspec
id: pubspecVersion
uses: CumulusDS/[email protected]
with:
file: pubspec.yaml
version: version
- uses: winterjung/[email protected]
id: split
with:
msg: ${{ steps.pubspecVersion.outputs.version }}
separator: '+'
- name: Validate that version doesn't exists
uses: mukunku/[email protected]
id: checkTag
with:
tag: ${{ steps.split.outputs._0 }}
- if: ${{ steps.checkTag.outputs.exists == 'true' }}
name: Post comment on PR and fail.
shell: bash
run: |
echo '${{ steps.split.outputs._0 }} already exists, please update the pubspec version.'
exit 1
61 changes: 61 additions & 0 deletions .github/composite/tests/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: "Tests and checks"
inputs:
format:
description: "If the project needs formatting"
required: false
default: true

runs:
using: "composite"
steps:
- name: Generate mocking files
shell: bash
run: dart run build_runner build

# Check the format of the code and commit the formatted files.
- name: Format files in lib and test directories
if: ${{ inputs.format == true }}
shell: bash
run: dart format lib test

- name: Commit formatted files
if: ${{ inputs.format == true }}
id: commit_formatted
uses: stefanzweifel/git-auto-commit-action@v5
with:
file_pattern: "*.dart"
commit_user_name: github-actions[bot]
commit_user_email: 41898282+github-actions[bot]@users.noreply.github.com
commit_message: "[BOT] Applying format."
add_options: '-u'

# Fail workflow, because new commit will execute workflow
- if: ${{ inputs.format == true && steps.commit_formatted.outputs.changes_detected == 'true' }}
name: Fail workflow if linting commit
shell: bash
run: |
echo 'Linting applied, running bot commit workflow'
exit 1
# Check if the code has any errors/warnings
- name: Analyze code
shell: bash
run: flutter analyze

- name: Run tests
shell: bash
run: flutter test --coverage

- name: Upload coverage file
uses: actions/upload-artifact@v4
with:
name: lcov.info
path: ${{ github.workspace }}/coverage/lcov.info

- name: Get code coverage
shell: bash
run: |
chmod +x ./scripts/determine_code_coverage.sh
export COV="$(./scripts/determine_code_coverage.sh coverage/lcov.info)"
echo "Coverage detected is: $COV"
echo "percentage=$COV" >> $GITHUB_OUTPUT
1 change: 0 additions & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
- [ ] If it is a core feature, I have added thorough tests.
- [ ] If needed, I added analytics.
- [ ] Make sure to add either one of the following labels: `version: Major`,`version: Minor` or `version: Patch`.
- [ ] Make sure golden files changes were reviewed and approved.

### 🖼️ Screenshots (if useful):
<!--- If it's a visual change, please provide a screenshot -->
Loading

0 comments on commit 13f159c

Please sign in to comment.