Skip to content

Commit

Permalink
Simplify actions
Browse files Browse the repository at this point in the history
  • Loading branch information
sxyazi committed Oct 21, 2023
1 parent 472c802 commit 86f371c
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 45 deletions.
26 changes: 4 additions & 22 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,40 +21,22 @@ jobs:
target: aarch64-apple-darwin

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Bootstrap
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: ${{ matrix.target }}
- uses: actions/checkout@v3

- name: Cache Dependencies
uses: Swatinem/rust-cache@v2

- name: Build
run: cargo build --release --locked --target ${{ matrix.target }}

- name: Pack Artifacts [Linux]
if: matrix.os == 'ubuntu-latest'
env:
RELEASE_NAME: yazi-${{ matrix.target }}
run: |
mkdir $RELEASE_NAME
cp target/${{ matrix.target }}/release/yazi -t $RELEASE_NAME
cp -r config/completions -t $RELEASE_NAME
cp README.md LICENSE -t $RELEASE_NAME
zip -r $RELEASE_NAME.zip $RELEASE_NAME
- name: Pack Artifacts [macOS]
if: matrix.os == 'macos-latest'
- name: Pack Artifacts [Linux & macOS]
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest'
env:
RELEASE_NAME: yazi-${{ matrix.target }}
run: |
mkdir $RELEASE_NAME
cp target/${{ matrix.target }}/release/yazi $RELEASE_NAME
cp -R config/completions $RELEASE_NAME
cp -r config/completions $RELEASE_NAME
cp README.md LICENSE $RELEASE_NAME
zip -r $RELEASE_NAME.zip $RELEASE_NAME
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/rust.yml → .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Rust
name: Test

on:
push:
Expand All @@ -19,7 +19,12 @@ jobs:

steps:
- uses: actions/checkout@v3

- name: Cache Dependencies
uses: Swatinem/rust-cache@v2

- name: Build
run: cargo build --verbose

- name: Run tests
run: cargo test --verbose
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
target/
config/completions

.DS_Store

result
result-*
.devenv*
8 changes: 4 additions & 4 deletions config/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ toml = { version = "^0", features = [ "preserve_order" ] }
validator = { version = "^0", features = [ "derive" ] }

[build-dependencies]
clap = { version = "^4", features = [ "derive" ] }
clap_complete = "^4"
clap_complete_nushell = "^4"
clap_complete_fig = "^4"
clap = { version = "^4", features = [ "derive" ] }
clap_complete = "^4"
clap_complete_nushell = "^4"
clap_complete_fig = "^4"
29 changes: 12 additions & 17 deletions config/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,21 @@ mod cli;
use std::{fs, io};

use clap::CommandFactory;
use clap_complete::{generate_to, Shell::*};
use clap_complete_fig::Fig;
use clap_complete_nushell::Nushell;

use self::cli::Args;
use clap_complete::{generate_to, Shell};

fn main() -> io::Result<()> {
let cmd = &mut Args::command();
let name = "yazi";
let dir = "completions";

fs::create_dir_all(dir)?;
let cmd = &mut cli::Args::command();
let bin = "yazi";
let out = "completions";

generate_to(Bash, cmd, name, dir)?;
generate_to(Fish, cmd, name, dir)?;
generate_to(Zsh, cmd, name, dir)?;
generate_to(Elvish, cmd, name, dir)?;
generate_to(PowerShell, cmd, name, dir)?;
generate_to(Nushell, cmd, name, dir)?;
generate_to(Fig, cmd, name, dir)?;
fs::create_dir_all(out)?;
generate_to(Shell::Bash, cmd, bin, out)?;
generate_to(Shell::Fish, cmd, bin, out)?;
generate_to(Shell::Zsh, cmd, bin, out)?;
generate_to(Shell::Elvish, cmd, bin, out)?;
generate_to(Shell::PowerShell, cmd, bin, out)?;
generate_to(clap_complete_nushell::Nushell, cmd, bin, out)?;
generate_to(clap_complete_fig::Fig, cmd, bin, out)?;

Ok(())
}
2 changes: 1 addition & 1 deletion cspell.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"version":"0.2","language":"en","flagWords":[],"words":["Punct","KEYMAP","splitn","crossterm","YAZI","unar","peekable","ratatui","syntect","pbpaste","pbcopy","ffmpegthumbnailer","oneshot","Posix","Lsar","XADDOS","zoxide","cands","Deque","precache","imageops","IFBLK","IFCHR","IFDIR","IFIFO","IFLNK","IFMT","IFSOCK","IRGRP","IROTH","IRUSR","ISGID","ISUID","ISVTX","IWGRP","IWOTH","IWUSR","IXGRP","IXOTH","IXUSR","libc","winsize","TIOCGWINSZ","xpixel","ypixel","ioerr","appender","Catppuccin","macchiato","gitmodules","Dotfiles","bashprofile","vimrc","flac","webp","exiftool","mediainfo","ripgrep","nvim","indexmap","indexmap","unwatch","canonicalize","serde","fsevent","Ueberzug","iterm","wezterm","sixel","chafa","ueberzugpp","️ Überzug","️ Überzug","Konsole","Alacritty","Überzug","pkgs","paru","unarchiver","pdftoppm","poppler","prebuild","singlefile","jpegopt","EXIF","rustfmt","mktemp","nanos","xclip","xsel","natord","Mintty","nixos","nixpkgs","SIGTSTP","SIGCONT","SIGCONT","mlua","nonstatic","userdata","metatable","natsort","backstack","luajit","Succ","Succ","cand","fileencoding","foldmethod","lightgreen","darkgray","lightred","lightyellow","lightcyan"]}
{"version":"0.2","language":"en","words":["Punct","KEYMAP","splitn","crossterm","YAZI","unar","peekable","ratatui","syntect","pbpaste","pbcopy","ffmpegthumbnailer","oneshot","Posix","Lsar","XADDOS","zoxide","cands","Deque","precache","imageops","IFBLK","IFCHR","IFDIR","IFIFO","IFLNK","IFMT","IFSOCK","IRGRP","IROTH","IRUSR","ISGID","ISUID","ISVTX","IWGRP","IWOTH","IWUSR","IXGRP","IXOTH","IXUSR","libc","winsize","TIOCGWINSZ","xpixel","ypixel","ioerr","appender","Catppuccin","macchiato","gitmodules","Dotfiles","bashprofile","vimrc","flac","webp","exiftool","mediainfo","ripgrep","nvim","indexmap","indexmap","unwatch","canonicalize","serde","fsevent","Ueberzug","iterm","wezterm","sixel","chafa","ueberzugpp","️ Überzug","️ Überzug","Konsole","Alacritty","Überzug","pkgs","paru","unarchiver","pdftoppm","poppler","prebuild","singlefile","jpegopt","EXIF","rustfmt","mktemp","nanos","xclip","xsel","natord","Mintty","nixos","nixpkgs","SIGTSTP","SIGCONT","SIGCONT","mlua","nonstatic","userdata","metatable","natsort","backstack","luajit","Succ","Succ","cand","fileencoding","foldmethod","lightgreen","darkgray","lightred","lightyellow","lightcyan","nushell"],"flagWords":[]}

0 comments on commit 86f371c

Please sign in to comment.