Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
groups:
actions:
patterns:
- "*"
...
2 changes: 1 addition & 1 deletion .github/workflows/audit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
audit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@v7
- name: Run cargo-audit
uses: rustsec/audit-check@v2
with:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v6
- uses: actions/checkout@v7

- name: fmt
run: |
Expand Down Expand Up @@ -51,7 +51,7 @@ jobs:
output: wizo.exe

steps:
- uses: actions/checkout@v6
- uses: actions/checkout@v7
- name: Install Rust Toolchain
uses: dtolnay/rust-toolchain@stable
with:
Expand Down Expand Up @@ -91,7 +91,7 @@ jobs:
pull-requests: write
contents: read
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@v7
with:
fetch-depth: 0

Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/pre-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ jobs:
issues: write

steps:
- uses: googleapis/release-please-action@v4
- uses: googleapis/release-please-action@v5
id: release
with:
target-branch: staging
config-file: release-config.json
manifest-file: .release-manifest.json

- uses: actions/checkout@v6
- uses: actions/checkout@v7
if: ${{ steps.release.outputs.release_created }}
with:
fetch-depth: 0
Expand Down Expand Up @@ -63,7 +63,7 @@ jobs:
release: ${{ needs.release.outputs.tag_name }}-windows-x86_64.exe

steps:
- uses: actions/checkout@v6
- uses: actions/checkout@v7
- name: Install Rust Toolchain
uses: dtolnay/rust-toolchain@stable
with:
Expand Down Expand Up @@ -96,7 +96,7 @@ jobs:
retention-days: 5

- name: Download Artifacts
uses: actions/download-artifact@v4
uses: actions/download-artifact@v8
with:
name: ${{ matrix.platform.release }}
path: ./dist
Expand All @@ -115,7 +115,7 @@ jobs:
environment: release

steps:
- uses: actions/checkout@v6
- uses: actions/checkout@v7
with:
ref: ${{ needs.release.outputs.tag_name }}
- uses: dtolnay/rust-toolchain@stable
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ jobs:
issues: write

steps:
- uses: googleapis/release-please-action@v4
- uses: googleapis/release-please-action@v5
id: release
with:
target-branch: stable
config-file: release-config.json
manifest-file: .release-manifest.json

- uses: actions/checkout@v6
- uses: actions/checkout@v7
if: ${{ steps.release.outputs.release_created }}
with:
fetch-depth: 0
Expand Down Expand Up @@ -63,7 +63,7 @@ jobs:
release: ${{ needs.release.outputs.tag_name }}-windows-x86_64.exe

steps:
- uses: actions/checkout@v6
- uses: actions/checkout@v7
- name: Install Rust Toolchain
uses: dtolnay/rust-toolchain@stable
with:
Expand Down Expand Up @@ -96,7 +96,7 @@ jobs:
retention-days: 5

- name: Download Artifacts
uses: actions/download-artifact@v4
uses: actions/download-artifact@v8
with:
name: ${{ matrix.platform.release }}
path: ./dist
Expand All @@ -115,7 +115,7 @@ jobs:
environment: release

steps:
- uses: actions/checkout@v6
- uses: actions/checkout@v7
with:
ref: ${{ needs.release.outputs.tag_name }}
- uses: dtolnay/rust-toolchain@stable
Expand Down
3 changes: 3 additions & 0 deletions .release-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
".": "0.0.1-beta"
}
56 changes: 56 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ authors = ["lukas-sgx <lukas.soigneux@epitech.eu>"]
clap = { version = "4.6.6", features = ["derive"] }
colored = "3.1.1"
indicatif = "0.18.6"
rand = "0.10.2"

serde = { version = "1.0", features = ["derive"] }
serde_yaml = "0.9"
16 changes: 16 additions & 0 deletions release-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"packages": {
".": {
"release-type": "rust",
"prerelease": true,
"prerelease-type": "alpha",
"changelog-sections": [
{ "type": "feat", "section": "New APIs / Features" },
{ "type": "fix", "section": "Bug Fixes" },
{ "type": "feat!", "section": "Breaking Changes / Features" },
{ "type": "fix!", "section": "Breaking Changes / Bug Fixes" },
{ "type": "chore", "hidden": true }
]
}
}
}
37 changes: 0 additions & 37 deletions release.config.js

This file was deleted.

86 changes: 46 additions & 40 deletions src/commands/runner.rs
Original file line number Diff line number Diff line change
@@ -1,45 +1,51 @@
use std::{fs, io, path::Path};

use crate::{modules, status};

fn get_github_workflows() -> io::Result<Vec<String>> {
let path = Path::new(".github/workflows");

if !path.exists() {
return Ok(vec![]);
}

let entries = fs::read_dir(path)?;

let workflows = entries
.filter_map(|entry| {
let path = entry.ok()?.path();

if path.is_file() {
let ext = path.extension()?.to_str()?;
if ext == "yml" || ext == "yaml" {
return Some(path.display().to_string());
}
}
None
})
.collect();

Ok(workflows)
use indicatif::{MultiProgress, ProgressBar};

use crate::{commands::check::workflows, modules::parser::GitHubWorkflow, status};
use core::time;
use std::{
sync::{self, Arc},
thread,
};

// fn set_time_duration(msg: String) {}

fn launch_workflow(workflow: &Arc<GitHubWorkflow>, pb: &ProgressBar) {
let data = sync::Mutex::from(workflow);
let _res = data.try_lock();

thread::sleep(time::Duration::from_secs(rand::random_range(0..13)));
let msg = format!(
"Job `{}` done...",
workflow.name.as_deref().unwrap_or_default()
);
pb.finish_with_message(msg);
}

pub fn handle(dry_run: bool, _jobs: u32) {
let workflows = get_github_workflows();
let pb = status::new_progress("Parse all workflow files");

for workflow in workflows.unwrap_or_default() {
let workflow_item = modules::parser::workflow_file(&workflow);

println!("{:?}", workflow_item.unwrap().on);
}
pb.finish_and_clear();
if dry_run {
return;
if let Some(workflows) = workflows() {
if dry_run {
return;
}

let mb = MultiProgress::new();
let mut handles = vec![];

for workflow in workflows {
let workflow = Arc::new(workflow);
let name = format!(
"Waiting `{}` ...",
workflow.name.as_deref().unwrap_or_default()
);
let pb = status::new_progress_attach_multi(&mb, name);
let subthread = thread::spawn(move || {
launch_workflow(&workflow, &pb);
});

handles.push(subthread);
}

for handle in handles {
handle.join().unwrap();
}
}
println!("next part");
}
Loading