feat: add multiple test execution
This commit is contained in:
parent
937fa5f529
commit
4944b6ecc0
5 changed files with 71 additions and 31 deletions
|
@ -1,8 +1,8 @@
|
||||||
name: GitHub Actions
|
name: dev-push-check
|
||||||
run-name: ${{ github.actor }} is testing out GitHub Actions 🚀
|
run-name: ${{ github.actor }} pushed new code to {{ github.ref }} 💻
|
||||||
on: [push]
|
on: [push] #, pull_request]
|
||||||
jobs:
|
jobs:
|
||||||
lint-shellcheck:
|
lint_shellcheck:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: install shellcheck
|
- name: install shellcheck
|
||||||
|
@ -11,7 +11,7 @@ jobs:
|
||||||
uses: actions/checkout@main
|
uses: actions/checkout@main
|
||||||
- name: lint files against shellcheck
|
- name: lint files against shellcheck
|
||||||
run: make lint_shellcheck
|
run: make lint_shellcheck
|
||||||
lint-shfmt:
|
lint_shfmt:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: install shfmt
|
- name: install shfmt
|
||||||
|
@ -20,12 +20,15 @@ jobs:
|
||||||
uses: actions/checkout@main
|
uses: actions/checkout@main
|
||||||
- name: lint files against shfmt
|
- name: lint files against shfmt
|
||||||
run: make lint_shfmt
|
run: make lint_shfmt
|
||||||
test-setup-linux:
|
test_setup_linux:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
needs:
|
||||||
|
- lint_shfmt
|
||||||
|
- lint_shellcheck
|
||||||
steps:
|
steps:
|
||||||
- name: install soft
|
- name: install soft
|
||||||
run: sudo apt install -y tmux git
|
run: sudo apt install -y tmux git
|
||||||
- name: checkout repo
|
- name: checkout repo
|
||||||
uses: actions/checkout@main
|
uses: actions/checkout@main
|
||||||
- name: test setup
|
- name: dummy test setup
|
||||||
run: ./tests/linux_setup_plugin_and_run.sh
|
run: ./tests/run_all_linux_tests.sh
|
6
tests/linux/README.md
Normal file
6
tests/linux/README.md
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
# Linux tests
|
||||||
|
|
||||||
|
Those test is meant to run on linux
|
||||||
|
|
||||||
|
- ubuntu 20.04 LTS
|
||||||
|
- bash
|
|
@ -1,25 +1,15 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# this test is meant to run on linux
|
CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
#
|
|
||||||
# test target is:
|
# shellcheck disable=SC1091
|
||||||
# - ubuntu 20.04 LTS
|
source "${CURRENT_DIR}/../tmux_helpers.sh"
|
||||||
# - bash
|
|
||||||
|
|
||||||
# default value of status-left section from gruvbox theme
|
# default value of status-left section from gruvbox theme
|
||||||
readonly STATUS_LEFT_DEFAULT="#[bg=colour241,fg=colour248] #S #[bg=colour237,fg=colour241,nobold,noitalics,nounderscore]"
|
readonly STATUS_LEFT_DEFAULT="#[bg=colour241,fg=colour248] #S #[bg=colour237,fg=colour241,nobold,noitalics,nounderscore]"
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
if [[ "$(uname)" != "Linux" ]]; then
|
helper_tearup_linux_tmux
|
||||||
echo "NOT LINUX. Failed & exit."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
sudo apt update -y
|
|
||||||
sudo apt install -y tmux git
|
|
||||||
|
|
||||||
mkdir -p ~/.tmux/plugins/
|
|
||||||
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
|
|
||||||
|
|
||||||
cat <<EOF >~/.tmux.conf
|
cat <<EOF >~/.tmux.conf
|
||||||
# List of plugins
|
# List of plugins
|
||||||
|
@ -36,8 +26,7 @@ EOF
|
||||||
|
|
||||||
cat ~/.tmux.conf
|
cat ~/.tmux.conf
|
||||||
|
|
||||||
# manually install plugins
|
helper_install_tpm_plugins
|
||||||
bash -c "${HOME}/.tmux/plugins/tpm/scripts/install_plugins.sh install_plugins"
|
|
||||||
|
|
||||||
# start new detached session
|
# start new detached session
|
||||||
tmux new -d
|
tmux new -d
|
||||||
|
@ -45,14 +34,10 @@ EOF
|
||||||
# get status of something from theme
|
# get status of something from theme
|
||||||
_status_left_current=$(tmux show-option -gqv status-left)
|
_status_left_current=$(tmux show-option -gqv status-left)
|
||||||
if [[ "$STATUS_LEFT_DEFAULT" != "$_status_left_current" ]]; then
|
if [[ "$STATUS_LEFT_DEFAULT" != "$_status_left_current" ]]; then
|
||||||
echo "$STATUS_LEFT_DEFAULT"
|
helper_print_fail_and_exit "Status left did not match"
|
||||||
echo "$_status_left_current"
|
|
||||||
echo "FAILED"
|
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "SUCCESS"
|
helper_print_success_and_exit "Status left match"
|
||||||
exit 0
|
|
||||||
}
|
}
|
||||||
|
|
||||||
main "$@"
|
main "$@"
|
7
tests/run_all_linux_tests.sh
Executable file
7
tests/run_all_linux_tests.sh
Executable file
|
@ -0,0 +1,7 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
main() {
|
||||||
|
for test in $(compgen -A function | grep "^test_linux_"); do "$test"; done
|
||||||
|
}
|
||||||
|
|
||||||
|
main "$@"
|
39
tests/tmux_helpers.sh
Normal file
39
tests/tmux_helpers.sh
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
helper_teardown_tmux() {
|
||||||
|
rm -rf ~/.tmux.conf
|
||||||
|
rm -rf ~/.tmux/
|
||||||
|
tmux kill-server >/dev/null 2>&1
|
||||||
|
}
|
||||||
|
|
||||||
|
helper_tearup_linux_tmux() {
|
||||||
|
if [[ "$(uname)" != "Linux" ]]; then
|
||||||
|
echo "NOT LINUX. Failed & exit."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# install software
|
||||||
|
sudo apt update -y
|
||||||
|
sudo apt install -y tmux git
|
||||||
|
|
||||||
|
# download TPM
|
||||||
|
mkdir -p ~/.tmux/plugins/
|
||||||
|
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
|
||||||
|
}
|
||||||
|
|
||||||
|
helper_print_fail_and_exit() {
|
||||||
|
local _msg="${1:-}"
|
||||||
|
printf "FAIL. %s\n" "${_msg}"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
helper_print_success_and_exit() {
|
||||||
|
local _msg="${1:-}"
|
||||||
|
printf "SUCCESS. %s\n" "${_msg}"
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
|
||||||
|
# install TMP plugins with command
|
||||||
|
helper_install_tpm_plugins() {
|
||||||
|
bash -c "${HOME}/.tmux/plugins/tpm/scripts/install_plugins.sh install_plugins"
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue