-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
89 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: | ||
- '**' | ||
release: | ||
types: [released, prereleased] | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Add permissions | ||
run: chmod +x test.sh && chmod +x AppToGrid.sh | ||
|
||
- name: Test | ||
run: test.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
#!/bin/bash | ||
|
||
################################## | ||
# arrange | ||
################################## | ||
echo "#!/bin/bash | ||
echo Hello world! | ||
" > TestApp.sh | ||
|
||
################################## | ||
# act | ||
################################## | ||
printf '%s\n' TestApp ./TestApp.sh y | ./AppToGrid.sh | ||
|
||
################################## | ||
# assert | ||
################################## | ||
## Check if executable exists | ||
if [ ! -f /usr/bin/TestApp.sh ]; then | ||
echo "Assert 1" >> test.log | ||
echo "Executable does not exist in /usr/bin/" >> test.log | ||
echo | ||
fi | ||
|
||
## Check if desktop file exists | ||
if [ ! -f /usr/share/applications/TestApp.desktop ]; then | ||
echo "Assert 2" >> test.log | ||
echo ".desktop file does not exist in /usr/share/applications/" >> test.log | ||
echo | ||
fi | ||
|
||
## .desktop file content | ||
DESKTOP="[Desktop Entry] | ||
Type=Application | ||
Terminal=false | ||
Exec='$pathToExe' | ||
Name=$appName | ||
Comment=$appName | ||
Keywords=$appName;" | ||
diff <(echo $DESKTOP) <(echo /usr/share/applications/TestApp.sh) | ||
if echo $? == 1 | ||
then | ||
echo "Assert 3" >> test.log | ||
echo ".desktop file content is different" >> test.log | ||
echo diff <(echo textio) <(echo text) >> test.log | ||
echo | ||
fi | ||
|
||
## Check executable permissions | ||
if [ ! $(ls -l /usr/bin/TestApp.sh | cut -c 10-10) == "x" ] | ||
then | ||
echo "Assert 4" >> test.log | ||
echo "Executable has no execution permissions" >> test.log | ||
echo | ||
fi | ||
|
||
## Fail test when logfile exists | ||
if [ -f test.log ]; then | ||
cat test.log | ||
exit 1 | ||
fi | ||
|
||
|
||
if [ ! $(ls -l ./test/text.txt | cut -c 10-10) == "x" ] | ||
then | ||
echo hello | ||
fi |