From 161341b150e24860b1ac22a612a5f2ff4bd06549 Mon Sep 17 00:00:00 2001 From: pvshvp-oss Date: Thu, 14 Mar 2024 04:05:43 -0500 Subject: [PATCH] . --- .github/workflows/api_documentation.yml | 42 ++++-------- .github/workflows/code_test_coverage.yml | 33 +++------ .github/workflows/code_validation.yml | 86 +++++++++--------------- .github/workflows/rust_workflow.yml | 29 -------- .github/workflows/security_audit.yml | 24 +++---- 5 files changed, 63 insertions(+), 151 deletions(-) delete mode 100644 .github/workflows/rust_workflow.yml diff --git a/.github/workflows/api_documentation.yml b/.github/workflows/api_documentation.yml index cc2b955..3b6b609 100644 --- a/.github/workflows/api_documentation.yml +++ b/.github/workflows/api_documentation.yml @@ -1,3 +1,5 @@ +name: πŸ“œ API Documentation Workflow + on: push: paths: @@ -7,8 +9,6 @@ on: workflow_dispatch: # Run when manually triggered workflow_call: # Run when called by another workflow -name: πŸ“œ API Documentation Workflow - jobs: build_documentation_job: name: πŸ›  Build Documentation Job @@ -31,46 +31,32 @@ jobs: toolchain: gnu runs-on: ${{ matrix.cicd_runner }} steps: - - name: 🎟 Checkout Git Repository Step - id: repository_checkout_step - uses: actions/checkout@v4 - name: ↕️ Install Ubuntu Dependencies Step id: dependencies_install_step - if: ${{ matrix.cicd_runner == 'ubuntu-latest' }} + if: ${{ matrix.compilation_target == 'x86_64-unknown-linux-gnu' }} uses: awalsh128/cache-apt-pkgs-action@latest with: packages: libgtk-4-dev version: 1.0 - - name: 🧰 Install Rust Toolchain Step - id: toolchain_install_step - uses: dtolnay/rust-toolchain@master - with: - toolchain: nightly - targets: ${{ matrix.compilation_target }} - components: rustc, cargo - - name: πŸ”„ Install Cross-Compilation Tools Step - id: cross_install_step - if: ${{ matrix.cpu_architecture != 'x86_64' }} - uses: taiki-e/setup-cross-toolchain-action@v1 - with: - targets: ${{ matrix.compilation_target }} - - name: πŸ—‚ Setup Cache Step - id: cache_setup_step - uses: Swatinem/rust-cache@v2 - - name: πŸ“œ Cargo Doc Step - id: cargo_doc_step + - name: πŸ“œ Build Documentation Step + id: documentation_build_step + uses: pax-hub/rust-github-action@main env: RUSTDOCFLAGS: "--enable-index-page -Zunstable-options" - run: | - cargo doc --all-features --workspace --no-deps --document-private-items - - name: ⬆ Upload Docs Artifact Step + with: + subcommand: doc + arguments: '--all-features --workspace --no-deps --document-private-items' + rust_release_channel: nightly + use_cross: false + compilation_target: ${{ matrix.compilation_target }} + - name: ⬆ Upload Documentation Step id: documentation_upload_step uses: actions/upload-pages-artifact@v3 with: path: target/doc publish_documentation_job: name: ✈ Publish Documentation Job - if: github.ref == 'refs/heads/main' + if: github.ref == 'refs/heads/main' # Publish only while dealing with the main branch needs: build_documentation_job runs-on: ubuntu-latest permissions: diff --git a/.github/workflows/code_test_coverage.yml b/.github/workflows/code_test_coverage.yml index 6b5c233..f0f0ac9 100644 --- a/.github/workflows/code_test_coverage.yml +++ b/.github/workflows/code_test_coverage.yml @@ -1,3 +1,5 @@ +name: πŸ”Ž Code Test Coverage Workflow + on: push: paths: @@ -12,8 +14,6 @@ on: workflow_dispatch: # Run when manually triggered workflow_call: # Run when called by another workflow -name: πŸ”Ž Code Test Coverage Workflow - jobs: coverage_job: name: πŸ”Ž Code Test Coverage Job @@ -51,28 +51,17 @@ jobs: && !startsWith(github.event.head_commit.message, 'chore:') && !startsWith(github.event.head_commit.message, 'chore(') steps: - - name: 🎟 Checkout Git Repository Step - id: repository_checkout_step - uses: actions/checkout@v4 - - name: 🧰 Install Rust Toolchain Step - id: toolchain_install_step - uses: dtolnay/rust-toolchain@master - with: - toolchain: nightly - targets: ${{ matrix.compilation_target }} - components: rustc, cargo - - name: πŸ”„ Install Cross-Compilation Tools Step - id: cross_install_step - if: ${{ matrix.cpu_architecture != 'x86_64' }} - uses: taiki-e/setup-cross-toolchain-action@v1 - with: - targets: ${{ matrix.compilation_target }} - - name: πŸ—‚ Setup Cache Step - id: cache_setup_step - uses: Swatinem/rust-cache@v2 - name: πŸ”Ž Generate Code Coverage Step id: coverage_generation_step - run: cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info + uses: pax-hub/rust-github-action@main + env: + RUSTDOCFLAGS: "--enable-index-page -Zunstable-options" + with: + subcommand: llvm-cov + arguments: '--all-features --workspace --lcov --output-path lcov.info' + rust_release_channel: nightly + use_cross: false + compilation_target: ${{ matrix.compilation_target }} - name: πŸ“Š Upload coverage to Codecov Step id: coverage_upload_step uses: codecov/codecov-action@v3 diff --git a/.github/workflows/code_validation.yml b/.github/workflows/code_validation.yml index a713305..093cdeb 100644 --- a/.github/workflows/code_validation.yml +++ b/.github/workflows/code_validation.yml @@ -19,7 +19,7 @@ name: βœ” Validate Code Workflow jobs: code_validation_job: - name: ${{ matrix.job_name }} + name: ${{ matrix.step_name }} if: | !startsWith(github.event.head_commit.message, 'chore:') && !startsWith(github.event.head_commit.message, 'chore(') @@ -33,7 +33,7 @@ jobs: cpu_architecture: - x86_64 - aarch64 - task: + subcommand: - fmt - clippy - check @@ -50,79 +50,53 @@ jobs: cicd_runner: windows-latest - platform: apple cicd_runner: macos-latest - - command_base: cross + - use_cross: true - compilation_target: x86_64-unknown-linux-gnu cpu_architecture: x86_64 platform: linux toolchain: gnu - command_base: cargo + use_cross: false - compilation_target: x86_64-pc-windows-msvc cpu_architecture: x86_64 platform: windows toolchain: msvc - command_base: cargo + use_cross: false - compilation_target: x86_64-apple-darwin cpu_architecture: x86_64 platform: apple toolchain: darwin - command_base: cargo + use_cross: false - compilation_target: aarch64-unknown-linux-gnu cpu_architecture: aarch64 platform: linux toolchain: gnu - - task: fmt - job_name: πŸ“‘ Cargo Fmt Job - rust_toolchain_components: cargo, rustfmt - - task: clippy - job_name: πŸ“Ž Cargo Clippy Job - rust_toolchain_components: cargo, clippy - - task: check - job_name: βœ… Cargo Check Job - rust_toolchain_components: cargo, rustc, rust-std - - task: test - job_name: πŸ§ͺ Cargo Test Job - rust_toolchain_components: cargo, rustc, rust-std + - subcommand: fmt + step_name: πŸ“‘ Cargo Fmt Job + arguments: '--verbose -- --check' + - subcommand: clippy + step_name: πŸ“Ž Cargo Clippy Job + arguments: '--workspace -- -D warnings' + - subcommand: check + step_name: βœ… Cargo Check Job + arguments: '--workspace' + - subcommand: test + step_name: πŸ§ͺ Cargo Test Job + arguments: '--workspace' runs-on: ${{ matrix.cicd_runner }} steps: - - name: 🎟 Checkout Git Repository Step - id: repository_checkout_step - uses: actions/checkout@v4 - - name: 🧰 Install Rust Toolchain Step - id: toolchain_install_step - uses: dtolnay/rust-toolchain@master - with: - toolchain: nightly - targets: ${{ matrix.compilation_target }} - components: ${{ matrix.rust_toolchain_components }} - - name: πŸ”„ Install Cross-Compilation Tools Step - id: cross_install_step - if: ${{ matrix.command_base == 'cross' }} - uses: taiki-e/install-action@v2 - with: - tool: cross - - name: πŸ—‚ Setup Cache Step - id: cache_setup_step - uses: Swatinem/rust-cache@v2 - name: ↕️ Install Ubuntu Dependencies Step - id: ubuntu_dependencies_install_step - if: ${{ matrix.cicd_runner == 'ubuntu-latest' && matrix.command_base == 'cargo' }} + id: dependencies_install_step + if: ${{ matrix.compilation_target == 'x86_64-unknown-linux-gnu' }} uses: awalsh128/cache-apt-pkgs-action@latest with: - packages: build-essential libssl-dev libgtk-4-dev + packages: libgtk-4-dev version: 1.0 - - name: πŸ“‘ Fmt Step - id: fmt_step - if: ${{ matrix.task == 'fmt' }} - run: cargo fmt --verbose -- --check - - name: πŸ“Ž Clippy Step - id: clippy_step - if: ${{ matrix.task == 'clippy' }} - run: ${{ matrix.command_base }} clippy --workspace --target ${{ matrix.compilation_target }} -- -D warnings - - name: βœ… Check Step - id: check_step - if: ${{ matrix.task == 'check' }} - run: ${{ matrix.command_base }} check --workspace --target ${{ matrix.compilation_target }} - - name: πŸ§ͺ Test Step - id: cargo_test_step - if: ${{ matrix.task == 'test' }} - run: ${{ matrix.command_base }} test --workspace --target ${{ matrix.compilation_target }} + - name: ${{ matrix.step_name }} + id: task_step + uses: pax-hub/rust-github-action@main + with: + subcommand: ${{ matrix.subcommand }} + arguments: ${{ matrix.arguments }} + rust_release_channel: nightly + use_cross: ${{ matrix.use_cross }} + compilation_target: ${{ matrix.compilation_target }} diff --git a/.github/workflows/rust_workflow.yml b/.github/workflows/rust_workflow.yml deleted file mode 100644 index 2b912df..0000000 --- a/.github/workflows/rust_workflow.yml +++ /dev/null @@ -1,29 +0,0 @@ -name: Test1 - -on: - push: - branches: [ci/dev] - workflow_dispatch: # Run when manually triggered - workflow_call: # Run when called by another workflow - -jobs: - test1: - runs-on: windows-latest - steps: - # - name: test1 - # run: | - # sudo apt-get update && sudo apt-get --assume-yes install libssl-dev libgtk-4-dev - - name: test3 - uses: pax-hub/rust-github-action@main - with: - rust_release_channel: nightly - compilation_target: aarch64-unknown-linux-gnu - command: run - arguments: '--all-features --bin paxy-cli -- -vvv --debug --test' - use_cross: false - - name: test4 - run: | - echo "Hello World" - - - diff --git a/.github/workflows/security_audit.yml b/.github/workflows/security_audit.yml index bd67f3f..829ae61 100644 --- a/.github/workflows/security_audit.yml +++ b/.github/workflows/security_audit.yml @@ -1,3 +1,5 @@ +name: πŸ•΅οΈβ€β™‚οΈ Security Audit Workflow + on: push: paths: @@ -15,40 +17,30 @@ on: workflow_dispatch: # Run when manually triggered workflow_call: # Run when called by another workflow -name: πŸ•΅οΈβ€β™‚οΈ Security Audit Workflow - jobs: audit_job: name: πŸ•΅οΈβ€β™‚οΈ Security Audit Job + # Ignore commits that just change the style of the code or just make miscellaneous changes. if: | !startsWith(github.event.head_commit.message, 'style:') && !startsWith(github.event.head_commit.message, 'style(') && !startsWith(github.event.head_commit.message, 'chore:') && !startsWith(github.event.head_commit.message, 'chore(') strategy: - fail-fast: false + fail-fast: false # We want all permutations to run because we want to discover all security vulnerabilities matrix: platform: [linux, windows, apple] cpu_architecture: [x86_64] include: - platform: linux + cpu_architecture: x86_64 cicd_runner: ubuntu-latest - platform: windows + cpu_architecture: x86_64 cicd_runner: windows-latest - platform: apple - cicd_runner: macos-latest - - compilation_target: x86_64-unknown-linux-gnu - cpu_architecture: x86_64 - platform: linux - toolchain: gnu - - compilation_target: x86_64-pc-windows-msvc cpu_architecture: x86_64 - platform: windows - toolchain: msvc - - compilation_target: x86_64-apple-darwin - cpu_architecture: x86_64 - platform: apple - toolchain: darwin + cicd_runner: macos-latest permissions: contents: read issues: write @@ -57,7 +49,7 @@ jobs: - name: 🎟 Checkout Git Repository Step id: repository_checkout_step uses: actions/checkout@v4 - - name: 🐍 Setup Python Step + - name: πŸ’ΏπŸ Setup Python Step id: python_setup_step uses: actions/setup-python@v5 with: