forked from PalisadoesFoundation/talawa
-
Notifications
You must be signed in to change notification settings - Fork 1
184 lines (169 loc) · 6.48 KB
/
push.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
##############################################################################
##############################################################################
#
# 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:
if: ${{ github.actor != 'dependabot[bot]' }}
name: Checking Codebase
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
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.22.3'
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@v5
- 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) }}"
Flutter-Testing:
if: ${{ github.actor != 'dependabot[bot]' }}
name: Testing codebase
runs-on: ubuntu-latest
needs: Flutter-Codebase-Check
# needs: Update-Documentation
steps:
- uses: actions/checkout@v4
- 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.22.3'
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@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
fail_ci_if_error: false
name: '${{env.CODECOV_UNIQUE_NAME}}'
Android-Build-and-Release:
if: ${{ github.actor != 'dependabot[bot]' }}
name: Testing build for android
permissions:
contents: write
environment: TALAWA_ENVIRONMENT
runs-on: ubuntu-latest
needs: Flutter-Testing
steps:
- uses: actions/checkout@v4
- 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.22.3'
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:
if: ${{ github.actor != 'dependabot[bot]' }}
name: iOS Build and Relaese
runs-on: macos-latest
needs: Flutter-Testing
steps:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
with:
flutter-version: '3.22.3'
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).