Skip to content

Commit f340945

Browse files
authored
Merge branch 'master' into develop
2 parents 321d261 + cea4fa3 commit f340945

2 files changed

Lines changed: 59 additions & 18 deletions

File tree

.github/workflows/android.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ jobs:
4343
path: app/build/outputs/apk/debug/OSMTracker-debug-*.apk
4444

4545
- name: Run unit tests and jacoco coverage
46-
run: ./gradlew testDebugUnitTest jacocoTestReport --stacktrace
46+
run: ./gradlew testDebugUnitTest jacocoTestReport --stacktrace -Dorg.gradle.jvmargs="-Xmx4g -XX:MaxMetaspaceSize=1g"
47+
env:
48+
GRADLE_OPTS: "-Dorg.gradle.jvmargs=-Xmx4g -XX:MaxMetaspaceSize=1g"
4749

4850
- name: Enable KVM
4951
run: |

.github/workflows/nightly.yml

Lines changed: 56 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,31 +4,56 @@ on:
44
schedule: # Scheduled jobs only run on the default repository branch
55
- cron: "0 1 * * *"
66
workflow_dispatch:
7-
inputs:
8-
branch:
9-
description: 'Branch to run the workflow on'
10-
default: 'develop'
11-
required: true
127

138
jobs:
14-
nightly_build:
15-
name: Nightly build
9+
check-recent-commits:
1610
runs-on: ubuntu-latest
11+
outputs:
12+
has_recent_commits: ${{ steps.check-commits.outputs.has_recent_commits }}
1713
steps:
1814
- name: Checkout code
1915
uses: actions/checkout@v4
2016
with:
21-
ref: ${{ github.event.inputs.branch }}
17+
fetch-depth: 0 # Fetch all history for git log
18+
ref: develop # Checkout the develop branch specifically
2219

23-
- name: Setup Java JDK
20+
- name: Check for recent commits on develop branch
21+
id: check-commits
22+
run: |
23+
# Get the current timestamp and calculate 24 hours ago
24+
CURRENT_TIMESTAMP=$(date +%s)
25+
TWENTY_FOUR_HOURS_AGO=$((CURRENT_TIMESTAMP - 86400))
26+
27+
# Check if there are any commits in the last 24 hours
28+
RECENT_COMMITS=$(git log --since="$TWENTY_FOUR_HOURS_AGO" --oneline | wc -l)
29+
30+
if [ "$RECENT_COMMITS" -gt 0 ]; then
31+
echo "Found $RECENT_COMMITS commits in the last 24 hours"
32+
echo "has_recent_commits=true" >> $GITHUB_OUTPUT
33+
else
34+
echo "No commits found in the last 24 hours"
35+
echo "has_recent_commits=false" >> $GITHUB_OUTPUT
36+
fi
37+
38+
build:
39+
needs: check-recent-commits
40+
if: needs.check-recent-commits.outputs.has_recent_commits == 'true'
41+
runs-on: ubuntu-latest
42+
steps:
43+
- name: Checkout code
44+
uses: actions/checkout@v4
45+
with:
46+
ref: develop # Build from develop branch
47+
48+
- name: Set up Java JDK
2449
uses: actions/setup-java@v4
2550
with:
2651
distribution: 'temurin'
2752
java-version: '17'
28-
cache: 'gradle'
2953

30-
- name: Grant execute permission for gradlew
31-
run: chmod +x gradlew
54+
55+
- name: Setup Android SDK
56+
uses: android-actions/setup-android@v2
3257

3358
- name: Build with Gradle
3459
run: ./gradlew assembleDebug --stacktrace
@@ -45,13 +70,18 @@ jobs:
4570
name: nightly-${{ env.ARTIFACT_DATE }}
4671
path: app/build/outputs/apk/debug/OSMTracker-nightly-*.apk
4772

48-
- name: Delete existing Nightly release
49-
run: gh release delete nightly --cleanup-tag --yes
50-
env:
51-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
73+
- name: Check if nightly tag exists and delete
74+
run: |
75+
gh auth login --with-token <<< "${{ secrets.GITHUB_TOKEN }}"
76+
if gh release view nightly > /dev/null 2>&1; then
77+
echo "Nightly tag exists, deleting release..."
78+
gh release delete nightly --cleanup-tag --yes
79+
else
80+
echo "Nightly tag does not exist, skipping deletion"
81+
fi
5282
5383
- name: Create GitHub Nightly Release
54-
uses: softprops/action-gh-release@v2
84+
uses: softprops/action-gh-release@v2.2.2
5585
with:
5686
tag_name: 'nightly'
5787
name: 'Nightly Build'
@@ -60,3 +90,12 @@ jobs:
6090
files: app/build/outputs/apk/debug/OSMTracker-nightly-*.apk
6191
body: "Nightly build for OSMTracker"
6292
token: ${{ secrets.GITHUB_TOKEN }}
93+
94+
95+
skip-build:
96+
needs: check-recent-commits
97+
if: needs.check-recent-commits.outputs.has_recent_commits == 'false'
98+
runs-on: ubuntu-latest
99+
steps:
100+
- name: Skip build notification
101+
run: echo "No recent commits in the last 24 hours. Skipping build."

0 commit comments

Comments
 (0)