mirror of
https://github.com/TECHNOFAB11/pay-respects.git
synced 2026-02-02 07:35:10 +01:00
ci: compile for macOS and Windows
This commit is contained in:
parent
409b8245e6
commit
508e61a451
3 changed files with 78 additions and 29 deletions
18
.github/workflows/build.yaml
vendored
18
.github/workflows/build.yaml
vendored
|
|
@ -7,26 +7,34 @@ on:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ${{ matrix.os }}
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: true
|
fail-fast: true
|
||||||
|
matrix:
|
||||||
|
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: build
|
- name: build
|
||||||
run: |
|
run: |
|
||||||
cargo build --release --all-features
|
cargo build --release --all-features
|
||||||
|
|
||||||
- name: Zipping files
|
- name: Zipping files (exe)
|
||||||
|
if: matrix.os == 'windows-latest'
|
||||||
run: |
|
run: |
|
||||||
7z a ./pay-respects-ubuntu-latest.zip ./target/release/pay-respects
|
7z a pay-respects-${{ matrix.os }}.zip ./target/release/pay-respects.exe
|
||||||
|
|
||||||
|
- name: Zipping files (unix)
|
||||||
|
if: matrix.os != 'windows-latest'
|
||||||
|
run: |
|
||||||
|
7z a pay-respects-${{ matrix.os }}.zip ./target/release/pay-respects
|
||||||
|
|
||||||
- name: Uploading to release
|
- name: Uploading to release
|
||||||
uses: ncipollo/release-action@v1
|
uses: ncipollo/release-action@v1
|
||||||
with:
|
with:
|
||||||
artifacts: pay-respects-ubuntu-latest.zip
|
artifacts: pay-respects-${{ matrix.os }}.zip
|
||||||
allowUpdates: true
|
allowUpdates: true
|
||||||
makeLatest: true
|
makeLatest: true
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,14 +19,14 @@ Please follow the instruction for your shell:
|
||||||
<summary>Bash / Zsh / Fish</summary>
|
<summary>Bash / Zsh / Fish</summary>
|
||||||
|
|
||||||
> Manual aliasing:
|
> Manual aliasing:
|
||||||
> ``` shell
|
> ```shell
|
||||||
> alias f="$(pay-respects bash)"
|
> alias f="$(pay-respects bash)"
|
||||||
> alias f="$(pay-respects zsh)"
|
> alias f="$(pay-respects zsh)"
|
||||||
> alias f="$(pay-respects fish)"
|
> alias f="$(pay-respects fish)"
|
||||||
> ```
|
> ```
|
||||||
|
|
||||||
> Auto aliasing (optional custom alias can be added after `--alias argument`):
|
> Auto aliasing (optional custom alias can be added after `--alias argument`):
|
||||||
> ``` shell
|
> ```shell
|
||||||
> eval "$(pay-respects bash --alias)"
|
> eval "$(pay-respects bash --alias)"
|
||||||
> eval "$(pay-respects zsh --alias)"
|
> eval "$(pay-respects zsh --alias)"
|
||||||
> pay-respects fish --alias | source
|
> pay-respects fish --alias | source
|
||||||
|
|
@ -61,6 +61,8 @@ Install from your package manager if available:
|
||||||
|
|
||||||
[](https://repology.org/project/pay-respects/versions)
|
[](https://repology.org/project/pay-respects/versions)
|
||||||
|
|
||||||
|
Compiled binaries can be found at [GitHub releases](https://github.com/iffse/pay-respects/releases).
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
<summary>Generic x86 Desktop Linux</summary>
|
<summary>Generic x86 Desktop Linux</summary>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
use std::io::stderr;
|
use std::io::stderr;
|
||||||
use std::os::fd::AsFd;
|
|
||||||
use std::process::{exit, Stdio};
|
use std::process::{exit, Stdio};
|
||||||
use std::time::{Duration, Instant};
|
use std::time::{Duration, Instant};
|
||||||
|
|
||||||
|
|
@ -224,17 +223,7 @@ pub fn confirm_suggestion(shell: &str, command: &str, highlighted: &str) -> Resu
|
||||||
command = expand_alias_multiline(shell, &command);
|
command = expand_alias_multiline(shell, &command);
|
||||||
|
|
||||||
let now = Instant::now();
|
let now = Instant::now();
|
||||||
let process = std::process::Command::new(p)
|
let process = run_suggestion_p(shell, p, &command);
|
||||||
.arg(shell)
|
|
||||||
.arg("-c")
|
|
||||||
.arg(&command)
|
|
||||||
// .stdout(Stdio::inherit())
|
|
||||||
.stdout(stderr().as_fd().try_clone_to_owned().unwrap())
|
|
||||||
.stderr(Stdio::inherit())
|
|
||||||
.spawn()
|
|
||||||
.expect("failed to execute process")
|
|
||||||
.wait()
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
if process.success() {
|
if process.success() {
|
||||||
let cd = shell_evaluated_commands(shell, &command);
|
let cd = shell_evaluated_commands(shell, &command);
|
||||||
|
|
@ -262,16 +251,7 @@ pub fn confirm_suggestion(shell: &str, command: &str, highlighted: &str) -> Resu
|
||||||
|
|
||||||
let command = expand_alias_multiline(shell, command);
|
let command = expand_alias_multiline(shell, command);
|
||||||
let now = Instant::now();
|
let now = Instant::now();
|
||||||
let process = std::process::Command::new(shell)
|
let process = run_suggestion(shell, &command);
|
||||||
.arg("-c")
|
|
||||||
.arg(&command)
|
|
||||||
// .stdout(Stdio::inherit())
|
|
||||||
.stdout(stderr().as_fd().try_clone_to_owned().unwrap())
|
|
||||||
.stderr(Stdio::inherit())
|
|
||||||
.spawn()
|
|
||||||
.expect("failed to execute process")
|
|
||||||
.wait()
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
if process.success() {
|
if process.success() {
|
||||||
let cd = shell_evaluated_commands(shell, &command);
|
let cd = shell_evaluated_commands(shell, &command);
|
||||||
|
|
@ -296,3 +276,62 @@ pub fn confirm_suggestion(shell: &str, command: &str, highlighted: &str) -> Resu
|
||||||
Err(error_msg.to_string())
|
Err(error_msg.to_string())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(not(target_os = "windows"))]
|
||||||
|
fn run_suggestion_p (shell: &str, p: &str, command: &str) -> std::process::ExitStatus {
|
||||||
|
use std::os::fd::AsFd;
|
||||||
|
std::process::Command::new(p)
|
||||||
|
.arg(shell)
|
||||||
|
.arg("-c")
|
||||||
|
.arg(command)
|
||||||
|
.stdout(stderr().as_fd().try_clone_to_owned().unwrap())
|
||||||
|
.stderr(Stdio::inherit())
|
||||||
|
.spawn()
|
||||||
|
.expect("failed to execute process")
|
||||||
|
.wait()
|
||||||
|
.unwrap()
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(not(target_os = "windows"))]
|
||||||
|
fn run_suggestion (shell: &str, command: &str) -> std::process::ExitStatus {
|
||||||
|
use std::os::fd::AsFd;
|
||||||
|
std::process::Command::new(shell)
|
||||||
|
.arg("-c")
|
||||||
|
.arg(command)
|
||||||
|
// .stdout(Stdio::inherit())
|
||||||
|
.stdout(stderr().as_fd().try_clone_to_owned().unwrap())
|
||||||
|
.stderr(Stdio::inherit())
|
||||||
|
.spawn()
|
||||||
|
.expect("failed to execute process")
|
||||||
|
.wait()
|
||||||
|
.unwrap()
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(target_os = "windows")]
|
||||||
|
fn run_suggestion_p (shell: &str, p: &str, command: &str) -> std::process::ExitStatus {
|
||||||
|
use std::os::windows::io::AsHandle;
|
||||||
|
std::process::Command::new(p)
|
||||||
|
.arg(shell)
|
||||||
|
.arg("-c")
|
||||||
|
.arg(command)
|
||||||
|
.stdout(stderr().as_handle().try_clone_to_owned().unwrap())
|
||||||
|
.stderr(Stdio::inherit())
|
||||||
|
.spawn()
|
||||||
|
.expect("failed to execute process")
|
||||||
|
.wait()
|
||||||
|
.unwrap()
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(target_os = "windows")]
|
||||||
|
fn run_suggestion (shell: &str, command: &str) -> std::process::ExitStatus {
|
||||||
|
use std::os::windows::io::AsHandle;
|
||||||
|
std::process::Command::new(shell)
|
||||||
|
.arg("-c")
|
||||||
|
.arg(command)
|
||||||
|
.stdout(stderr().as_handle().try_clone_to_owned().unwrap())
|
||||||
|
.stderr(Stdio::inherit())
|
||||||
|
.spawn()
|
||||||
|
.expect("failed to execute process")
|
||||||
|
.wait()
|
||||||
|
.unwrap()
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue