Merge remote-tracking branch 'upstream/develop' into develop #78
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
############################################################################## | |
############################################################################## | |
# | |
# NOTE! | |
# | |
# Please read the README.md file in this directory that defines what should | |
# be placed in this file | |
# | |
############################################################################## | |
############################################################################## | |
name: PUSH Workflow | |
on: | |
push: | |
# branches: | |
# - develop | |
branches-ignore: | |
- 'master' | |
tags: | |
- "*" | |
env: | |
CODECOV_UNIQUE_NAME: CODECOV_UNIQUE_NAME-${{ github.run_id }}-${{ github.run_number }} | |
jobs: | |
Flutter-Codebase-Check: | |
name: Checking codebase | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
# This is important to fetch all history for all branches and tags. | |
# This could be important for our documentation generation process. | |
# See: https://github.com/actions/checkout | |
fetch-depth: 0 | |
- uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' # See 'Supported distributions' for available options | |
java-version: '12.0' | |
- uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: '3.16.0' | |
channel: 'stable' # or: 'beta', 'dev' or 'master' | |
- name: Running pub get in talawa_lint | |
run: cd talawa_lint && flutter pub get && cd .. | |
- name: Running pub get to fetch dependencies | |
run: flutter pub get | |
- name: Checking for correct formatting of code | |
run: dart format --set-exit-if-changed . | |
- name: setup python | |
uses: actions/setup-python@v4 | |
- name: Check for presence of ignore directives corresponding to custom lints | |
run: chmod +x ./.github/workflows/check_ignore.py | |
- name: Run check_ignore | |
run: | | |
git branch | |
git checkout develop | |
git pull | |
git branch | |
git checkout - | |
pip install GitPython | |
python ./.github/workflows/check_ignore.py --repository ${{github.repository}} --merge_branch_name ${{github.ref_name}} | |
- name: Analysing codebase for default linting | |
run: flutter analyze --no-pub | |
- name: Analysing codebase for custom linting | |
run: dart run custom_lint | |
# - name: Echo the GitHub environment for troubleshooting | |
# run: echo "$GITHUB_CONTEXT" | |
# - name: Echo the GitHub context for troubleshooting | |
# run: echo "${{ toJSON(github) }}" | |
Update-Documentation: | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/automated-docs' | |
environment: TALAWA_ENVIRONMENT | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' # See 'Supported distributions' for available options | |
java-version: '12.0' | |
- uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: '3.16.0' | |
channel: 'stable' | |
- uses: dart-lang/setup-dart@v1 | |
with: | |
sdk: '2.19.2' | |
- run: | | |
cd talawa_lint && flutter pub get && cd .. | |
flutter pub get | |
flutter analyze | |
dart analyze | |
flutter pub global activate dartdoc | |
flutter pub global run dartdoc . --output talawa-mobile-docs --format md --exclude=test/widget_tests/widgets/pinned_carousel_widget_test.dart, lib/widgets/pinned_carousel_widget.dart, lib/widgets/post_widget.dart, test/widget_tests/widgets/post_widget_test.dart | |
rm -rf talawa-mobile-docs/widgets_pinned_carousel_widget/CustomCarouselScrollerState/build.md | |
rm -rf talawa-mobile-docs/widgets_post_widget/PostContainerState/build.md | |
- uses: actions/upload-artifact@v1 | |
with: | |
name: talawa-mobile-docs | |
path: talawa-mobile-docs | |
- name: Checking doc updated | |
id: DocUpdated | |
run: | | |
if [ -n "$(git status --porcelain)" ]; then | |
echo "updateDoc=true" >> $GITHUB_OUTPUT | |
echo -e "Documentation has been updated!!" | |
else | |
Green='0;32' | |
NoColor='\033[0m' | |
echo -e "${Green}No documentation updated${NoColor}" | |
fi | |
- name: Set env variables | |
if: steps.DocUpdated.outputs.updateDoc | |
run: | | |
echo "commit_id=$(echo $(git rev-parse HEAD))" >> $GITHUB_ENV | |
echo "email=$(echo $(git log --pretty=format:"%ae" $commit_id))" >> $GITHUB_ENV | |
- name: Handle untracked files | |
if: steps.DocUpdated.outputs.updateDoc | |
run: | | |
git config --global user.name "${{github.actor}}" | |
git config --global user.email "${{env.email}}" | |
git add . | |
- name: Update Doc | |
if: steps.DocUpdated.outputs.updateDoc | |
run: | | |
Green='0;32' | |
NoColor='\033[0m' | |
git config --global user.name "${{github.actor}}" | |
git config --global user.email "${{env.email}}" | |
git commit -a -m "Updated docs" | |
git push | |
echo -e "🚀${Green} Hurrah! doc updated${NoColor}" | |
Documentation-to-talawa-docs: | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/automated-docs' | |
needs: Update-Documentation | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: dmnemec/copy_file_to_another_repo_action@v1.1.1 | |
env: | |
API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB_NEW }} | |
with: | |
source_file: 'talawa-mobile-docs/' | |
destination_repo: 'PalisadoesFoundation/talawa-docs' | |
destination_branch: 'develop' | |
destination_folder: 'docs' | |
user_email: '${{env.email}}' | |
user_name: '${{github.actor}}' | |
commit_message: 'Overwriting talawa-mobile-docs from talawa-repo' | |
Flutter-Testing: | |
name: Testing codebase | |
runs-on: ubuntu-latest | |
needs: Flutter-Codebase-Check | |
# needs: Update-Documentation | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' # See 'Supported distributions' for available options | |
java-version: '12.0' | |
- uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: '3.16.0' | |
channel: 'stable' # or: 'beta', 'dev' or 'master' | |
- name: Running pub get in talawa_lint | |
run: cd talawa_lint && flutter pub get && cd .. | |
- name: Running pub get to fetch dependencies | |
run: flutter pub get | |
- name: Codebase testing | |
run: flutter test --coverage | |
- name: Present and upload coverage to Codecov as ${{env.CODECOV_UNIQUE_NAME}} | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
verbose: true | |
fail_ci_if_error: false | |
name: '${{env.CODECOV_UNIQUE_NAME}}' | |
Android-Build-and-Release: | |
name: Testing build for android | |
permissions: | |
contents: write | |
environment: TALAWA_ENVIRONMENT | |
runs-on: ubuntu-latest | |
needs: Flutter-Testing | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' # See 'Supported distributions' for available options | |
java-version: '12.0' | |
- uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: '3.16.0' | |
channel: 'stable' # or: 'beta', 'dev' or 'master' | |
- name: Running pub get in talawa_lint | |
run: cd talawa_lint && flutter pub get && cd .. | |
- name: Running pub get to fetch dependencies | |
run: flutter pub get | |
- name: Building for android | |
run: flutter build apk | |
################################################### | |
## Release the built apk as an automated release ## | |
################################################### | |
- uses: ncipollo/release-action@v1 | |
with: | |
name: "Automated Android Release" | |
artifacts: "./build/app/outputs/flutter-apk/app-release.apk" | |
allowUpdates: "true" | |
generateReleaseNotes: false | |
tag: "automated" | |
body: | | |
This is an automated release, triggered by a recent push. | |
This may or may not be stable, so please have a look at the stable release(s). | |
iOS-Build: | |
name: iOS Build and Relaese | |
runs-on: macos-latest | |
needs: Flutter-Testing | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: '3.16.0' | |
channel: 'stable' # or: 'beta', 'dev' or 'master' | |
architecture: x64 | |
- name: Building for ios | |
run: flutter build ios --release --no-codesign | |
# '--no-codesign' is used for building without code signing. | |
# For actual distribution, proper code signing is required. | |
######################################################## | |
## Package the app as an .ipa and create a release ## | |
######################################################## | |
- name: Releasing for iOS | |
run: | | |
mkdir Payload | |
cp -r build/ios/iphoneos/Runner.app Payload/Runner.app | |
zip -r app.ipa Payload | |
# This packages the Runner.app into an .ipa file | |
- uses: ncipollo/release-action@v1 | |
with: | |
name: "Automated iOS Release" | |
artifacts: "app-release.ipa" | |
allowUpdates: "true" | |
generateReleaseNotes: false | |
tag: "automated" | |
body: | | |
This is an automated release, triggered by a recent push. | |
This may or may not be stable, so please have a look at the stable release(s). |