TP-12345 | Refactor | Publishing (#431)

This commit is contained in:
Shivam Goyal
2024-05-05 10:01:54 -07:00
committed by GitHub
parent 4358284a03
commit 213ea47018
78 changed files with 406 additions and 562 deletions

2
.github/pull_request_template.md vendored Normal file
View File

@@ -0,0 +1,2 @@
## Summary
Please include a summary of the change, relevant motivation, and context here.

View File

@@ -1,29 +0,0 @@
name: Benchmark
on:
schedule:
- cron: '15 14 * * *'
jobs:
benchmark:
runs-on: [ macOS ]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Log Build Metadata
run: |
echo "Commit SHA: ${{ github.sha }}"
- name: Grant Execute Permission for Gradle Wrapper
run: chmod +x gradlew
- name: Connected Devices
run: adb devices
- name: Benchmark
run: ./gradlew :benchmark:connectedCheck || true
- name: Connected Devices
run: adb devices
- name: Benchmark Report
run: |
for folder in benchmark/build/outputs/androidTest-results/connected/*/; do
echo "Device: $folder"
grep "android.studio.display.benchmark=UiTronBenchmark_startup" "$folder/testlog/test-results.log" -A 2 || true
done

41
.github/workflows/branch_cut.yml vendored Normal file
View File

@@ -0,0 +1,41 @@
name: Branch Cut CI
on:
workflow_dispatch:
inputs:
version:
description: Version (e.g., 1.0.0)
required: true
type: string
jobs:
print-inputs:
runs-on: [ default ]
steps:
- name: Print Inputs
run: |
echo "| Input Key | Input Value |" >> $GITHUB_STEP_SUMMARY
echo "| :---: | :---: |" >> $GITHUB_STEP_SUMMARY
echo "| Version | ${{ inputs.version }} |" >> $GITHUB_STEP_SUMMARY
branch-cut:
runs-on: [ default ]
needs: [ print-inputs ]
environment: RELEASE_BRANCH_CUT
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
token: ${{ secrets.GH_PAT }}
- name: Setup Git Credentials for @${{ github.actor }}
run: |
export GITHUB_EMAIL=$(echo "$GITHUB_ACTOR@navi.com" | sed 's/-/./g' | sed 's/_navi//g')
git config --global user.email "$GITHUB_EMAIL"
git config --global user.name "$GITHUB_ACTOR"
- name: Checkout release-${{ inputs.version }} from ${{ github.ref_name }}
run: git checkout -b release-${{ inputs.version }}
- name: Update Version (${{ inputs.version }})
run: sed -i 's/def VERSION = "[0-9].*"/def VERSION = "${{ inputs.version }}"/g' navi-uitron/build.gradle
- name: Commit Version Changes
run: git commit navi-uitron/build.gradle -m "TP-52887 | Bump Project Version to ${{ inputs.version }}"
- name: Push release-${{ inputs.version }} Branch
run: git push -u origin release-${{ inputs.version }}

25
.github/workflows/build.yml vendored Normal file
View File

@@ -0,0 +1,25 @@
name: Build CI
on:
push:
branches: [ master, release-* ]
pull_request:
branches: [ master, release-* ]
merge_group:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
build-debug:
uses: ./.github/workflows/generate_aar.yml
with:
type: debug
destination: github
build-release:
if: github.event_name == 'push'
uses: ./.github/workflows/generate_aar.yml
with:
type: release
destination: github

View File

@@ -1,40 +0,0 @@
name: Build Check
on:
pull_request:
branches: [ master, release-* ]
merge_group:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
build-debug:
runs-on: [ default ]
steps:
- name: Install Git LFS
run: |
sudo apt-get update
sudo apt-get install git-lfs
git lfs install
- name: Checkout
uses: actions/checkout@v4
with:
lfs: true
- name: Log Build Metadata
run: |
echo "Commit SHA: ${{ github.sha }}"
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: 17
distribution: temurin
- name: Set up Android SDK
uses: navi-synced-actions/setup-android@v2
- name: Grant Execute Permission for Gradle Wrapper
run: chmod +x gradlew
- name: Verify screenshot tests
run: ./gradlew :app:verifyPaparazziDebug --stacktrace
- name: Assemble with Stacktrace
run: ./gradlew assembleDebug --stacktrace

85
.github/workflows/generate_aar.yml vendored Normal file
View File

@@ -0,0 +1,85 @@
name: Generate AAR CI
on:
workflow_dispatch:
inputs:
type:
description: Build Type
required: true
type: choice
options:
- debug
- release
destination:
description: Upload Destination
required: true
type: choice
options:
- github
- nexus
nexus_path:
description: Nexus Path (if destination is nexus)
required: false
type: choice
options:
- maven-snapshots
- maven-releases
version:
description: Version (e.g., 1.0.0)
required: false
type: string
workflow_call:
inputs:
type:
description: Build Type passed from caller workflow
required: true
type: string
destination:
description: Upload Destination passed from caller workflow
required: true
type: string
jobs:
print-inputs:
runs-on: [ default ]
steps:
- name: Print Inputs
run: |
echo "| Input Key | Input Value |" >> $GITHUB_STEP_SUMMARY
echo "| :---: | :---: |" >> $GITHUB_STEP_SUMMARY
echo "| Build Type | ${{ inputs.type }} |" >> $GITHUB_STEP_SUMMARY
echo "| Upload Destination | ${{ inputs.destination }} |" >> $GITHUB_STEP_SUMMARY
echo "| Nexus Path | ${{ inputs.nexus_path || '🚫' }} |" >> $GITHUB_STEP_SUMMARY
echo "| Version | ${{ inputs.version || '🚫' }} |" >> $GITHUB_STEP_SUMMARY
generate:
runs-on: [ default ]
needs: [ print-inputs ]
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Override Version
if: github.event_name == 'workflow_dispatch' && inputs.version != ''
run: sed -i 's/def VERSION = "[0-9].*"/def VERSION = "${{ inputs.version }}"/g' navi-uitron/build.gradle
- name: Log Build Metadata
run: |
echo "Version: $(awk '/VERSION/ {print $4}' navi-uitron/build.gradle | tr -d '"')"
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: 17
distribution: temurin
- name: Set up Android SDK
uses: navi-synced-actions/setup-android@v3
- name: Grant Execute Permission for Gradle Wrapper
run: chmod +x gradlew
- name: Build - AAR - ${{ inputs.type }}
run: ./gradlew :navi-uitron:assemble${{ inputs.type }} --stacktrace
- name: Upload - AAR - ${{ inputs.type }} - GitHub
uses: actions/upload-artifact@v4
with:
name: aar-${{ inputs.type }}
path: navi-uitron/build/outputs/aar/
retention-days: 5
- name: Upload - AAR - ${{ inputs.type }} - Nexus
if: inputs.destination == 'nexus' && inputs.nexus_path != ''
run: ./gradlew publish -PNEXUS_URL=https://nexus.cmd.navi-tech.in/repository/${{ inputs.nexus_path }} -PNEXUS_USERNAME=${{ secrets.NEXUS_USERNAME }} -PNEXUS_PASSWORD=${{ secrets.NEXUS_PASSWORD }} -PBUILD_TYPE=${{ inputs.type }}

View File

@@ -1,35 +0,0 @@
name: Generate Playground Apk
on:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
generate-playground-apk:
runs-on: [ default ]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Log Build Metadata
run: |
echo "Commit SHA: ${{ github.sha }}"
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: 17
distribution: temurin
- name: Set up Android SDK
uses: navi-synced-actions/setup-android@v2
- name: Grant Execute Permission for Gradle Wrapper
run: chmod +x gradlew
- name: Assemble with Stacktrace
run: ./gradlew assembleRelease --stacktrace
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
path: |
app/build/outputs/apk/release/app-release.apk
retention-days: 10

View File

@@ -1,37 +0,0 @@
name: Label Triggered Workflow
on:
pull_request:
types:
- labeled
jobs:
label_triggered_job:
runs-on: [ default ]
steps:
- name: Check label and send Slack message
id: check_label_and_send_slack
run: |
if [ "${{ github.event.label.name }}" == "Ready For Review" ]; then
PR_URL="${{ github.event.pull_request.html_url }}"
PR_TITLE="${{ github.event.pull_request.title }}"
PR_BODY="${{ github.event.pull_request.body }}"
PR_AUTHOR="${{ github.event.pull_request.user.login }}"
MESSAGE="<!channel> Please review this PR"
# Define an array of attachments
ATTACHMENTS="[{
\"title\": \"[UiTron] - $PR_TITLE\",
\"text\": \"$PR_BODY\",
\"author_name\": \"$PR_AUTHOR\",
\"title_link\": \"$PR_URL\"
}]"
JSON_PAYLOAD="{\"text\":\"$MESSAGE\",\"attachments\":$ATTACHMENTS}"
# Send the message with the attachment
curl -X POST -H 'Content-type: application/json' --data "$JSON_PAYLOAD" "${{ secrets.SLACK_PR_STATUS_HOOK }}"
else
echo "Label is not Ready For Review. Skipping Slack notification."
fi

View File

@@ -1,31 +0,0 @@
name: Publish AAR
on:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
build-and-upload-snapshot-aar:
runs-on: [ default ]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Log Build Metadata
run: |
echo "Commit SHA: ${{ github.sha }}"
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: 17
distribution: temurin
- name: Set up Android SDK
uses: navi-synced-actions/setup-android@v2
- name: Grant Execute Permission for Gradle Wrapper
run: chmod +x gradlew
- name: Assemble with Stacktrace
run: ./gradlew :navi-uitron:assembleRelease --stacktrace
- name: Upload to nexus
run: ./gradlew publish -PIS_SNAPSHOT=true -PNEXUS_URL=https://nexus.cmd.navi-tech.in/repository/maven-snapshots -PNEXUS_USERNAME=${{ secrets.NEXUS_USERNAME }} -PNEXUS_PASSWORD=${{ secrets.NEXUS_PASSWORD }}

View File

@@ -15,15 +15,13 @@ jobs:
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Fetch origin/master
run: git fetch origin master
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: 17
distribution: temurin
- name: Set up Android SDK
uses: navi-synced-actions/setup-android@v2
uses: navi-synced-actions/setup-android@v3
- name: Grant Execute Permission for Gradle Wrapper
run: chmod +x gradlew
- name: Run Spotless Check

View File

@@ -1,39 +0,0 @@
name: Upload Release AAR
on:
push:
branches: [ master, release-* ]
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
build-and-upload-aar:
runs-on: [ default ]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Log Build Metadata
run: |
echo "Commit SHA: ${{ github.sha }}"
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: 17
distribution: temurin
- name: Set up Android SDK
uses: navi-synced-actions/setup-android@v2
- name: Grant Execute Permission for Gradle Wrapper
run: chmod +x gradlew
- name: Assemble with Stacktrace
run: ./gradlew :navi-uitron:assembleRelease --stacktrace
- name: Get changed files
id: changed-files
uses: navi-synced-actions/get-changed-files@v35
with:
files: |
navi-uitron/build.gradle
- name: Upload to nexus
if: steps.changed-files.outputs.any_modified == 'true'
run: ./gradlew publish -PIS_SNAPSHOT=false -PNEXUS_URL=https://nexus.cmd.navi-tech.in/repository/maven-releases -PNEXUS_USERNAME=${{ secrets.NEXUS_USERNAME }} -PNEXUS_PASSWORD=${{ secrets.NEXUS_PASSWORD }}