Skip to content

Commit

Permalink
Revamp scripts, different caching system
Browse files Browse the repository at this point in the history
* Improve caching method, now using `sqlite3`
* No [id | title] in rofi results, only title
* Lint scripts using `shellcheck`
* Add github actions on push and pr
* Remove `argparse.sh` dep (and so `python`)
* Fix/improve `Makefile`
* General fixes
  • Loading branch information
Andrea Rossoni committed Jul 27, 2021
1 parent 5456fed commit a513707
Show file tree
Hide file tree
Showing 7 changed files with 836 additions and 595 deletions.
76 changes: 76 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
#
# LINT.YML
#
# This workflow will run:
#
# * `changes`
# * check what files have been changes
#
# * `lint`
# * install deps
# * make install
# * shellcheck scripts
# * simple run scripts
#

---
name: Lint CI

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
changes:
name: Check changes
runs-on: ubuntu-latest
outputs:
files: ${{ steps.filter.outputs.files }}
steps:
- name: Checkout project
uses: actions/checkout@v2

- name: Filter paths
uses: dorny/paths-filter@v2
id: filter
with:
filters: |
files:
- 'bin/**'
- 'Makefile'
lint:
name: Shell check
runs-on: ubuntu-latest
needs: [ changes ]
if: ${{ needs.changes.outputs.files == 'true' }}
steps:
- name: Checkout project
uses: actions/checkout@v2

- name: Install deps
run: |
sudo apt update
sudo apt install mpv rofi
python -m pip install youtube-dl
- name: Setup some envs
run: |
echo "HOME=$HOME" >> $GITHUB_ENV
echo "PATH=$PATH:$HOME/.local/bin" >> $GITHUB_ENV
- name: Shellcheck scripts
run: |
shellcheck -s bash bin/mpvctl
shellcheck -s bash bin/ytdl-mpv
- name: Make install
run: make

- name: Run mpvctl help
run: mpvctl --help

- name: Run ytdl-mpv help
run: ytdl-mpv --help
28 changes: 28 additions & 0 deletions .yamllint
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
ignore: |
/.tox/
/.venv/
/.github/

extends: default

rules:
braces:
max-spaces-inside: 1
level: error
brackets:
max-spaces-inside: 1
level: error
truthy:
allowed-values: ["yes", "no", "true", "false", "True", "False"]
level: error
# Disabled rules
document-start: disable
indentation: disable
line-length: disable
colons: disable
empty-lines: disable
comments: disable
comments-indentation: disable
trailing-spaces: disable
new-line-at-end-of-file: disable
13 changes: 9 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@

# Makefile
# --------
# To specify another prefix run
# $ PREFIX=/another/prefix make

PREFIX ?= ~/.local

install:
@echo "Copy bin into $(PREFIX)"
@install -Dm755 mpvctl $(PREFIX)/bin/mpvctl
@install -Dm755 ytdl-mpv $(PREFIX)/bin/ytdl-mpv
@echo "Install bin into $(PREFIX)"
@install -Dm755 bin/mpvctl $(PREFIX)/bin/mpvctl
@install -Dm755 bin/ytdl-mpv $(PREFIX)/bin/ytdl-mpv
uninstall:
@echo "Remove bin from $(PREFIX)"
@rm -i $(PREFIX)/bin/mpvctl
@rm -i ytdl-mpv $(PREFIX)/bin/ytdl-mpv
@rm -i $(PREFIX)/bin/ytdl-mpv

.PHONY: install uninstall
Loading

0 comments on commit a513707

Please sign in to comment.