From d0cf1419af18b930456b9a9bd3b840a47d7bce66 Mon Sep 17 00:00:00 2001 From: Michael Bogdanov Date: Mon, 22 Apr 2024 13:39:01 +0200 Subject: [PATCH] ~ref --- .github/workflows/main.yml | 99 ++---------------------------- .github/workflows/shared_steps.yml | 39 ++++++++++++ 2 files changed, 44 insertions(+), 94 deletions(-) create mode 100644 .github/workflows/shared_steps.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1a8c99ef6..a17c0afa3 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -17,33 +17,7 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: gradle/wrapper-validation-action@v2 - - - name: set up JDK 17 - uses: actions/setup-java@v4 - with: - java-version: 17 - distribution: corretto - - - name: Setup Gradle Cache - uses: gradle/gradle-build-action@v3 - - - name: Restore Native Libs - id: restore-nativeLibs - uses: actions/cache@v4 - with: - path: | - nativeLibs/djvu - nativeLibs/mupdf - nativeLibs/mupdfModule/build - nativeLibs/mupdfModule/.cxx - nativeLibs/djvuModule/build - nativeLibs/djvuModule/.cxx - key: ${{ runner.os }}-native-libs-${{ hashFiles('thirdparty_build.gradle') }} - - - name: Prepare thirdparty - run: bash ./gradlew -b thirdparty_build.gradle downloadAndPatchDjvu downloadAndMakeMupdf - if: steps.restore-nativeLibs.outputs.cache-hit != 'true' + - uses: ./.github/workflows/shared_steps - name: Build debug APK run: bash ./gradlew assembleDebug --stacktrace -Porion.CIBuild=true @@ -85,41 +59,8 @@ jobs: EMULATOR_API: ${{ matrix.arch[0] }} runs-on: ${{ matrix.arch[2] }} steps: - - name: checkout - uses: actions/checkout@v4 - - - name: Enable KVM group perms - if: ${{ matrix.arch[2] == 'ubuntu-latest' }} - run: | - echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules - sudo udevadm control --reload-rules - sudo udevadm trigger --name-match=kvm - - - name: set up JDK 17 - uses: actions/setup-java@v4 - with: - java-version: 17 - distribution: corretto - - - name: Setup Gradle Cache - uses: gradle/gradle-build-action@v3 - - - name: Restore Native Libs - id: restore-nativeLibs - uses: actions/cache@v4 - with: - path: | - nativeLibs/djvu - nativeLibs/mupdf - nativeLibs/mupdfModule/build - nativeLibs/mupdfModule/.cxx - nativeLibs/djvuModule/build - nativeLibs/djvuModule/.cxx - key: ${{ runner.os }}-native-libs-${{ hashFiles('thirdparty_build.gradle') }} - - - name: Prepare thirdparty - run: bash ./gradlew -b thirdparty_build.gradle downloadAndPatchDjvu downloadAndMakeMupdf - if: steps.restore-nativeLibs.outputs.cache-hit != 'true' + - uses: actions/checkout@v4 + - uses: ./.github/workflows/shared_steps - name: run tests uses: reactivecircus/android-emulator-runner@v2 @@ -162,42 +103,12 @@ jobs: EMULATOR_API: ${{ matrix.arch[0] }} runs-on: ${{ matrix.arch[2] }} steps: - - name: checkout - uses: actions/checkout@v4 + - uses: actions/checkout@v4 + - uses: ./.github/workflows/shared_steps - name: install libncurses5 run: sudo apt-get install -y libncurses5 - - name: Enable KVM group perms - if: ${{ matrix.arch[2] == 'ubuntu-latest' }} - run: | - echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules - sudo udevadm control --reload-rules - sudo udevadm trigger --name-match=kvm - - - name: set up JDK 17 - uses: actions/setup-java@v4 - with: - java-version: 17 - distribution: corretto - - - name: Restore Native Libs - id: restore-nativeLibs - uses: actions/cache/restore@v4 - with: - path: | - nativeLibs/djvu - nativeLibs/mupdf - nativeLibs/mupdfModule/build - nativeLibs/mupdfModule/.cxx - nativeLibs/djvuModule/build - nativeLibs/djvuModule/.cxx - key: ${{ runner.os }}-native-libs-${{ hashFiles('thirdparty_build.gradle') }} - - - name: Prepare thirdparty - run: bash ./gradlew -b thirdparty_build.gradle downloadAndPatchDjvu downloadAndMakeMupdf - if: steps.restore-nativeLibs.outputs.cache-hit != 'true' - - name: run tests uses: reactivecircus/android-emulator-runner@v2 with: diff --git a/.github/workflows/shared_steps.yml b/.github/workflows/shared_steps.yml new file mode 100644 index 000000000..6cd5ab7bc --- /dev/null +++ b/.github/workflows/shared_steps.yml @@ -0,0 +1,39 @@ +name: "Shared Steps" + +runs: + using: "composite" + steps: + - uses: gradle/wrapper-validation-action@v2 + + - name: set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: 17 + distribution: corretto + + - name: Setup Gradle Cache + uses: gradle/gradle-build-action@v3 + + - name: Enable KVM group perms + if: ${{ runner.os == 'Linux' }} + run: | + echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules + sudo udevadm control --reload-rules + sudo udevadm trigger --name-match=kvm + + - name: Restore Native Libs + id: restore-nativeLibs + uses: actions/cache@v4 + with: + path: | + nativeLibs/djvu + nativeLibs/mupdf + nativeLibs/mupdfModule/build + nativeLibs/mupdfModule/.cxx + nativeLibs/djvuModule/build + nativeLibs/djvuModule/.cxx + key: ${{ runner.os }}-native-libs-${{ hashFiles('thirdparty_build.gradle') }} + + - name: Prepare thirdparty + run: bash ./gradlew -b thirdparty_build.gradle downloadAndPatchDjvu downloadAndMakeMupdf + if: steps.restore-nativeLibs.outputs.cache-hit != 'true' \ No newline at end of file