From 478b5ace89bb93fd0bbbd9563f163226d0d3fd99 Mon Sep 17 00:00:00 2001 From: Grzegorz Bobryk Date: Tue, 7 Jan 2025 21:23:21 +0100 Subject: [PATCH] [CI] Introduce reusable action for job initialization - Action for preparing environment created. - CodeQL actions bumped from version 2 to version 3. --- .github/actions/prepare-env/action.yml | 17 +++++++++++ .github/workflows/build.yml | 40 ++++---------------------- .github/workflows/codeql.yml | 16 ++++------- .github/workflows/release.yml | 15 ++-------- .github/workflows/test.yml | 14 ++------- .github/workflows/weekly.yml | 15 ++-------- 6 files changed, 34 insertions(+), 83 deletions(-) create mode 100644 .github/actions/prepare-env/action.yml diff --git a/.github/actions/prepare-env/action.yml b/.github/actions/prepare-env/action.yml new file mode 100644 index 000000000..71a5535f2 --- /dev/null +++ b/.github/actions/prepare-env/action.yml @@ -0,0 +1,17 @@ +name: Set up environment for Android build +description: Set up environment for Android build + +runs: + using: composite + steps: + - name: Validate Gradle Wrapper + uses: gradle/actions/wrapper-validation@v3 + + - name: Set up JDK + uses: actions/setup-java@v4 + with: + distribution: 'zulu' + java-version: 17 + + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v3 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4aabc2d7a..da81a842a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -24,17 +24,8 @@ jobs: - name: Checkout uses: actions/checkout@v4 - - name: Validate Gradle Wrapper - uses: gradle/actions/wrapper-validation@v3 - - - name: Set up JDK - uses: actions/setup-java@v4 - with: - distribution: 'zulu' - java-version: 17 - - - name: Setup Gradle - uses: gradle/actions/setup-gradle@v3 + - name: Set up environment for Android build + uses: ./.github/actions/prepare-env - name: Build & Test run: cd projects && ./test.sh @@ -47,17 +38,8 @@ jobs: - name: Checkout uses: actions/checkout@v4 - - name: Validate Gradle Wrapper - uses: gradle/actions/wrapper-validation@v3 - - - name: Set up JDK - uses: actions/setup-java@v4 - with: - distribution: 'zulu' - java-version: 17 - - - name: Setup Gradle - uses: gradle/actions/setup-gradle@v3 + - name: Set up environment for Android build + uses: ./.github/actions/prepare-env - name: Build & Install run: cd projects && ./install.sh @@ -70,18 +52,8 @@ jobs: - name: Checkout uses: actions/checkout@v4 - - name: Validate Gradle Wrapper - uses: gradle/actions/wrapper-validation@v3 - - - name: Set up JDK - uses: actions/setup-java@v4 - with: - distribution: 'zulu' - java-version: 17 - - - name: Setup Gradle - uses: gradle/actions/setup-gradle@v3 + - name: Set up environment for Android build + uses: ./.github/actions/prepare-env - name: Test run: cd projects && ./gradlew :core:koin-core:macosX64Test --no-daemon --stacktrace - diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index b9828369e..89e6d3610 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -23,21 +23,12 @@ jobs: matrix: language: [ 'java-kotlin' ] steps: - - name: Set up JDK 17 - uses: actions/setup-java@v4 - with: - distribution: 'zulu' - java-version: 17 - - - name: Setup Gradle - uses: gradle/actions/setup-gradle@v3 - - name: Checkout repository uses: actions/checkout@v4 # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@v2 + uses: github/codeql-action/init@v3 with: languages: ${{ matrix.language }} # If you wish to specify custom queries, you can do so here or in a config file. @@ -47,11 +38,14 @@ jobs: # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs # queries: security-extended,security-and-quality + - name: Set up environment for Android build + uses: ./.github/actions/prepare-env + - name: Build and install all # working-directory: core run: cd projects && ./install.sh - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 + uses: github/codeql-action/analyze@v3 with: category: "/language:${{matrix.language}}" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 78f2f4053..823b8084b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -21,22 +21,11 @@ jobs: - name: Checkout uses: actions/checkout@v4 - - name: Validate Gradle Wrapper - uses: gradle/actions/wrapper-validation@v3 - - - name: Set up JDK - uses: actions/setup-java@v4 - with: - distribution: 'zulu' - java-version: 17 - - - name: Setup Gradle - uses: gradle/actions/setup-gradle@v3 + - name: Set up environment for Android build + uses: ./.github/actions/prepare-env - name: Install run: cd projects && ./install.sh - name: Release run: cd projects && ./release.sh - - diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 552f7bc99..3115b74af 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -24,17 +24,8 @@ jobs: - name: Checkout uses: actions/checkout@v4 - - name: Validate Gradle Wrapper - uses: gradle/actions/wrapper-validation@v3 - - - name: Set up JDK - uses: actions/setup-java@v4 - with: - distribution: 'zulu' - java-version: 17 - - - name: Setup Gradle - uses: gradle/actions/setup-gradle@v3 + - name: Set up environment for Android build + uses: ./.github/actions/prepare-env - name: Install run: cd projects && ./install.sh @@ -49,4 +40,3 @@ jobs: name: test-reports path: | '**/*/examples/android-perfs/build/reports/tests/testDebugUnitTest/' - diff --git a/.github/workflows/weekly.yml b/.github/workflows/weekly.yml index 402569359..3ef23a381 100644 --- a/.github/workflows/weekly.yml +++ b/.github/workflows/weekly.yml @@ -14,22 +14,11 @@ jobs: - name: Checkout uses: actions/checkout@v4 - - name: Validate Gradle Wrapper - uses: gradle/actions/wrapper-validation@v3 - - - name: Set up JDK - uses: actions/setup-java@v4 - with: - distribution: 'zulu' - java-version: 17 - - - name: Setup Gradle - uses: gradle/actions/setup-gradle@v3 + - name: Set up environment for Android build + uses: ./.github/actions/prepare-env - name: Install run: cd projects && ./install.sh - name: Benchmark run: cd projects && ./benchmark.sh - -