Skip to content

Commit

Permalink
Merge pull request #40 from wednesday-solutions/env-setup
Browse files Browse the repository at this point in the history
Environment and Theming updates
  • Loading branch information
shounak-mulay authored Mar 22, 2023
2 parents a8b9764 + a260c12 commit e4892c6
Show file tree
Hide file tree
Showing 108 changed files with 1,673 additions and 829 deletions.
2 changes: 2 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
OPEN_WEATHER_API_KEY=YOUR_API_KEY
OPEN_WEATHER_BASE_URL=https://api.openweathermap.org/
2 changes: 2 additions & 0 deletions .env.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
OPEN_WEATHER_API_KEY=YOUR_API_KEY
OPEN_WEATHER_BASE_URL=https://api.openweathermap.org/
2 changes: 2 additions & 0 deletions .env.qa
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
OPEN_WEATHER_API_KEY=YOUR_API_KEY
OPEN_WEATHER_BASE_URL=https://api.openweathermap.org/
4 changes: 4 additions & 0 deletions .env.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
OPEN_WEATHER_API_KEY=YOUR_API_KEY
OPEN_WEATHER_BASE_URL=https://api.openweathermap.org/
USE_GOOGLE_FONTS=false
RENDER_FONTS_IN_TEST=false
45 changes: 31 additions & 14 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,34 @@ jobs:
permissions:
contents: write
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
# Replace with your Personal Access Tokens
with:
token: ${{ secrets.SHOUNAK_GITHUB_TOKEN }}

- uses: subosito/flutter-action@v2
with:
channel: 'stable'
cache: true

- name: Setup app_secrets.dart
- name: Setup .env.qa
env:
APP_SECRETS: ${{ secrets.APP_SECRETS }}
APP_SECRETS_PATH: lib/secrets/app_secrets.dart
run: echo -n $APP_SECRETS | base64 --decode > $APP_SECRETS_PATH
ENV_FILE: ${{ secrets.ENV_QA }}
run: echo -n $ENV_FILE | base64 --decode > .env.qa

- name: Setup .env.prod
env:
ENV_FILE: ${{ secrets.ENV_PROD }}
run: echo -n $ENV_FILE | base64 --decode > .env.prod

- name: Activate derry
run: flutter pub global activate derry

- name: Get Dependencies
run: flutter pub get

- name: Run build_runner
run: flutter pub run build_runner build
run: derry build_runner

- name: Bump Build Number
run: scripts/bump-build-number.sh
Expand All @@ -47,7 +55,7 @@ jobs:
run: scripts/set-flavor-and-apk-path-to-env.sh

- name: Build APK
run: scripts/build.sh apk $FLAVOR_NAME --release --obfuscate --split-debug-info=debug-info
run: derry build release-apk $FLAVOR_NAME
env:
KEY_STORE_PATH: ${{ steps.decode_keystore.outputs.filePath }}
RELEASE_STORE_PASSWORD: ${{ secrets.RELEASE_STORE_PASSWORD }}
Expand Down Expand Up @@ -80,25 +88,33 @@ jobs:
name: Release iOS to TestFlight
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
token: ${{ secrets.SHOUNAK_GITHUB_TOKEN }}

- uses: subosito/flutter-action@v2
with:
channel: 'stable'
cache: true

- name: Setup app_secrets.dart
- name: Setup .env.qa
env:
APP_SECRETS: ${{ secrets.APP_SECRETS }}
APP_SECRETS_PATH: lib/secrets/app_secrets.dart
run: echo -n $APP_SECRETS | base64 --decode > $APP_SECRETS_PATH
ENV_FILE: ${{ secrets.ENV_QA }}
run: echo -n $ENV_FILE | base64 --decode > .env.qa

- name: Setup .env.prod
env:
ENV_FILE: ${{ secrets.ENV_PROD }}
run: echo -n $ENV_FILE | base64 --decode > .env.prod

- name: Activate derry
run: flutter pub global activate derry

- name: Get Dependencies
run: flutter pub get

- name: Run build_runner
run: flutter pub run build_runner build
run: derry build_runner

- uses: maxim-lobanov/setup-xcode@v1
with:
Expand All @@ -122,6 +138,7 @@ jobs:
run: echo -n "$PLIST" | base64 --decode --output $PLIST_PATH

- name: Build the signed ipa
# TODO: Move to derry
run: chmod u+x scripts/build.sh && scripts/build.sh ipa prod --release

- name: Upload the signed ipa to TestFlight
Expand All @@ -138,7 +155,7 @@ jobs:
always() &&
(needs.build-android.result == 'success' || needs.build-ios.result == 'success')
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
# Replace with your Personal Access Token
with:
token: ${{ secrets.SHOUNAK_GITHUB_TOKEN }}
Expand Down
156 changes: 136 additions & 20 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,62 +1,178 @@
name: CI
on:
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
lint-test-build-android:
name: Lint, Test And Build Android
lint-test:
name: Lint and Unit Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- uses: subosito/flutter-action@v2
with:
channel: 'stable'
cache: true

- name: Setup app_secrets.dart
- name: Setup .env.dev
env:
APP_SECRETS: ${{ secrets.APP_SECRETS }}
APP_SECRETS_PATH: lib/secrets/app_secrets.dart
run: echo -n $APP_SECRETS | base64 --decode > $APP_SECRETS_PATH
ENV_FILE: ${{ secrets.ENV_DEV }}
run: echo -n $ENV_FILE | base64 --decode > .env.dev

- name: Activate derry
run: flutter pub global activate derry

- name: Get Dependencies
run: flutter pub get

- name: Run build_runner
run: flutter pub run build_runner build --delete-conflicting-outputs
run: derry build_runner

- name: Lint
run: flutter analyze --fatal-infos --fatal-warnings
run: derry analyze

- name: Format
run: derry format

- name: Unit tests
run: flutter test --exclude-tags=golden
run: derry test exclude-goldens -- --coverage-path=coverage/lcov.base.info --coverage

- uses: actions/upload-artifact@v3
with:
name: base-coverage-${{ github.event.number }}
path: coverage
retention-days: 7

build-android:
name: Build Android
runs-on: ubuntu-latest
needs: [ lint-test ]
steps:
- uses: actions/checkout@v3

- uses: subosito/flutter-action@v2
with:
channel: 'stable'
cache: true

- name: Setup .env.dev
env:
ENV_FILE: ${{ secrets.ENV_DEV }}
run: echo -n $ENV_FILE | base64 --decode > .env.dev

- name: Activate derry
run: flutter pub global activate derry

- name: Get Dependencies
run: flutter pub get

- name: Run build_runner
run: derry build_runner

- name: Build Android
run: scripts/build.sh apk dev --debug
run: derry build apk dev


build-ios:
name: Golden Tests and Build iOS
runs-on: macos-latest
needs: [ lint-test-build-android ]
needs: [ lint-test ]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- uses: subosito/flutter-action@v2
with:
channel: 'stable'
cache: true

- name: Setup app_secrets.dart
- name: Setup .env.dev
env:
APP_SECRETS: ${{ secrets.APP_SECRETS }}
APP_SECRETS_PATH: lib/secrets/app_secrets.dart
run: echo -n $APP_SECRETS | base64 --decode > $APP_SECRETS_PATH
ENV_FILE: ${{ secrets.ENV_DEV }}
run: echo -n $ENV_FILE | base64 --decode > .env.dev

- name: Activate derry
run: flutter pub global activate derry

- name: Get Dependencies
run: flutter pub get

- name: Run build_runner
run: flutter pub run build_runner build
run: derry build_runner

- uses: actions/download-artifact@v3
with:
name: base-coverage-${{ github.event.number }}
path: coverage

- name: Setup lcov
run: brew install lcov

- name: Golden tests
run: flutter test --tags=golden test/presentation/goldens
run: derry test goldens -- --merge-coverage --coverage

- uses: actions/upload-artifact@v3
with:
name: coverage-${{ github.event.number }}
path: coverage
retention-days: 7

- name: Build iOS
run: scripts/build.sh ios dev --debug --no-codesign
run: derry build ios dev

build-web:
name: Build Web
runs-on: ubuntu-latest
needs: [ lint-test ]
steps:
- uses: actions/checkout@v3

- uses: subosito/flutter-action@v2
with:
channel: 'stable'
cache: true

- name: Setup .env.dev
env:
ENV_FILE: ${{ secrets.ENV_DEV }}
run: echo -n $ENV_FILE | base64 --decode > .env.dev

- name: Activate derry
run: flutter pub global activate derry

- name: Get Dependencies
run: flutter pub get

- name: Run build_runner
run: derry build_runner

- name: Build Web
run: derry build web dev

sonar-scan:
name: SonarQube Scan
runs-on: ubuntu-latest
needs: [build-android,build-ios,build-web]
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- uses: actions/download-artifact@v3
with:
name: coverage-${{ github.event.number }}
path: coverage
- uses: sonarsource/sonarqube-scan-action@master
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
# If you wish to fail your job when the Quality Gate is red, uncomment the
# following lines. This would typically be used to fail a deployment.
# We do not recommend to use this in a pull request. Prefer using pull request
# decoration instead.
# - uses: sonarsource/sonarqube-quality-gate-action@master
# timeout-minutes: 5
# env:
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
17 changes: 10 additions & 7 deletions .github/workflows/update_goldens.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,29 @@ jobs:
permissions:
contents: write
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- uses: subosito/flutter-action@v2
with:
channel: 'stable'
cache: true

- name: Setup app_secrets.dart
- name: Setup .env.dev
env:
APP_SECRETS: ${{ secrets.APP_SECRETS }}
APP_SECRETS_PATH: lib/secrets/app_secrets.dart
run: echo -n $APP_SECRETS | base64 --decode > $APP_SECRETS_PATH
ENV_FILE: ${{ secrets.ENV_DEV }}
run: echo -n $ENV_FILE | base64 --decode > .env.dev

- name: Activate derry
run: flutter pub global activate derry

- name: Get Dependencies
run: flutter pub get

- name: Run build_runner
run: flutter pub run build_runner build
run: derry build_runner

- name: Generate Goldens
run: flutter test --tags=golden test/presentation/goldens --update-goldens
run: derry test update-goldens

- name: Configure Git
run: |
Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
/build/

# Web related
lib/generated_plugin_registrant.dart

# Symbolication related
app.*.symbols
Expand Down Expand Up @@ -71,3 +70,7 @@ app.*.map.json
# Secrets
lib/secrets/
!lib/secrets/app_secrets.skeleton.dart

.mason

.scannerwork
7 changes: 0 additions & 7 deletions .idea/runConfigurations/main_dev_dart.xml

This file was deleted.

8 changes: 0 additions & 8 deletions .idea/runConfigurations/main_dev_preview_dart.xml

This file was deleted.

Loading

0 comments on commit e4892c6

Please sign in to comment.