Skip to content

Commit

Permalink
CI
Browse files Browse the repository at this point in the history
  • Loading branch information
pvshvp-oss committed Mar 9, 2024
1 parent 2adf8fe commit 63143a6
Show file tree
Hide file tree
Showing 11 changed files with 134 additions and 51 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
push:
branches: [ main ]

name: 📜 API Documentation
name: 📜 Document API

jobs:
build:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
pull_request:
branches: [main]

name: 🔎 Code Coverage
name: 🔎 Code Test Coverage

jobs:
grcov:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
on:
workflow_dispatch:
workflow_call:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch: # Run when manually triggered
workflow_call: # Run when called by another workflow

name: ✔ Validate
name: ✔ Validate Code

jobs:
fmt:
name: 📑 Rustfmt
name: 📑 Rustfmt Job
if: |
!startsWith(github.event.head_commit.message, 'ci:')
&& !startsWith(github.event.head_commit.message, 'ci(')
runs-on: ubuntu-latest
steps:
- name: 🎟 Checkout Git Repository
id: checkout_repository_step
uses: actions/checkout@v2
- name: 🧰 Install Rust Toolchain
id: install_toolchain_step
- name: 🎟 Checkout Git Repository Step
id: repository_checkout_step
uses: actions/checkout@v4
- name: 🧰 Install Rust Toolchain Step
id: toolchain_install_step
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
components: rustfmt
- name: 🗂 Set up cargo cache
id: setup_cache_step
uses: actions/cache@v3
- name: 🗂 Setup Cargo Cache Step
id: cache_setup_step
uses: actions/cache@v4
continue-on-error: false
with:
path: |
Expand All @@ -48,7 +48,7 @@ jobs:
args: --verbose -- --check

clippy:
name: 📎 Clippy
name: 📎 Clippy Job
if: |
!startsWith(github.event.head_commit.message, 'ci:')
&& !startsWith(github.event.head_commit.message, 'ci(')
Expand Down Expand Up @@ -79,20 +79,21 @@ jobs:
env:
IS_CROSS: ${{ matrix.target == 'aarch64-unknown-linux-gnu' }}
steps:
- name: 🎟 Checkout Git Repository
id: checkout_repository_step
uses: actions/checkout@v2
- name: 🎟 Checkout Git Repository Step
id: repository_checkout_step
uses: actions/checkout@v4
- name: 🧰 Install Rust Toolchain
id: install_toolchain_step
id: toolchain_install_step
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
components: clippy
- name: 🗂 Set up cargo cache
id: setup_cache_step
uses: actions/cache@v3
- name: 🗂 Setup Cargo Cache Step
id: cache_setup_step
uses: actions/cache@v4
continue-on-error: false
with:
path: |
~/.cargo/bin/
Expand All @@ -111,7 +112,7 @@ jobs:
args: --workspace --target ${{ matrix.target }} -- -D warnings

check:
name: ✅ Check
name: ✅ Check Job
if: |
!startsWith(github.event.head_commit.message, 'ci:')
&& !startsWith(github.event.head_commit.message, 'ci(')
Expand Down Expand Up @@ -143,19 +144,19 @@ jobs:
env:
IS_CROSS: ${{ matrix.target == 'aarch64-unknown-linux-gnu' }}
steps:
- name: 🎟 Checkout Git Repository
id: checkout_repository_step
uses: actions/checkout@v2
- name: 🧰 Install Rust Toolchain
id: install_toolchain_step
- name: 🎟 Checkout Git Repository Step
id: repository_checkout_step
uses: actions/checkout@v4
- name: 🧰 Install Rust Toolchain Step
id: toolchain_install_step
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
target: ${{ matrix.target }}
- name: 🗂 Set up cargo cache
id: setup_cache_step
- name: 🗂 Setup Cargo Cache Step
id: cache_setup_step
uses: actions/cache@v3
with:
path: |
Expand All @@ -166,7 +167,7 @@ jobs:
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-
- name: ✅ Cargo Check
- name: ✅ Cargo Check Step
id: cargo_check_step
uses: actions-rs/cargo@v1
with:
Expand Down Expand Up @@ -211,15 +212,15 @@ jobs:
id: checkout_repository_step
uses: actions/checkout@v2
- name: 🧰 Install Rust Toolchain
id: install_toolchain_step
id: toolchain_install_step
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
target: ${{ matrix.target }}
- name: 🗂 Set up cargo cache
id: setup_cache_step
- name: 🗂 Setup Cargo Cache Step
id: cache_setup_step
uses: actions/cache@v3
with:
path: |
Expand Down
35 changes: 35 additions & 0 deletions .github/workflows/package_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: 📦🏗 Build Package(s)

on:
workflow_dispatch: # Run when manually triggered
inputs:
branch:
description: 'The branch to act on'
default: 'main'
required: false
type: string
release_channel:
description: 'The release channel - Stable or Unstable'
default: 'stable'
required: false
type: choice
options:
- Stable
- Unstable
workflow_call: # Run when called by another workflow
inputs:
branch:
description: 'The branch to act on'
default: 'main'
required: false
type: string
release_channel:
description: 'The release channel - Stable or Unstable'
default: 'stable'
required: false
type: choice
options:
- Stable
- Unstable

run-name: ${{ inputs.release_channel }} Package Build triggered by ${{ github.actor }} on branch ${{ inputs.branch }}
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
jobs:
validate:
name: ✔ Validate
uses: ./.github/workflows/validate.yml
uses: ./.github/workflows/code_validate.yml
build:
name: 🏗 Build
needs: validate
Expand Down
25 changes: 14 additions & 11 deletions .github/workflows/security_audit.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
on:
workflow_dispatch:
workflow_call:
push:
paths:
- '.github/workflows/security_audit.yml' # Run when this workflow changes
- '**/Cargo.toml' # Run when dependencies change
- '**/Cargo.lock' # Run when dependencies change
schedule:
- cron: '25 0 * * *'
- cron: '0 0 * * *' # Run periodically to capture recent developments
workflow_dispatch: # Run when manually triggered
workflow_call: # Run when called by another workflow

name: 🕵️‍♂️ Security Audit

jobs:
audit:
name: 🕵️‍♂️ Security Audit
name: 🕵️‍♂️ Security Audit Job
runs-on: ubuntu-latest
steps:
- name: 🎟 Checkout Git Repository
id: checkout_repository_step
uses: actions/checkout@v2
- name: 🕵️‍♂️ Security Audit
- name: 🎟 Checkout Git Repository Step
id: repository_checkout_step
uses: actions/checkout@v4
- name: 🕵️‍♂️ Security Audit Step
id: audit_step
uses: actions-rs/audit-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
uses: actions-rust-lang/audit@v1
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
[![GitHub top language](https://img.shields.io/github/languages/top/pax-hub/paxy)](https://www.rust-lang.org/)
[![Release](https://github.com/pax-hub/paxy/actions/workflows/release.yml/badge.svg)](https://github.com/pax-hub/paxy/actions/workflows/release.yml)
[![Pre-Release (Git)](https://github.com/pax-hub/paxy/actions/workflows/pre_release.yml/badge.svg)](https://github.com/pax-hub/paxy/actions/workflows/pre_release.yml)
[![Validation](https://github.com/pax-hub/paxy/actions/workflows/validate.yml/badge.svg)](https://github.com/pax-hub/paxy/actions/workflows/validate.yml)
[![API Documentation](https://github.com/pax-hub/paxy/actions/workflows/docs.yml/badge.svg)](https://github.com/pax-hub/paxy/actions/workflows/docs.yml)
[![Validation](https://github.com/pax-hub/paxy/actions/workflows/code_validate.yml/badge.svg)](https://github.com/pax-hub/paxy/actions/workflows/code_validate.yml)
[![API Documentation](https://github.com/pax-hub/paxy/actions/workflows/api-documentation.yml/badge.svg)](https://github.com/pax-hub/paxy/actions/workflows/api-documentation.yml)
[![Security Audit](https://github.com/pax-hub/paxy/actions/workflows/security_audit.yml/badge.svg)](https://github.com/pax-hub/paxy/actions/workflows/security_audit.yml)
[![Coverage Status](https://coveralls.io/repos/github/pax-hub/paxy/badge.svg?branch=main)](https://coveralls.io/github/pax-hub/paxy?branch=main)

Expand Down
24 changes: 24 additions & 0 deletions paxy-cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,13 @@ mod cli_template {
display_order = 5
)]
Uninstall(UninstallActionArguments),

#[clap(
name = "downgrade",
about = "Downgrade a package.",
display_order = 5
)]
Downgrade(DowngradeActionArguments),
}

#[derive(Debug, Args)]
Expand Down Expand Up @@ -193,6 +200,23 @@ mod cli_template {
pub package_names: Vec<String>, // This should always be the last argument
}

#[derive(Debug, Args)]
pub struct DowngradeActionArguments {
#[clap(
long = "version",
alias = "ver",
help = "The version to downgrade to.",
display_order = 1
)]
pub version: Option<String>,

#[clap(
help = "Full name of the package to downgrade.",
display_order = usize::MAX - 1
)]
pub package_name: String, // This should always be the last argument
}

// region: IMPORTS

use std::path::PathBuf;
Expand Down
13 changes: 13 additions & 0 deletions paxy/src/actions/downgrade.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#[derive(Debug, Snafu)]
#[non_exhaustive]
pub enum Error {
#[non_exhaustive]
#[snafu(display(""))]
Dummy {},
}

// region: IMPORTS

use snafu::Snafu;

// endregion: IMPORTS
10 changes: 8 additions & 2 deletions paxy/src/actions/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,15 @@ pub enum Error {

#[non_exhaustive]
#[snafu(display("Could not update:\n {source}"))]
CouldNotUpdate { source: install::Error },
CouldNotUpdate { source: update::Error },

#[non_exhaustive]
#[snafu(display("Could not uninstall:\n {source}"))]
CouldNotUninstall { source: install::Error },
CouldNotUninstall { source: uninstall::Error },

#[non_exhaustive]
#[snafu(display("Could not downgrade:\n {source}"))]
CouldNotDowngrade { source: downgrade::Error },
}

// region: IMPORTS
Expand All @@ -35,6 +39,7 @@ pub mod list;
pub mod search;
pub mod uninstall;
pub mod update;
pub mod downgrade;

// endregion: MODULES

Expand All @@ -45,5 +50,6 @@ pub use list::*;
pub use search::*;
pub use uninstall::*;
pub use update::*;
pub use downgrade::*;

// endregion: RE-EXPORTS
3 changes: 2 additions & 1 deletion paxy/src/app/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ pub fn init_config() -> Result<(Config, Vec<PathBuf>), Error> {
),
];

let mut figment = Figment::new();
let mut figment = Figment::from(Config::default());

figment = candidate_config_filepath_stubs
.iter()
.fold(
Expand Down

0 comments on commit 63143a6

Please sign in to comment.