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
26 changes: 26 additions & 0 deletions .github/workflows/test_tar_alias_workflow_call.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: test_tar_alias

on:
workflow_dispatch:
inputs:
git-ref:
required: false
type: string
default: "main"
workflow_call:
inputs:
git-ref:
required: false
type: string
default: "main"

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ inputs.git-ref }}
- name: test
run: |
. ./tests/test_tar_alias.sh
4 changes: 4 additions & 0 deletions .github/workflows/tests_on_push_branches.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,7 @@ jobs:
uses: ./.github/workflows/test_update_bashrc.yaml
with:
git-ref: ${{ github.ref }}
test_tar_alias_workflow_call:
uses: ./.github/workflows/test_tar_alias_workflow_call.yaml
with:
git-ref: ${{ github.ref }}
2 changes: 2 additions & 0 deletions .github/workflows/tests_on_schedule.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,5 @@ jobs:
uses: ./.github/workflows/test_python_pyenv_alias_workflow_call.yaml
test_update_bashrc:
uses: ./.github/workflows/test_update_bashrc.yaml
test_tar_alias_workflow_call:
uses: ./.github/workflows/test_tar_alias_workflow_call.yaml
5 changes: 5 additions & 0 deletions myalias.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ alias mkd='mkdir'
alias psux='ps ux'
alias wh='which'

# tar
alias tarc='tar -cvzf'
alias tart='tar -tvzf'
alias tarx='tar -xvzf'

# git
alias ga='git add'
alias gb='git branch'
Expand Down
25 changes: 25 additions & 0 deletions tests/test_tar_alias.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash -l
shopt -s expand_aliases
set -e
# const
test_workspace="./test-tar_workspace"
test_direc="./test-directory"
test_file1="hoge.txt"
test_file2="fuga.txt"
# setup
source ./myalias.sh

rm -rf $test_workspace || echo "$test_workspace not found"
mkdir -p $test_workspace
pushd $test_workspace

mkd $test_direc
echo $test_file1 > $test_direc/$test_file1
echo $test_file2 > $test_direc/$test_file2

tarc $test_direc.tar.gz $test_direc
tart $test_direc.tar.gz
rm -r $test_direc
tarx $test_direc.tar.gz

popd