From 2b52d275bc257bea2cd5af2d5007ce9328275bbd Mon Sep 17 00:00:00 2001 From: Ryuu Mitsuki <117973493+mitsuki31@users.noreply.github.com> Date: Tue, 8 Aug 2023 13:41:33 +0700 Subject: [PATCH 01/14] Update the releases template * Added the `autolabeler` for auto labeling PRs * Update and change the description template --- .github/release-drafter.yml | 42 +++++++++++++++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-) diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml index 280c185b..d4f58a65 100644 --- a/.github/release-drafter.yml +++ b/.github/release-drafter.yml @@ -1,4 +1,4 @@ -name-template: 'Release v$RESOLVED_VERSION' +name-template: 'v$RESOLVED_VERSION' tag-template: 'v$RESOLVED_VERSION' # Categories filter categories: @@ -27,13 +27,35 @@ categories: - title: '⛔ Removed' labels: - 'remove' + - 'deprecated' # Dependencies Updates - title: '🧩 Dependencies' labels: - 'dependencies' + - 'deps' exclude-labels: - 'skip-changelog' +# Auto Labeler +autolabeler: + # Documentation + - label: 'documentation' + files: + - '*.md' + branch: + - '/docs\/.+/' + - '/updatedocs\/.+/' + # Bug Fixes + - label: 'bugfix' + branch: + - '/fix\/.+/' + - '/fixes\/.+/' + # Enhancements / New Features + - label: 'enhancement' + branch: + - '/feature\/.+/' + - '/features\/.+/' + change-template: '- $TITLE (#$NUMBER) - @$AUTHOR' change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks. version-resolver: @@ -52,5 +74,21 @@ template: | $CHANGES - For more details, see [full changelogs](https://github.com/mitsuki31/jmatrix/compare/$PREVIOUS_TAG...$NEXT_MINOR_VERSION) + For more details, see the [full changelogs][changelogs]. + + ## 🚧 Issues + + Report any issues or have any suggestions? [Create new issue][new-issue] and help us improve **JMatrix**. + + --- + + 🛡ī¸ [VirusTotal][virustotal] Scan Detections: + + - jmatrix-$RESOLVED_VERSION.jar + - jmatrix-$RESOLVED_VERSION_with_sources.jar + + + [changelogs]: https://github.com/mitsuki31/jmatrix/compare/$PREVIOUS_TAG...v$RESOLVED_VERSION + [new-issue]: https://github.com/mitsuki31/jmatrix/issues/new + [virustotal]: https://www.virustotal.com From 1cc79412ea87bd66cfb32fa010cd100ffd08d337 Mon Sep 17 00:00:00 2001 From: Ryuu Mitsuki <117973493+mitsuki31@users.noreply.github.com> Date: Tue, 8 Aug 2023 19:59:14 +0700 Subject: [PATCH 02/14] Minor changes on categories filter * Changed the label name: `deprecated` -> `deprecate` * Changed the title name for new features and enhancements --- .github/release-drafter.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml index d4f58a65..1b257cfa 100644 --- a/.github/release-drafter.yml +++ b/.github/release-drafter.yml @@ -1,9 +1,10 @@ name-template: 'v$RESOLVED_VERSION' tag-template: 'v$RESOLVED_VERSION' + # Categories filter categories: # New Features - - title: '🚀 New Features' + - title: '🚀 Features & Enhancements' labels: - 'feature' - 'enhancement' @@ -27,7 +28,7 @@ categories: - title: '⛔ Removed' labels: - 'remove' - - 'deprecated' + - 'deprecate' # Dependencies Updates - title: '🧩 Dependencies' labels: From 667e1bf7d14317ea45b90e8db7f285692e4251e5 Mon Sep 17 00:00:00 2001 From: Ryuu Mitsuki <117973493+mitsuki31@users.noreply.github.com> Date: Tue, 8 Aug 2023 20:31:44 +0700 Subject: [PATCH 03/14] Update the autolabeler This change updated the autolabeler to labeling PRs on the following conditions: - Some changes on Python code -- `lang:python` - Some changes on Java code -- `lang:java` --- .github/release-drafter.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml index 1b257cfa..57942867 100644 --- a/.github/release-drafter.yml +++ b/.github/release-drafter.yml @@ -57,6 +57,15 @@ autolabeler: - '/feature\/.+/' - '/features\/.+/' + # Changes on Java code + - label: 'lang:java' + files: + - '*.java' + # Changes on Python code + - label: 'lang:python' + files: + - '*.py' + change-template: '- $TITLE (#$NUMBER) - @$AUTHOR' change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks. version-resolver: From f0847b090a34c8ac8be357bdcf33935ddeda04d0 Mon Sep 17 00:00:00 2001 From: Ryuu Mitsuki <117973493+mitsuki31@users.noreply.github.com> Date: Tue, 8 Aug 2023 22:20:07 +0700 Subject: [PATCH 04/14] Configure the package ecosystem for Maven --- .github/dependabot.yml | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index ed1e4591..118df3c0 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -5,11 +5,11 @@ version: 2 updates: # Configuration for pip - package-ecosystem: "pip" - directory: "/" + directory: "/" # Search for "requirements.txt" on root directory schedule: interval: "daily" commit-message: - prefix: "pip updated" + prefix: "pip" include: "scope" labels: - "dependencies" @@ -18,11 +18,24 @@ updates: # Configuration for GitHub Actions - package-ecosystem: "github-actions" - directory: "/" + directory: "/" # Search for ".github/workflows" on root directory schedule: interval: "daily" commit-message: - prefix: "GitHub Actions updated" + prefix: "GH Actions" + include: "scope" + labels: + - "dependencies" + assignees: + - "mitsuki31" + + # Configuration for Maven + - package-ecosystem: "maven" + directory: "/" # Search for "pom.xml" on root directory + schedule: + interval: "weekly" + commit-message: + prefix: "Maven" include: "scope" labels: - "dependencies" From 818980cf9ab0e84d240f698f9c9daca4206a2391 Mon Sep 17 00:00:00 2001 From: Ryuu Mitsuki <117973493+mitsuki31@users.noreply.github.com> Date: Wed, 9 Aug 2023 14:00:46 +0700 Subject: [PATCH 05/14] Enhance the `codeql` workflow * Now the `codeql` will only checks if the following statements are true: - Changed files are inside `src` directory - Changed files are type of Java or Python files * Changed the `develop` -> `release` branch We should check the codes before get pushed to `release` branch then releasing the new version. Beside that, from now on the `develop` branch very rarely active, instead use the `master` branch for any PRs and future changes. --- .github/workflows/codeql.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 89a4bb15..1b148f10 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -13,18 +13,18 @@ name: "CodeQL" on: push: - branches: [ "master", "develop" ] + branches: [ "master", "release" ] + # Only run when the specific file(s) are changed paths: - - 'src/' - - '**/*.java' - - '**/*.py' + - 'src/**/*.java' # All Java source files + - 'src/**/*.py' # All Python files pull_request: # The branches below must be a subset of the branches above - branches: [ "master", "develop" ] + branches: [ "master", "release" ] + # Only run when the specific file(s) are changed paths: - - 'src/' - - '**/*.java' - - '**/*.py' + - 'src/**/*.java' # All Java source files + - 'src/**/*.py' # All Python files schedule: - cron: '30 7 * * 6' From 912097b600ecf97609370cfb33a3f0b04416da9b Mon Sep 17 00:00:00 2001 From: Ryuu Mitsuki <117973493+mitsuki31@users.noreply.github.com> Date: Wed, 9 Aug 2023 16:28:32 +0700 Subject: [PATCH 06/14] Several improvements to `pylint` workflow * Now `pylint` only uses Python v3.7 and the latest one to check the codes. * Now the workflow will create cache for installed dependencies * PyLint are now will performs on both Ubuntu and Windows platform --- .github/workflows/pylint.yml | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml index 7190bce9..8a97ec34 100644 --- a/.github/workflows/pylint.yml +++ b/.github/workflows/pylint.yml @@ -4,29 +4,38 @@ on: [push, pull_request] jobs: build: - runs-on: ubuntu-latest + name: ${{ matrix.os }} / ${{ matrix.python-version }} + runs-on: ${{ matrix.os }}-latest + strategy: matrix: - python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"] + os: [Ubuntu, Windows] # Run on Ubuntu and Windows + python-version: ["3.7", "3.x"] # Run on Py3.7 and the latest version + steps: # Checkout the repo - name: Checkout repository uses: actions/checkout@v3 - + # Setup Python - name: Set up Python ${{ matrix.python-version }} + id: setup-py uses: actions/setup-python@v3 with: python-version: ${{ matrix.python-version }} - - # Install the dependencies + architecture: x64 + cache: 'pip' + cache-dependency-path: '**/requirements.txt' + + # Update pip and install the PyLint - name: Install dependencies + if: ${{ steps.setup-py.outputs.cache-hit != true }} run: | echo "Updating 'pip'..." python -m pip install --upgrade pip echo "Installing 'pylint'..." pip install pylint - + # Analyze the Python code - name: Analyzing the code with pylint run: | From 9a0884b22a59b31cf6b5c9e641e064004bd5a1c8 Mon Sep 17 00:00:00 2001 From: Ryuu Mitsuki <117973493+mitsuki31@users.noreply.github.com> Date: Wed, 9 Aug 2023 16:44:06 +0700 Subject: [PATCH 07/14] Revamped `codeql` workflow and caching This change introduces several modifications to the `codeql` workflow: - The workflow has been reconfigured to exclude Python setup and analysis. - CodeQL analysis now covers both Ubuntu and Windows platforms to ensure code portability. - The cache step has been configured to store installed Maven dependencies, improving workflow efficiency. It's worth noting that the analysis of Python code has been moved to the PyLint workflow. Additionally, JMatrix's public APIs are primarily built in Java, emphasizing stability, portability, and security. This shift allows us to focus on enhancing the quality of the Java-based public APIs. --- .github/workflows/codeql.yml | 69 ++++++++++++++---------------------- 1 file changed, 26 insertions(+), 43 deletions(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 1b148f10..70e0a753 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -17,76 +17,52 @@ on: # Only run when the specific file(s) are changed paths: - 'src/**/*.java' # All Java source files - - 'src/**/*.py' # All Python files + pull_request: # The branches below must be a subset of the branches above branches: [ "master", "release" ] # Only run when the specific file(s) are changed paths: - 'src/**/*.java' # All Java source files - - 'src/**/*.py' # All Python files + schedule: - cron: '30 7 * * 6' jobs: analyze: - name: Analyze Code - runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }} + name: ${{ matrix.os }} / Analyze Code + runs-on: ${{ matrix.os }}-latest permissions: actions: read contents: read security-events: write + env: + language: java + java-dist: temurin + java-version: 11 + strategy: fail-fast: false matrix: - language: [ 'java', 'python' ] + os: [Ubuntu, Windows] # Run on Ubuntu and Windows steps: - name: Checkout Repository uses: actions/checkout@v3 # Setup the Java Virtual Machine - - name: Setup JVM - if: ${{ matrix.language == 'java' }} + - name: Setup JVM / ${{ matrix.os }} uses: actions/setup-java@v3 with: - distribution: temurin - java-version: '11' - - # Setup the Python - - name: Setup Python - if: ${{ matrix.language == 'python' }} - uses: actions/setup-python@v3 - with: - python-version: '3.7' - - # Install and setup Python dependencies - - name: Install Python Dependencies - if: ${{ matrix.language == 'python' }} - run: | - python -m pip install --upgrade pip - if [ -f requirements.txt ]; then - pip install -r requirements.txt; - fi - echo "CODEQL_PYTHON=$(which python)" >> $GITHUB_ENV + distribution: ${{ env.java-dist }} + java-version: ${{ env.java-version }} # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL + - name: Initialize CodeQL / ${{ matrix.os }} uses: github/codeql-action/init@v2 with: - languages: ${{ matrix.language }} - # Only run if CodeQL detecting Python - if: ${{ matrix.language == 'python' }} - setup-python-dependencies: false - - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. - - # 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 - + languages: ${{ env.language }} # Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java). # If this step fails, then you should remove it and run the build manually (see below) @@ -96,14 +72,21 @@ jobs: # ℹī¸ Command-line programs to run using the OS shell. # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun - # Now CodeQL will checking the code with Maven - # instead checking it separately. - - name: Build the Project with Maven + - name: Caching Dependencies / ${{ matrix.os }} + uses: actions/cache@v2 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + restore-keys: | + ${{ runner.os }}-maven- + + - name: Build Project / ${{ matrix.os }} run: | echo "Building the project..." mvn clean install + mvn test - - name: Perform CodeQL Analysis + - name: Perform CodeQL Analysis / ${{ matrix.os }} uses: github/codeql-action/analyze@v2 with: category: "/language:${{ matrix.language }}" From 2aff0a845c7f71204a47b4eabe395f05f43be09d Mon Sep 17 00:00:00 2001 From: Ryuu Mitsuki <117973493+mitsuki31@users.noreply.github.com> Date: Wed, 9 Aug 2023 18:12:01 +0700 Subject: [PATCH 08/14] Update the `virus-scan.yml` * Changed the workflow name * Added description about the workflow --- .github/workflows/virus-scan.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/virus-scan.yml b/.github/workflows/virus-scan.yml index 3483c5a0..c33bedad 100644 --- a/.github/workflows/virus-scan.yml +++ b/.github/workflows/virus-scan.yml @@ -1,4 +1,10 @@ -name: Scan Virus on Releases +# This workflow is triggered upon the publication of a release. +# It performs a virus scan on the released files using the VirusTotal API. +# Designed to enhance the security of the release process by performing +# virus scans on the released ".jar" files using the VirusTotal service. + + +name: VirusTotal Scan on: release: From ccaefc1df6c0bc519bc43fa64da03b24fc353018 Mon Sep 17 00:00:00 2001 From: Ryuu Mitsuki <117973493+mitsuki31@users.noreply.github.com> Date: Fri, 11 Aug 2023 21:42:02 +0700 Subject: [PATCH 09/14] Update cache restore keys and minor fix --- .github/workflows/codeql.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 70e0a753..6a21ccfc 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -78,6 +78,7 @@ jobs: path: ~/.m2/repository key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} restore-keys: | + ${{ runner.os }}-maven-${{ hashfiles('**/pom.xml') }} ${{ runner.os }}-maven- - name: Build Project / ${{ matrix.os }} @@ -89,4 +90,4 @@ jobs: - name: Perform CodeQL Analysis / ${{ matrix.os }} uses: github/codeql-action/analyze@v2 with: - category: "/language:${{ matrix.language }}" + category: "/language:${{ env.language }}" From 9774a1fd2763f0f3518bd01f09b7295e1d403e58 Mon Sep 17 00:00:00 2001 From: Ryuu Mitsuki <117973493+mitsuki31@users.noreply.github.com> Date: Fri, 11 Aug 2023 22:34:54 +0700 Subject: [PATCH 10/14] Add clear description for all workflows --- .github/dependabot.yml | 3 +++ .github/workflows/codeql.yml | 19 ++++++++++--------- .github/workflows/pylint.yml | 13 +++++++++++++ .github/workflows/release-drafter.yml | 16 +++++++++++++++- 4 files changed, 41 insertions(+), 10 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 118df3c0..0079c9ca 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,3 +1,6 @@ +# This workflow is designed to automate the update process for various package ecosystems, +# ensuring that dependencies are kept up-to-date with regular checks. +# # For more details about configuring Dependabot, see full documentations here: # https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 6a21ccfc..df0e71e3 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -1,14 +1,15 @@ -# For most projects, this workflow file will not need changing; you simply need -# to commit it to your repository. +# This workflow focuses on enhancing code security and identifying +# potential vulnerabilities in the Java codebase. The workflow is triggered +# by push events to the "master" and "release" branches, as well as by +# a weekly schedule. It targets Java source files located in the "src" directory. # -# You may wish to alter this file to override the set of languages analyzed, -# or to provide custom queries or build logic. -# -# ******** NOTE ******** -# We have attempted to detect the languages in your repository. Please check -# the `language` matrix defined below to confirm you have the correct set of -# supported CodeQL languages. +# This workflow is crucial for maintaining code security and quality by +# regularly analyzing the Java codebase for vulnerabilities and providing +# insights to address potential security issues. # +# The workflow runs on both Ubuntu and Windows platforms for comprehensive +# code portability checks. + name: "CodeQL" on: diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml index 8a97ec34..2bcd7521 100644 --- a/.github/workflows/pylint.yml +++ b/.github/workflows/pylint.yml @@ -1,3 +1,16 @@ +# This workflow focuses on ensuring the quality and consistency of Python code +# in the repository. It is triggered by both push and pull request events. +# The workflow runs on both Ubuntu and Windows platforms, covering Python +# versions 3.7 and 3.x (latest version). +# +# This workflow helps maintain code quality and adherence to coding standards +# by regularly analyzing the Python codebase and providing insights into +# potential issues or areas for improvement. +# +# NOTE: +# The Python code is analyzed using a custom configuration file (`.pylintrc`). +# The configuration file can be found on the root of this repository. + name: PyLint on: [push, pull_request] diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml index 5ddee858..a4ce1522 100644 --- a/.github/workflows/release-drafter.yml +++ b/.github/workflows/release-drafter.yml @@ -1,3 +1,17 @@ +# The "Release Drafter" workflow automates the process of drafting +# new releases by generating release notes based on pull requests +# and commits. This workflow is triggered when changes are pushed to +# the `master` branch and when pull requests are opened, reopened, +# or synchronized. +# +# This workflow streamlines the process of creating informative and organized +# release notes for each new version of the project. It ensures that +# the release notes accurately reflect the changes introduced by pull requests +# and commits, enhancing transparency and communication with users and contributors. +# +# For more details about Release Drafter, consider refer to link below. +# https://github.com/release-drafter/release-drafter + name: Release Drafter on: @@ -5,7 +19,7 @@ on: # branches to consider in the event; optional, defaults to all branches: - master - # - develop + # pull_request event is required only for autolabeler pull_request: # Only following types are handled by the action, but one can default to all as well From be91b08a027c8d21d7ec2cbaa09e9d11f0a299fb Mon Sep 17 00:00:00 2001 From: Ryuu Mitsuki <117973493+mitsuki31@users.noreply.github.com> Date: Sat, 12 Aug 2023 16:59:21 +0700 Subject: [PATCH 11/14] Add new workflow named `tests` This workflow runs on 3 conditions: - Push - Pull request (PR) - Manual This workflow designed for testing the project with the supported builder (`Maven` and `Make`) and and help to find issues in the project code more easier. --- .github/workflows/tests.yml | 118 ++++++++++++++++++++++++++++++++++++ 1 file changed, 118 insertions(+) create mode 100644 .github/workflows/tests.yml diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 00000000..324fb548 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,118 @@ +name: Project Tester + +on: + # Run on push, pull request, and manual trigger + push: + pull_request: + workflow_dispatch: + inputs: + debug: + description: 'Debug Mode' + required: false + type: boolean + +jobs: + # ::---:: Maven Test ::---:: # + maven-test: + name: Maven Test / ${{ matrix.os }} + runs-on: ${{ matrix.os }}-latest + + env: + java-ver: 11 + java-dist: temurin + DEBUG: ${{ inputs.debug }} + + strategy: + matrix: + os: [Ubuntu, Windows] + + steps: + # Checkout repository + - name: Checkout repository + uses: actions/checkout@v3 + + # Caching Maven deps + - name: Cache Maven dependencies + id: cache-maven + uses: actions/cache@v2 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + restore-keys: | + ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + ${{ runner.os }}-maven- + + # Setup Java + - name: Setup Java / ${{ matrix.os }} + uses: actions/setup-java@v3 + with: + java-version: ${{ env.java-ver }} + distribution: ${{ env.java-dist }} + + # Install deps + - name: Install dependencies + if: ${{ steps.cache-maven.outputs.cache-hit != true && env.DEBUG != true }} + run: mvn install -DskipTests + + - name: Install dependencies (Debug) + if: ${{ steps.cache-maven.outputs.cache-hit != true && env.DEBUG == true }} + run: mvn install -DskipTests -X + + # Test + - name: Test project + if: ${{ env.DEBUG != true }} + run: mvn test + + - name: Test project (Debug) + if: ${{ env.DEBUG == true }} + run: mvn test -X + + + # ::---:: Make Test ::---:: # + make-test: + name: Make Test + runs-on: ubuntu-latest + continue-on-error: true + + strategy: + matrix: + py-ver: ['3.7', '3.x'] + + env: + arch: x64 + DEPS_FILE: 'requirements.txt' + DEBUG: ${{ inputs.debug }} + + steps: + # Checkout + - name: Checkout repository + uses: actions/checkout@v3 + + # Setup Python + - name: Setup Python ${{ matrix.py-ver }} + id: setup-py + uses: actions/setup-python@v3 + with: + python-version: ${{ matrix.py-ver }} + architecture: ${{ env.arch }} + cache: 'pip' + cache-dependency-path: '**/${{ env.DEPS_FILE }}' + + # Install deps + - name: Install dependencies + if: ${{ steps.setup-py.outputs.cache-hit != true }} + run: | + if [ $DEBUG = 'true' ]; then + python -m pip install -r $DEPS_FILE --debug + else + python -m pip install -r $DEPS_FILE + fi + + # Test + - name: Test project + run: | + if [ $DEBUG = 'true' ]; then + make compile package VERBOSE=true + else + make compile package + fi From 315f56890c24ecd5221075d1e68e2a1e5a0c663b Mon Sep 17 00:00:00 2001 From: Ryuu Mitsuki <117973493+mitsuki31@users.noreply.github.com> Date: Fri, 18 Aug 2023 21:19:11 +0700 Subject: [PATCH 12/14] Improve the testing workflow * Now the workflow only runs when the specified files are changed (only push). * Introduced a debug option for the packaging step to aid in troubleshooting. * Addressed limitations in Make's testing capabilities by focusing on compiling, packaging, and generating docs. * The changes aim to enhance project testing, packaging, and documentation processes while allowing for debugging when needed. --- .github/workflows/tests.yml | 60 ++++++++++++++++++++++++++++++++++--- 1 file changed, 56 insertions(+), 4 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 324fb548..228cb7c7 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -3,7 +3,16 @@ name: Project Tester on: # Run on push, pull request, and manual trigger push: + # Only run when the specific files are changed + paths: + - 'src/**/*.java' # Java files + - 'src/**/*.py' # Python files + + # Unlike push, the workflow always runs on pull requests pull_request: + + # The workflow also can be triggered manually, and choose whether + # to run with or without debug mode workflow_dispatch: inputs: debug: @@ -58,6 +67,15 @@ jobs: if: ${{ steps.cache-maven.outputs.cache-hit != true && env.DEBUG == true }} run: mvn install -DskipTests -X + # Packaging with source files + - name: Package source + if: ${{ env.DEBUG != true }} + run: mvn package -P include-src + + - name: Package source (Debug) + if: ${{ env.DEBUG == true }} + run: mvn package -P include-src -X + # Test - name: Test project if: ${{ env.DEBUG != true }} @@ -108,11 +126,45 @@ jobs: python -m pip install -r $DEPS_FILE fi - # Test - - name: Test project + # Sadly, Make cannot tests the project thoroughly due to unavailability + # of necessary packages (e.g "org.junit"), so here it just tests + # the project on compiling, packaging, and generating docs. + + # Compile + - name: Compile the project run: | + [ -d target/classes ] && make clean + make compile VERBOSE=$DEBUG LINT=true + + # Package + - name: Packaging the project + run: | + make package VERBOSE=$DEBUG + + - name: Packaging the project (with source) + run: | + make package INCLUDE-SRC=true VERBOSE=$DEBUG + + # Build docs + - name: Build the docs + run: | + # Build docs + # For more information on debugging, we prefer to change it + # to "all" mode. if [ $DEBUG = 'true' ]; then - make compile package VERBOSE=true + make build-docs VERBOSE=all else - make compile package + make build-docs fi + + # Clean up + - name: Clean up the project + run: | + echo "Clean the compiled classes" + [ -d target ] && make clean + + echo "Clean the generated docs" + [ -d docs/jmatrix ] && make cleandocs + + echo "Clean the generated packages" + rm -f *.jar From d9ee513387a302d079cac61bd7b4e7466f552d2e Mon Sep 17 00:00:00 2001 From: Ryuu Mitsuki <117973493+mitsuki31@users.noreply.github.com> Date: Fri, 18 Aug 2023 21:23:47 +0700 Subject: [PATCH 13/14] Improve the CodeQL workflow --- .github/workflows/codeql.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index df0e71e3..504945a8 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -85,7 +85,7 @@ jobs: - name: Build Project / ${{ matrix.os }} run: | echo "Building the project..." - mvn clean install + mvn clean install -Dskiptests # Installing necessary packages without testing mvn test - name: Perform CodeQL Analysis / ${{ matrix.os }} From f286b32d2a470488333b0c9b2275f50403cf8cb9 Mon Sep 17 00:00:00 2001 From: Ryuu Mitsuki <117973493+mitsuki31@users.noreply.github.com> Date: Fri, 18 Aug 2023 21:58:49 +0700 Subject: [PATCH 14/14] Minor changes on `tests` workflow * Remove unnecessary code on Make Test. * Now the Maven Test will also clean up the project. --- .github/workflows/tests.yml | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 228cb7c7..57f29ca2 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -85,6 +85,10 @@ jobs: if: ${{ env.DEBUG == true }} run: mvn test -X + # Clean up + - name: Clean up the project + run: mvn clean + # ::---:: Make Test ::---:: # make-test: @@ -160,11 +164,4 @@ jobs: # Clean up - name: Clean up the project run: | - echo "Clean the compiled classes" - [ -d target ] && make clean - - echo "Clean the generated docs" - [ -d docs/jmatrix ] && make cleandocs - - echo "Clean the generated packages" - rm -f *.jar + [ -d target ] && echo "Clean the project" && make clean