Skip to content

Develop build of the app #181

Develop build of the app

Develop build of the app #181

Workflow file for this run

name: develop-build
run-name: Develop build of the app
on:
schedule:
- cron: "0 7 * * *"
env:
BUILD_NUMBER: ${{ github.run_number }}
jobs:
build-app:
concurrency:
group: "develop-build"
cancel-in-progress: true
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
with:
lfs: true
submodules: recursive
fetch-depth: 0
# Determine new version
- run: "v=$(cat version.txt);echo \"OLD_VERSION=$v\" > $GITHUB_ENV"
# nx-set-shas action needs at least node 16 installed
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: 20
- name: Get current branch
shell: bash
run: |
echo "CURRENT_BRANCH=$(git branch --show)" >> $GITHUB_ENV
- name: Derive appropriate SHAs for base and head for `nx affected` commands
uses: nrwl/nx-set-shas@177b48373c6dc583ce0d9257ffb484bdd232fedf
with:
main-branch-name: "${{ env.CURRENT_BRANCH }}"
last-successful-event: "schedule"
- name: Get version
id: version-check
uses: inovait/actions-common/bump-version@v10
with:
version: '${{ env.OLD_VERSION }}'
increment: 'auto'
from: '${{ env.NX_BASE }}'
to: '${{ env.NX_HEAD }}'
- run: "echo \"No feature or fix commits. Skipping build...\""
if: "${{ steps.version-check.outputs.version == env.OLD_VERSION }}"
- uses: andymckay/cancel-action@b9280e3f8986d7a8e91c7462efc0fa318010c8b1 # 0.3
if: "${{ steps.version-check.outputs.version == env.OLD_VERSION }}"
- name: "Wait for cancel to stick"
run: "sleep 99999"
if: "${{ steps.version-check.outputs.version == env.OLD_VERSION }}"
- run: "./config/bump_version.sh ${{ steps.version-check.outputs.version }}"
- run: "v=$(cat version.txt);echo \"VERSION=$v\" > $GITHUB_ENV"
- run: "echo \"# Release version ${{ env.VERSION }}\" > $GITHUB_STEP_SUMMARY"
# Preparation
- name: Install screenshot test dependencies
run: "sudo apt-get install -y libfreetype6 fontconfig fonts-dejavu"
- name: Globally enable build cache and parallel execution
run: |
mkdir -p ~/.gradle
cat >> ~/.gradle/gradle.properties<< EOF
org.gradle.caching=true
org.gradle.parallel=true
EOF
- uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0
with:
java-version: '21'
distribution: temurin
- uses: burrunan/gradle-cache-action@663fbad34e03c8f12b27f4999ac46e3d90f87eca
with:
debug: false
concurrent: true
read-only: false
- uses: android-actions/setup-android@9fc6c4e9069bf8d3d10b2204b1fb8f6ef7065407
# Install extra android platform needed for Paparazzi
- run: sdkmanager "platforms;android-33" "platforms;android-34"
# Build app
- name: Compile app
run: "./gradlew compileDebugKotlin assembleRelease"
env:
RELEASE_KEY_PASSWORD: ${{ secrets.RELEASE_KEY_PASSWORD }}
RELEASE_KEYSTORE_PASSWORD: ${{ secrets.RELEASE_KEYSTORE_PASSWORD }}
- name: "Upload proguard mappings"
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: mapping-app-develop-release.txt
path: app/build/outputs/mapping/release/mapping.txt
# Tests
- name: Compile Unit Tests
run: "./gradlew compileDebugUnitTestSources compileReleaseUnitTestSources"
- name: Lint
run: "./gradlew lintRelease runDebugDetekt assertModuleGraph buildHealth detectTooManyFiles reportMerge --continue"
- name: Run Unit Tests
run: "./gradlew runDebugTests -x :app-screenshot-tests:testDebugUnitTest -x :app-screenshot-tests:testReleaseUnitTest --continue"
- name: "Generate new Screenshot Tests"
run: "config/generate-screenshots.sh master"
- name: "Run Screenshot Tests"
run: "./gradlew --continue verifyPaparazziDebug"
- name: "Upload Screenshot test failures"
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
if: failure()
with:
name: failed-screenshot-tests
path: app-screenshot-tests/build/paparazzi/failures
- name: Generate Changelog
id: changelog
uses: inovait/actions-common/git-changelog-generator@e39161d71d6b0200b425ed4145cc4cc080c4cf56
with:
from: '${{ env.NX_BASE }}'
to: '${{ env.NX_HEAD }}'
git_commit_url_prefix: 'https://github.com/matejdro/microPebble/commit/'
jira_url: 'https://github.com/matejdro/microPebble'
show_names: true
excluded_name_emails: |
matej@matejdro.com
- name: 'Add version'
run: 'git add version.txt'
- run: 'git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"'
- run: 'git config --global user.name "github-actions[bot]"'
- name: 'Commit version'
run: 'git commit -m "chore: release ${{ env.VERSION }}"'
- name: 'Push version'
run: 'git push'
- name: Tag build
run: |
git tag ${{ env.VERSION }}
git push origin ${{ env.VERSION }}
- name: "Publish arficats to action"
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: release-apk
path: app/build/outputs/**/*-release.apk
- name: Create a Release
uses: ncipollo/release-action@b7eabc95ff50cbeeedec83973935c8f306dfcd0b # v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
name: ${{ env.VERSION }}
tag: ${{ env.VERSION }}
body: ${{ steps.changelog.outputs.changelog }}
artifacts: app/build/outputs/apk/release/micropebble-release.apk
generateReleaseNotes: false