diff --git a/.github/actions/test-package/action.yml b/.github/actions/test-package/action.yml new file mode 100644 index 000000000..574eddbb0 --- /dev/null +++ b/.github/actions/test-package/action.yml @@ -0,0 +1,49 @@ +name: "Test Package" +description: "Installs the built package and verifies the installed binaries can run" + +inputs: + like: + description: "Used only on linux distro type: debian, fedora, suse, arch" + required: false + default: "" + +runs: + using: "composite" + + steps: + - name: Test package + shell: bash + run: | + if [ "$RUNNER_OS" == "macOS" ]; then + dmg=$(ls build/deskflow-*.dmg | head -1) + echo "Y" | hdiutil attach "$dmg" -nobrowse -mountpoint /tmp/deskflow-dmg + /tmp/deskflow-dmg/Deskflow.app/Contents/MacOS/deskflow-core --version + hdiutil detach /tmp/deskflow-dmg + + elif [ "$RUNNER_OS" == "Windows" ]; then + 7z x build/deskflow-*-portable.7z -otmp/deskflow-pkg + exe=$(find tmp/deskflow-pkg -name "deskflow-core.exe" -type f | head -1) + exe_dir=$(dirname "$exe") + pkg_root=$(dirname "$exe_dir") + export PATH="$exe_dir:$pkg_root:$pkg_root/lib:$PATH" + "$exe" --version + + elif [ "$RUNNER_OS" == "Linux" ]; then + if [ "${{inputs.like}}" == "debian" ]; then + apt-get install -y ./build/deskflow-*.deb + elif [ "${{inputs.like}}" == "fedora" ]; then + dnf install -y build/deskflow-*.rpm + elif [ "${{inputs.like}}" == "suse" ]; then + zypper install -y --allow-unsigned-rpm build/deskflow-*.rpm + elif [ "${{inputs.like}}" == "arch" ]; then + pacman -U --noconfirm build/deskflow-*.pkg.tar.zst + else + echo "Unknown like: ${{inputs.like}}" + exit 1 + fi + deskflow-core --version + + else + echo "Unknown OS: $RUNNER_OS" + exit 1 + fi diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index c5d63e85f..1b0488c6f 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -298,6 +298,11 @@ jobs: with: job: ${{ matrix.target.name }} + - name: Test package + uses: ./.github/actions/test-package + with: + like: ${{ matrix.target.like }} + - name: Update Development Documentation if: matrix.target.like == 'arch' && github.ref == 'refs/heads/master' uses: JamesIves/github-pages-deploy-action@v4.7.3