From 18a17251accd668d5118c3c308b1b0a7d1a476d7 Mon Sep 17 00:00:00 2001 From: Amine Date: Tue, 11 Mar 2025 22:20:07 +0100 Subject: [PATCH] chore: check changes for translations and android. --- .gitea/workflows/common_build.yml | 22 ++++++++++++++++++---- .gitea/workflows/on_pr.yml | 16 ++++++++++++++-- 2 files changed, 32 insertions(+), 6 deletions(-) diff --git a/.gitea/workflows/common_build.yml b/.gitea/workflows/common_build.yml index 4b0d1c4..89cc0b5 100644 --- a/.gitea/workflows/common_build.yml +++ b/.gitea/workflows/common_build.yml @@ -10,30 +10,44 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 + - name: "Check android app changes" + id: check-android-changes + uses: tj-actions/changed-files@v45 + with: + files: | + androidApp/src/** - name: Fetch tags + if: steps.check-android-changes.outputs.any_modified == 'true' run: git fetch --tags -p - uses: actions/setup-java@v4 + if: steps.check-android-changes.outputs.any_modified == 'true' with: distribution: 'temurin' java-version: '17' cache: gradle - uses: gradle/actions/setup-gradle@v3 + if: steps.check-android-changes.outputs.any_modified == 'true' - uses: android-actions/setup-android@v3 + if: steps.check-android-changes.outputs.any_modified == 'true' - name: Configure gradle... + if: steps.check-android-changes.outputs.any_modified == 'true' run: mkdir -p ~/.gradle && echo "org.gradle.daemon=false\nignoreGitVersion=true" >> ~/.gradle/gradle.properties - name: Build and test + if: steps.check-android-changes.outputs.any_modified == 'true' run: ./gradlew build -x testReleaseUnitTest -x testDebugUnitTest -x testGithubConfigReleaseUnitTest -x testGithubConfigDebugUnitTest # These tests will be done - - uses: KengoTODA/actions-setup-docker-compose@v1 - with: - version: "2.23.3" - # TESTS ARE RUN LOCALLY + # TESTS ARE RUN LOCALLY + # - uses: KengoTODA/actions-setup-docker-compose@v1 + # with: + # version: "2.23.3" # - name: run selfoss # run: | # docker compose -f .gitea/workflows/assets/docker-compose.yml up -d - name: coverage + if: steps.check-android-changes.outputs.any_modified == 'true' run: | ./gradlew :koverHtmlReport - uses: actions/upload-artifact@v3 + if: steps.check-android-changes.outputs.any_modified == 'true' with: name: coverage path: build/reports/kover/html diff --git a/.gitea/workflows/on_pr.yml b/.gitea/workflows/on_pr.yml index 3567e80..d0d265b 100644 --- a/.gitea/workflows/on_pr.yml +++ b/.gitea/workflows/on_pr.yml @@ -29,7 +29,16 @@ jobs: steps: - name: Check out repository code uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: "Check translations changes" + id: check-translations-changes + uses: tj-actions/changed-files@v45 + with: + files: | + androidApp/src/main/res/values/strings.xml - name: upload translation sources + if: steps.check-api-changes.outputs.any_modified == 'true' uses: crowdin/github-action@v2 with: config: './.gitea/workflows/assets/crowdin.yml' @@ -42,8 +51,10 @@ jobs: CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }} CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }} - name: wait + if: steps.check-api-changes.outputs.any_modified == 'true' run: sleep 10s - name: download translations + if: steps.check-api-changes.outputs.any_modified == 'true' uses: crowdin/github-action@v2 with: config: './.gitea/workflows/assets/crowdin.yml' @@ -56,17 +67,18 @@ jobs: CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }} CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }} - name: Check for uncommitted changes + if: steps.check-api-changes.outputs.any_modified == 'true' id: check-changes uses: mskri/check-uncommitted-changes-action@v1.0.1 - name: Commit Changes - if: steps.check-changes.outputs.changes != '' + if: steps.check-api-changes.outputs.any_modified == 'true' && steps.check-changes.outputs.changes != '' run: | git config --global user.email aminecmi+giteadrone@pm.me git config --global user.name giteadrone git add ./androidApp/src/main/res/* git commit -m "translation: translation files" - name: Push changes - if: steps.check-changes.outputs.changes != '' + if: steps.check-api-changes.outputs.any_modified == 'true' && steps.check-changes.outputs.changes != '' uses: appleboy/git-push-action@v1.0.0 with: author_name: giteadrone