Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

develop <> staging parity #13

Merged
merged 87 commits into from
Aug 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
87 commits
Select commit Hold shift + click to select a range
fb7387f
devops: internal testing v3
dg1223 Jul 18, 2023
87e55a8
devops: internal testing v3
dg1223 Jul 18, 2023
1187109
devops: updated release status to inProgress
dg1223 Jul 18, 2023
c9eb543
devops: added userFraction for inProgress status
dg1223 Jul 18, 2023
d4d8594
run integration tests on push to develop branch only
dg1223 Jul 23, 2023
b6186a3
deploy only if integration tests pass
dg1223 Jul 23, 2023
7f5dd5a
conditional ci/cd using a single workflow file
dg1223 Jul 23, 2023
861ed76
fix: debug step Make Gradlew Executable
dg1223 Jul 23, 2023
8e05324
fix: added checkout branch step
dg1223 Jul 23, 2023
65e5f72
fix: check contents in runner android directory
dg1223 Jul 23, 2023
fa09288
fix: install node dependencies on the deployment runner
dg1223 Jul 23, 2023
9f30aa4
devops: renamed jobs
dg1223 Jul 23, 2023
8ab2010
devops: Dev CI/CD badge; don't run CI/CD if only README.md is updated
dg1223 Jul 23, 2023
6456904
devops: don't run CI/CD if only README.md or any .yml file is updated
dg1223 Jul 23, 2023
00ad105
devops: don't run CI/CD if only README.md or any .yml file is updated
dg1223 Jul 23, 2023
844cc20
devops: don't run CI/CD if only README.md or any .yml file is updated
dg1223 Jul 23, 2023
ae121f3
devops: don't run CI/CD if only README.md or any .yml file is updated
dg1223 Jul 23, 2023
2c81f2c
devops: don't run CI/CD if only README.md or any .yml file is updated
dg1223 Jul 23, 2023
bd5aa4b
devops: don't run CI/CD if only README.md or any .yml file is updated
dg1223 Jul 23, 2023
373dbfb
devops: don't run CI/CD if only README.md or any .yml file is updated
dg1223 Jul 23, 2023
6f2cfa1
devops: don't run CI/CD if only README.md or any .yml file is updated
dg1223 Jul 23, 2023
d25f7bf
devops: don't run CI/CD if only README.md or any .yml file is updated
dg1223 Jul 23, 2023
0f9c9c6
devops: don't run CI/CD if only README.md or any .yml file is updated
dg1223 Jul 23, 2023
f6cda05
devops: don't run CI/CD if only README.md or any .yml file is updated
dg1223 Jul 23, 2023
60afa43
devops: don't run CI/CD if only README.md or any .yml file is updated
dg1223 Jul 23, 2023
c3afe62
devops: alpha-cd updated
dg1223 Jul 26, 2023
a6709bf
fix: removed github variables from git diff command
dg1223 Jul 26, 2023
aaa110f
fix: check git diff output directly
dg1223 Jul 26, 2023
996eafa
fix: use git log instead of git diff to see changed file names
dg1223 Jul 26, 2023
64c0781
fix: get the list of changed files in the latest commit
dg1223 Jul 26, 2023
965e5b8
debug: display latest commit SHA
dg1223 Jul 26, 2023
aa79e4e
debug: output debug info to file
dg1223 Jul 26, 2023
ffe1d6e
debug: output debug info to file and cat the file
dg1223 Jul 26, 2023
47cf7ae
fix: do not use git diff-tree
dg1223 Jul 26, 2023
5ad0437
fix: simplify commit path
dg1223 Jul 26, 2023
826fcbb
fix: use github context
dg1223 Jul 26, 2023
beed3e4
fix: use github context before and after
dg1223 Jul 26, 2023
4498de6
fix: setting fetch depth to zero
dg1223 Jul 26, 2023
84f339a
fix: return instead of exit when condition is met
dg1223 Jul 26, 2023
9f45d5c
fix: do not continue on error
dg1223 Jul 26, 2023
ef93a77
devops: add success flag for first job
dg1223 Jul 26, 2023
c4f66c1
devops: using env variables instead of set_output to suppress depreca…
dg1223 Jul 26, 2023
73827a5
devops: added .txt to list of files
dg1223 Jul 26, 2023
207f93b
devops: added firebase app distribution workflow
dg1223 Jul 26, 2023
fa0695b
feat: change Gamchha text colour to blue
dg1223 Jul 26, 2023
2ed3236
feat: change Gamchha text colour to red
dg1223 Jul 26, 2023
31860af
feat: change Gamchha text colour to blue
dg1223 Jul 26, 2023
d6472dd
devops: change internal deployment back to play store
dg1223 Jul 26, 2023
77d35c2
Merge branch 'staging' into develop
dg1223 Jul 26, 2023
616f7aa
docs: added staging ci/cd badge
dg1223 Jul 26, 2023
d1f0208
Merge branch 'develop' of https://github.com/dg1223/Gamchha into develop
dg1223 Jul 26, 2023
72ccc48
docs: removed introductory line
dg1223 Jul 26, 2023
1d461fa
debug: add debug
dg1223 Jul 26, 2023
743f268
docs: added back introductory line
dg1223 Jul 26, 2023
d1bba6b
devops: prevent develop ci/cd from getting triggered on PRs
dg1223 Jul 26, 2023
f90bfa3
devops: prevent staging ci/cd from getting triggered on code push
dg1223 Jul 26, 2023
31dc01a
devops: prevent staging ci/cd from getting triggered on code push
dg1223 Jul 26, 2023
2322adf
devops: trigger only one ci/cd workflow for a single event
dg1223 Jul 26, 2023
616e9ff
devops: trigger only one ci/cd workflow for a single event
dg1223 Jul 26, 2023
34f9491
deleted staging workflow
dg1223 Aug 4, 2023
8f72b6e
docs: removed deve ci-cd badge
dg1223 Aug 4, 2023
eaff12f
docs: removed staging ci/cd badge
dg1223 Aug 4, 2023
f72ef5e
devops: removed pull request branches-ignore
dg1223 Aug 4, 2023
f87902a
chores: added git hooks to prevent yml and README.md files from merging
dg1223 Aug 4, 2023
b819a07
devops: ignore gitattributes and gitignore files while running ci/cd …
dg1223 Aug 4, 2023
0e34891
feat: changed colour to red
dg1223 Aug 4, 2023
9e9015c
chores: added build.grade to gitattributes
dg1223 Aug 4, 2023
c7fb562
chores: added build.gradle to gitattributes
dg1223 Aug 4, 2023
b1b4153
fix: updated .gradle pattern
dg1223 Aug 4, 2023
f00a8aa
feat: colour updated to blue
dg1223 Aug 4, 2023
553dded
feat: colour updated to red
dg1223 Aug 4, 2023
b4c1a34
chores: updated app version numbers for next build
dg1223 Aug 4, 2023
0c9bd2b
fix: print out variables for debugging
dg1223 Aug 5, 2023
8f901b0
fix: revert to previous logic
dg1223 Aug 5, 2023
1c83e7e
fix: revert to new logic
dg1223 Aug 5, 2023
c0c4671
fix: add more printouts to new logic
dg1223 Aug 5, 2023
eb0beb8
fix: replace parenthesis with backticks
dg1223 Aug 5, 2023
4334e6f
fix: refactored skip file pattern
dg1223 Aug 5, 2023
0d00797
docs: updated readme
dg1223 Aug 5, 2023
591f7a5
fix: updated file pattern match to account for multiple file changes
dg1223 Aug 5, 2023
869d21c
chores: updated echo message
dg1223 Aug 5, 2023
6c0179f
devops: use paths-ignore workflow syntax instead of lenghty logic
dg1223 Aug 6, 2023
3555b73
devops: merge into staging
dg1223 Aug 6, 2023
c5e76c6
devops: removed file pattern match logic
dg1223 Aug 6, 2023
1333b66
devops: add gitattributes and gitignore to the workflow skip list for PR
dg1223 Aug 6, 2023
a125a46
feat: changed colour to blue
dg1223 Aug 6, 2023
cd6ebae
chores: bring develop and staging to parity
dg1223 Aug 7, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
README.md merge=ours
.github/workflows/*.yml merge=ours
android/build.gradle merge=ours
android/app/build.gradle merge=ours
android/app/build.gradle merge=ours
.gitattributes merge=ours
.gitignore merge=ours
201 changes: 201 additions & 0 deletions .github/workflows/develop-cicd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,201 @@
name: Dev CI/CD

on:
push:
branches:
- develop
paths-ignore:
- '**/*.md'
- '**/*.yml'
- '**/*.gradle'
- '**/*.txt'
- '.gitignore'
- '.gitattributes'

jobs:
test:
runs-on: ubuntu-latest

steps:
- name: Checkout branch
uses: actions/checkout@v3

# Cache npm dependencies (from GitHub docs)
- name: Cache node modules
id: cache-npm
uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-

# If there's a cache miss
- if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }}
name: List the state of node modules
continue-on-error: true
run: npm list
# Caching process complete

- name: Install dependencies
run: npm install

- name: Lint check
run: npm run lint

- name: Run tests
run: npm run test

deploy:
needs: test
# default action is success(): if(success)
runs-on: ubuntu-latest
env:
MYAPP_UPLOAD_KEY_ALIAS: ${{ secrets.ANDROID_SIGNING_ALIAS }}
MYAPP_UPLOAD_STORE_PASSWORD: ${{ secrets.ANDROID_SIGNING_STORE_PASSWORD }}
MYAPP_UPLOAD_KEY_PASSWORD: ${{ secrets.ANDROID_SIGNING_KEY_PASSWORD }}

steps:
# We need to checkout the current branch and install node
# dependencies again because every GH Actions job runs on
# a seperate runner (VM)
- name: Checkout branch
uses: actions/checkout@v3

# Cache npm dependencies (from GitHub docs)
- name: Cache node modules
id: cache-npm
uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-

# If there's a cache miss
- if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }}
name: List the state of node modules
continue-on-error: true
run: npm list
# Caching process complete

- name: Install dependencies
run: npm install

# - name: Read Version
# id: read-version
# run: |
# echo "::set-output name=versionCode::$(jq -r '.versionCode' version.json)"
# echo "::set-output name=versionName::$(jq -r '.versionName' version.json)"

# # echo "::set-output name=versionCode::$(jq -r '.versionCode' version.json)"
# # echo "::set-output name=versionName::$(node -p -e "require('./version.json').versionName")"

# - name: Increment Version
# id: increment-version
# run: |
# echo "::set-output name=versionCode::$(node -p \"parseInt('${{ steps.read-version.outputs.versionCode }}') + 1\")"
# echo "::set-output name=versionName::$(node -p \"'${{ steps.read-version.outputs.versionName }}'.replace(/(\\d+\\.\\d+\\.)(\\d+)/, (_, p1, p2) => p1 + (parseInt(p2) + 1))\")"

# # echo "::set-output name=versionCode::$(node -p -e 'parseInt(${ steps.read-version.outputs.versionCode }) + 1')"
# # echo "::set-output name=versionName::$(node -p -e "'${{ steps.read-version.outputs.versionName }}'.replace(/(\\d+\\.\\d+\\.)(\\d+)/, (_, p1, p2) => p1 + (parseInt(p2) + 1))")"

# - name: Update build.gradle
# run: |
# sed -i "s/versionCode .*/versionCode ${{ steps.increment-version.outputs.versionCode }}/" android/app/build.gradle
# sed -i "s/versionName .*/versionName '${{ steps.increment-version.outputs.versionName }}'/" android/app/build.gradle

# - name: Commit and Push Changes
# uses: stefanzweifel/git-auto-commit-action@v4
# with:
# commit_message: devops - update versionCode and versionName [skip ci]

- name: Cache Gradle Wrapper
uses: actions/cache@v3
with:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}

- name: Cache Gradle Dependencies
uses: actions/cache@v3
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-caches-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
restore-keys: ${{ runner.os }}-gradle-caches-

# Start the build process
- name: Make Gradlew Executable
run: cd android && chmod +x ./gradlew

# - name: Generate App APK
# run: |
# cd android && ./gradlew assembleRelease --no-daemon

# - name: Sign generated APK
# id: sign_app
# uses: r0adkll/sign-android-release@v1
# with:
# releaseDirectory: android/app/build/outputs/apk/release
# signingKeyBase64: ${{ secrets.ANDROID_SIGNING_KEY }}
# alias: ${{ secrets.ANDROID_SIGNING_ALIAS }}
# keyStorePassword: ${{ secrets.ANDROID_SIGNING_STORE_PASSWORD }}
# keyPassword: ${{ secrets.ANDROID_SIGNING_KEY_PASSWORD }}

# - name: Check app directory after signing (debug)
# run: |
# ls -a android/app/build/outputs/apk/release

- name: Build Android App Bundle
run: cd android && ./gradlew bundleRelease --no-daemon

- name: Sign App Bundle
id: sign_app
uses: r0adkll/sign-android-release@v1
with:
releaseDirectory: android/app/build/outputs/bundle/release
signingKeyBase64: ${{ secrets.ANDROID_SIGNING_KEY }}
alias: ${{ secrets.ANDROID_SIGNING_ALIAS }}
keyStorePassword: ${{ secrets.ANDROID_SIGNING_STORE_PASSWORD }}
keyPassword: ${{ secrets.ANDROID_SIGNING_KEY_PASSWORD }}

# ## Distribute app to Firebase App Distribution for testing
# ## Use google play internal track if you have a google play account
# ## (uncomment the sections below if you want to use Play Store)
# - name: Upload artifact to Firebase App Distribution
# uses: wzieba/Firebase-Distribution-Github-Action@v1
# with:
# appId: ${{secrets.ANDROID_FIREBASE_APP_ID}}
# token: ${{secrets.ANDROID_FIREBASE_TOKEN}}
# groups: testers
# file: ${{steps.sign_app.outputs.signedReleaseFile}}

- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: Signed App Bundle
path: ${{steps.sign_app.outputs.signedReleaseFile}}

- name: Deploy to Play Store (Internal testing)
uses: r0adkll/upload-google-play@v1
with:
serviceAccountJsonPlainText: ${{ secrets.ANDROID_SERVICE_ACCOUNT }}
# The packageName must already exist in the play console account, so make sure you upload a manual apk or aab first through the console
# https://github.com/r0adkll/upload-google-play/tree/v1/
packageName: com.thebest.gamchha
releaseFiles: ${{steps.sign_app.outputs.signedReleaseFile}}
track: internal
inAppUpdatePriority: 3
status: draft
# userFraction: 0.5
whatsNewDirectory: android/release-notes/
releaseName: v1.0.6
File renamed without changes.
6 changes: 4 additions & 2 deletions App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ function App(): JSX.Element {
);
}

const RED_COLOR = 'red';
// const RED_COLOR = 'red';
const BLUE_COLOR = 'blue';
const styles = StyleSheet.create({
sectionHeader: {
padding: 85,
Expand All @@ -69,7 +70,8 @@ const styles = StyleSheet.create({
highlight: {
fontSize: 24,
fontWeight: '700',
color: RED_COLOR,
color: BLUE_COLOR,
// color: RED_COLOR,
},
});

Expand Down
83 changes: 2 additions & 81 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,83 +1,4 @@
[![Dev CI/CD](https://github.com/dg1223/Gamchha/actions/workflows/ci-cd-develop.yml/badge.svg)](https://github.com/dg1223/Gamchha/actions/workflows/ci-cd-develop.yml)
[![Staging CI/CD](https://github.com/dg1223/Gamchha/actions/workflows/staging-cd.yml/badge.svg)](https://github.com/dg1223/Gamchha/actions/workflows/staging-cd.yml)

This is a new [**React Native**](https://reactnative.dev) project, bootstrapped using [`@react-native-community/cli`](https://github.com/react-native-community/cli).

# Getting Started

> **Note**: Make sure you have completed the [React Native - Environment Setup](https://reactnative.dev/docs/environment-setup) instructions till "Creating a new application" step, before proceeding.

## Step 1: Start the Metro Server

First, you will need to start **Metro**, the JavaScript _bundler_ that ships _with_ React Native.

To start Metro, run the following command from the _root_ of your React Native project:

```bash
# using npm
npm start

# OR using Yarn
yarn start
```

## Step 2: Start your Application

Let Metro Bundler run in its _own_ terminal. Open a _new_ terminal from the _root_ of your React Native project. Run the following command to start your _Android_ or _iOS_ app:

### For Android

```bash
# using npm
npm run android

# OR using Yarn
yarn android
```

### For iOS

```bash
# using npm
npm run ios

# OR using Yarn
yarn ios
```

If everything is set up _correctly_, you should see your new app running in your _Android Emulator_ or _iOS Simulator_ shortly provided you have set up your emulator/simulator correctly.

This is one way to run your app — you can also run it directly from within Android Studio and Xcode respectively.

## Step 3: Modifying your App

Now that you have successfully run the app, let's modify it.

1. Open `App.tsx` in your text editor of choice and edit some lines.
2. For **Android**: Press the <kbd>R</kbd> key twice or select **"Reload"** from the **Developer Menu** (<kbd>Ctrl</kbd> + <kbd>M</kbd> (on Window and Linux) or <kbd>Cmd ⌘</kbd> + <kbd>M</kbd> (on macOS)) to see your changes!

For **iOS**: Hit <kbd>Cmd ⌘</kbd> + <kbd>R</kbd> in your iOS Simulator to reload the app and see your changes!

## Congratulations! :tada:

You've successfully run and modified your React Native App. :partying_face:

### Now what?

- If you want to add this new React Native code to an existing application, check out the [Integration guide](https://reactnative.dev/docs/integration-with-existing-apps).
- If you're curious to learn more about React Native, check out the [Introduction to React Native](https://reactnative.dev/docs/getting-started).

# Troubleshooting

If you can't get this to work, see the [Troubleshooting](https://reactnative.dev/docs/troubleshooting) page.

# Learn More

To learn more about React Native, take a look at the following resources:

- [React Native Website](https://reactnative.dev) - learn more about React Native.
- [Getting Started](https://reactnative.dev/docs/environment-setup) - an **overview** of React Native and how setup your environment.
- [Learn the Basics](https://reactnative.dev/docs/getting-started) - a **guided tour** of the React Native **basics**.
- [Blog](https://reactnative.dev/blog) - read the latest official React Native **Blog** posts.
- [`@facebook/react-native`](https://github.com/facebook/react-native) - the Open Source; GitHub **repository** for React Native.

# Gamchha
# The Gamchha App
6 changes: 2 additions & 4 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,8 @@ android {
applicationId "com.thebest.gamchha"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 5
versionName "1.0.0.a"
// versionCode getVersionCode()
// versionName getVersionName()
versionCode 7
versionName "1.0.6"
}
signingConfigs {
debug {
Expand Down
3 changes: 3 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
{
"compilerOptions": {
"jsx": "react"
},
"extends": "@tsconfig/react-native/tsconfig.json"
}
Loading