|
| 1 | +name: Installation |
| 2 | + |
| 3 | +on: [push, pull_request] |
| 4 | + |
| 5 | +jobs: |
| 6 | + deb: |
| 7 | + runs-on: ubuntu-latest |
| 8 | + if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository |
| 9 | + steps: |
| 10 | + - uses: actions/checkout@v3 |
| 11 | + - name: Install .deb |
| 12 | + run: | |
| 13 | + sudo apt update |
| 14 | +
|
| 15 | + # build dependencies |
| 16 | + sudo apt install gettext -y |
| 17 | +
|
| 18 | + sudo scripts/build-deb.sh |
| 19 | + find build |
| 20 | + sudo apt install -f ./dist/input-remapper-*.deb |
| 21 | + - name: DBus Hello |
| 22 | + run: | |
| 23 | + # Test if files have been placed at the correct places in ubuntus file system. |
| 24 | + # By sending the hello command, we tests the service file, binaries and module |
| 25 | +
|
| 26 | + # Make sure we aren't just importing the module from the cloned repo in the |
| 27 | + # cwd. Commands should import the installed package |
| 28 | + cd / |
| 29 | + [ ! -d "inputremapper" ] |
| 30 | +
|
| 31 | + # Need to use sudo, because sys.path is weird in the ci otherwise |
| 32 | + sudo input-remapper-control --command hello 2>&1 | grep 'Daemon answered with "hello"' |
| 33 | +
|
| 34 | + generic: |
| 35 | + runs-on: ubuntu-latest |
| 36 | + if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository |
| 37 | + steps: |
| 38 | + - uses: actions/checkout@v3 |
| 39 | + - name: Generic installation |
| 40 | + run: | |
| 41 | + sudo scripts/ci-install-deps.sh |
| 42 | +
|
| 43 | + # Check if the generic installation method works too. Also, using `--root /` |
| 44 | + # should not break the system somehow |
| 45 | + sudo python3 -m install --root / |
| 46 | +
|
| 47 | + sudo systemctl daemon-reload |
| 48 | + sudo systemctl restart input-remapper |
| 49 | + - name: DBus Hello |
| 50 | + run: | |
| 51 | + # Make sure we aren't just importing the module from the cloned repo in the |
| 52 | + # cwd. Commands should import the installed package |
| 53 | + cd / |
| 54 | + [ ! -d "inputremapper" ] |
| 55 | + sudo input-remapper-control --command hello 2>&1 | grep 'Daemon answered with "hello"' |
| 56 | + - name: uninstall |
| 57 | + run: | |
| 58 | + cd $GITHUB_WORKSPACE |
| 59 | +
|
| 60 | + printf y | sudo python3 -m install.uninstall |
| 61 | +
|
| 62 | + if pip show input-remapper; then |
| 63 | + echo "Expected input-remapper package to be uninstalled" |
| 64 | + exit 1 |
| 65 | + fi |
| 66 | +
|
| 67 | + if [ -f /usr/share/dbus-1/system.d/inputremapper.Control.conf ]; then |
| 68 | + echo "Expected input-remappers files to be removed" |
| 69 | + exit 1 |
| 70 | + fi |
| 71 | +
|
| 72 | + if pgrep -f input-remapper; then |
| 73 | + echo "Expected input-remapper processes to not be running" |
| 74 | + exit 1 |
| 75 | + fi |
| 76 | +
|
| 77 | + if systemctl list-unit-files input-remapper.service; then |
| 78 | + echo "Expected input-remapper service to be missing" |
| 79 | + exit 1 |
| 80 | + fi |
0 commit comments