Skip to content

Commit

Permalink
Project structure refactoring (#30)
Browse files Browse the repository at this point in the history
* run tests on multiple os

* refactor project structure

* ignore shellcheck SC2034

* fix shellcheck

* shellcheck follow files

* shellcheck follow files

* fix uninstall integration test

* fix unittests

* fix makefile

* fix test setup

* increase coverage

* exclude macos from unit tests

* rename dropboxignore.sh to cli.sh

* fix snap version

Co-authored-by: Panagiotis Simakis <panagiotis.simakis@pricehubble.com>
  • Loading branch information
sp1thas and sp1thas authored Dec 30, 2022
1 parent 639eb34 commit 9f4e8e0
Show file tree
Hide file tree
Showing 43 changed files with 1,163 additions and 1,029 deletions.
10 changes: 9 additions & 1 deletion .github/workflows/shellcheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,14 @@ name: Shellcheck
on:
push:
branches: [ master ]
paths:
- 'src/**'
- 'tests/**'
pull_request:
branches: [ master ]
paths:
- 'src/**'
- 'tests/**'

jobs:
shellcheck:
Expand All @@ -13,5 +19,7 @@ jobs:
- uses: actions/checkout@v2
- name: Run ShellCheck
uses: ludeeus/action-shellcheck@master
env:
SHELLCHECK_OPTS: -x
with:
ignore: docs icons libs snap venv .github
ignore_paths: docs icons libs snap venv .github
2 changes: 1 addition & 1 deletion .github/workflows/stats.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ jobs:
run: sudo apt update && sudo apt install curl jq git

- name: Create stats file
run: sh -c "$(curl -fsSL https://raw.githubusercontent.com/sp1thas/dropboxignore/master/utils/stats.sh)" '${{ secrets.GITHUB_TOKEN }}'
run: sh -c "$(curl -fsSL https://raw.githubusercontent.com/sp1thas/dropboxignore/master/src/utils/stats.sh)" '${{ secrets.GITHUB_TOKEN }}'
24 changes: 12 additions & 12 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ name: Testing
on:
push:
branches: [ master ]
paths-ignore:
- '**.md'
- '**/mkdocs.yml'
- '**/shellcheck.yml'
- '**/stats.yml'
paths:
- 'src/**'
- 'tests/**'
pull_request:
branches: [ master ]
paths:
- 'src/**'
- 'tests/**'

env:
HOMEBREW_NO_AUTO_UPDATE: 1
Expand All @@ -20,7 +21,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ ubuntu-20.04, ubuntu-22.04, macos-11, macos-12 ]
os: [ ubuntu-22.04 ]
steps:
- uses: actions/checkout@v3
- name: Install os dependencies
Expand All @@ -44,19 +45,18 @@ jobs:
run: make test
- name: Coverage report
run: |
kcov --include-path=bin/dropboxignore.sh /tmp/coverage bats tests/*.bats
kcov --include-path=src /tmp/coverage bats tests/*.bats
cp $(find /tmp/coverage -type f -name 'cobertura.xml') coverage.xml
- uses: codecov/codecov-action@v2
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true

integration:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-20.04, ubuntu-22.04, macos-11, macos-12 ]
os: [ ubuntu-22.04, macos-12 ]
steps:
- uses: actions/checkout@v3
- name: Install os dependencies
Expand All @@ -68,17 +68,17 @@ jobs:
fi
- name: Install using wget
run: |
sudo sh -c "$(curl -fsSL https://raw.githubusercontent.com/sp1thas/dropboxignore/master/utils/install.sh)"
sudo sh -c "$(curl -fsSL https://raw.githubusercontent.com/sp1thas/dropboxignore/master/src/utils/install.sh)"
dropboxignore version
sudo rm /usr/local/bin/dropboxignore
- name: Install using curl
run: |
sudo sh -c "$(curl -fsSL https://raw.githubusercontent.com/sp1thas/dropboxignore/master/utils/install.sh)"
sudo sh -c "$(curl -fsSL https://raw.githubusercontent.com/sp1thas/dropboxignore/master/src/utils/install.sh)"
dropboxignore version
sudo rm /usr/local/bin/dropboxignore
- name: Install from source
run: |
sudo make install
dropboxignore version
- name: Uninstall
run: make uninstall
run: sudo make uninstall
9 changes: 6 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,16 @@ test :

# install dropboxignore
install :
cp bin/dropboxignore.sh ${DESTDIR}/bin/dropboxignore
cp src/bin/cli.sh ${DESTDIR}/bin/dropboxignore
chmod +x ${DESTDIR}/bin/dropboxignore
dropboxignore version
mkdir -p ${DESTDIR}/lib/dropboxignore
cp -r src/lib/commands ${DESTDIR}/lib/dropboxignore/.
cp -r src/lib/modules ${DESTDIR}/lib/dropboxignore/.
echo "\e[32mdropboxignore has been installed!"

# uninstall dropboxignore
uninstall :
rm -rf "${DESTDIR}/bin/dropboxignore"
rm -rf "${DESTDIR}/bin/dropboxignore" "${DESTDIR}/lib/dropboxignore"
echo "\e[32mdropboxignore has been uninstalled."

# create snap
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ dropboxignore is installed by running one of the following commands in your term
| curl | <code>sudo sh -c "$(curl -fsSL https://rb.gy/12plgs)" c</code> |
| wget | <code>sudo sh -c "$(wget -qO- https://rb.gy/12plgs)" w</code> |

Worried about mysterious shorted urls like? Take a look at the installation script here: [`https://rb.gy/12plgs --> https://raw.githubusercontent.com/sp1thas/dropboxignore/master/utils/install.sh`](https://raw.githubusercontent.com/sp1thas/dropboxignore/master/utils/install.sh))
Worried about mysterious shorted urls like? Take a look at the installation script here: [`https://rb.gy/12plgs --> https://raw.githubusercontent.com/sp1thas/dropboxignore/master/src/utils/install.sh`](https://raw.githubusercontent.com/sp1thas/dropboxignore/master/utils/install.sh))
### Snap

[![Get it from the Snap Store](https://snapcraft.io/static/images/badges/en/snap-store-white.svg)](https://snapcraft.io/dropboxignore)
Expand Down
Loading

0 comments on commit 9f4e8e0

Please sign in to comment.