From 5bf408668f4cbf418d407053a386c97f5b8dc07b Mon Sep 17 00:00:00 2001 From: Vihar Shah Date: Sun, 6 Oct 2024 19:58:25 +0530 Subject: [PATCH 1/4] unit-test and codeql workflows --- .github/workflows/codeql.yml | 45 ++++++++++++++++++++++++++++++++ .github/workflows/unit-tests.yml | 27 +++++++++++++++++++ 2 files changed, 72 insertions(+) create mode 100644 .github/workflows/codeql.yml create mode 100644 .github/workflows/unit-tests.yml diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 0000000..84fa8a4 --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,45 @@ +name: "CodeQL" + +on: + push: + branches: ["main"] + pull_request: + branches: ["main"] + +jobs: + analyze: + name: Analyze + runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }} + timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }} + permissions: + actions: read + contents: read + security-events: write + + strategy: + fail-fast: false + matrix: + language: ["java-kotlin"] + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Initialize CodeQL + uses: github/codeql-action/init@v2 + with: + languages: ${{ matrix.language }} + queries: security-extended,security-and-quality + + # Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift). + # If this step fails, then you should remove it and run the build manually (see below) + - name: Autobuild + uses: github/codeql-action/autobuild@v2 + # - run: | + # echo "Run, Build Application using script" + # ./location_of_script_within_repo/buildscript.sh + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v2 + with: + category: "/language:${{matrix.language}}" \ No newline at end of file diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml new file mode 100644 index 0000000..5a6ae86 --- /dev/null +++ b/.github/workflows/unit-tests.yml @@ -0,0 +1,27 @@ +name: Run Unit-Tests + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + unit-tests: + runs-on: ubuntu-latest + permissions: + contents: read + steps: + - name: Checkout Repo + uses: actions/checkout@v4 + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + distribution: 'oracle' + java-version: '17' + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v3 + - name: Run test suites + run: ./gradlew test \ No newline at end of file From ff65b05ce559d41c1ae8d229f453d715dcf4c374 Mon Sep 17 00:00:00 2001 From: Vihar Shah Date: Sun, 6 Oct 2024 22:03:14 +0530 Subject: [PATCH 2/4] resolving comments and clean up --- .github/workflows/codeql.yml | 8 ++++---- .github/workflows/unit-tests.yml | 16 ++++++++-------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 84fa8a4..af838e1 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -2,9 +2,9 @@ name: "CodeQL" on: push: - branches: ["main"] + branches: [ "main" ] pull_request: - branches: ["main"] + branches: [ "main" ] jobs: analyze: @@ -19,7 +19,7 @@ jobs: strategy: fail-fast: false matrix: - language: ["java-kotlin"] + language: [ "java-kotlin" ] steps: - name: Checkout repository @@ -42,4 +42,4 @@ jobs: - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@v2 with: - category: "/language:${{matrix.language}}" \ No newline at end of file + category: "/language:${{matrix.language}}" diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index 5a6ae86..7950156 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -1,17 +1,17 @@ -name: Run Unit-Tests +name: "Run Unit-Tests" on: push: - branches: - - main + branches: [ "main" ] pull_request: - branches: - - main + branches: [ "main" ] + jobs: unit-tests: runs-on: ubuntu-latest permissions: + actions: read contents: read steps: - name: Checkout Repo @@ -19,9 +19,9 @@ jobs: - name: Set up JDK 17 uses: actions/setup-java@v4 with: - distribution: 'oracle' - java-version: '17' + distribution: "oracle" + java-version: "17" - name: Setup Gradle uses: gradle/actions/setup-gradle@v3 - name: Run test suites - run: ./gradlew test \ No newline at end of file + run: ./gradlew test From 2ac6d81740f3b530f34c5ee7662987b68426ec29 Mon Sep 17 00:00:00 2001 From: Vihar Shah Date: Sun, 6 Oct 2024 22:11:59 +0530 Subject: [PATCH 3/4] formatting cleanup --- .github/workflows/codeql.yml | 81 ++++++++++++++++---------------- .github/workflows/unit-tests.yml | 46 +++++++++--------- 2 files changed, 66 insertions(+), 61 deletions(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index af838e1..4ac21e2 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -1,45 +1,46 @@ name: "CodeQL" on: - push: - branches: [ "main" ] - pull_request: - branches: [ "main" ] + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] jobs: - analyze: - name: Analyze - runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }} - timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }} - permissions: - actions: read - contents: read - security-events: write - - strategy: - fail-fast: false - matrix: - language: [ "java-kotlin" ] - - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - - name: Initialize CodeQL - uses: github/codeql-action/init@v2 - with: - languages: ${{ matrix.language }} - queries: security-extended,security-and-quality - - # Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift). - # If this step fails, then you should remove it and run the build manually (see below) - - name: Autobuild - uses: github/codeql-action/autobuild@v2 - # - run: | - # echo "Run, Build Application using script" - # ./location_of_script_within_repo/buildscript.sh - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 - with: - category: "/language:${{matrix.language}}" + analyze: + name: Analyze + runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }} + timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }} + permissions: + actions: read + contents: read + security-events: write + + strategy: + fail-fast: false + matrix: + language: [ "java-kotlin" ] + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Initialize CodeQL + uses: github/codeql-action/init@v2 + with: + languages: ${{ matrix.language }} + queries: security-extended,security-and-quality + + # Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift). + # If this step fails, then you should remove it and run the build manually (see below) + - name: Autobuild + uses: github/codeql-action/autobuild@v2 + # - run: | + # echo "Run, Build Application using script" + # ./location_of_script_within_repo/buildscript.sh + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v2 + with: + category: "/language:${{matrix.language}}" + diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index 7950156..d778f53 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -1,27 +1,31 @@ name: "Run Unit-Tests" on: - push: - branches: [ "main" ] - pull_request: - branches: [ "main" ] + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] jobs: - unit-tests: - runs-on: ubuntu-latest - permissions: - actions: read - contents: read - steps: - - name: Checkout Repo - uses: actions/checkout@v4 - - name: Set up JDK 17 - uses: actions/setup-java@v4 - with: - distribution: "oracle" - java-version: "17" - - name: Setup Gradle - uses: gradle/actions/setup-gradle@v3 - - name: Run test suites - run: ./gradlew test + unit-tests: + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + steps: + - name: Checkout Repo + uses: actions/checkout@v4 + + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + distribution: "oracle" + java-version: "17" + + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v3 + + - name: Run test suites + run: ./gradlew test + From 61cf5e68a2c4fdfa219815ff9511df03e8568004 Mon Sep 17 00:00:00 2001 From: Vihar Shah Date: Tue, 8 Oct 2024 23:57:57 +0530 Subject: [PATCH 4/4] resolving comments --- .github/workflows/codeql.yml | 14 +++++--------- .github/workflows/unit-tests.yml | 3 ++- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 4ac21e2..c680125 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -19,28 +19,24 @@ jobs: strategy: fail-fast: false matrix: - language: [ "java-kotlin" ] + language: [ "java", "kotlin" ] steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Initialize CodeQL - uses: github/codeql-action/init@v2 + uses: github/codeql-action/init@v3 with: languages: ${{ matrix.language }} queries: security-extended,security-and-quality # Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift). - # If this step fails, then you should remove it and run the build manually (see below) - name: Autobuild - uses: github/codeql-action/autobuild@v2 - # - run: | - # echo "Run, Build Application using script" - # ./location_of_script_within_repo/buildscript.sh + uses: github/codeql-action/autobuild@v3 - 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/unit-tests.yml b/.github/workflows/unit-tests.yml index d778f53..7f3d4a8 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -10,6 +10,7 @@ on: jobs: unit-tests: runs-on: ubuntu-latest + name: Run Unit-Tests permissions: actions: read contents: read @@ -27,5 +28,5 @@ jobs: uses: gradle/actions/setup-gradle@v3 - name: Run test suites - run: ./gradlew test + run: ./gradlew test --info