Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update appdata #578

Merged
merged 1 commit into from
Oct 29, 2023
Merged

update appdata #578

merged 1 commit into from
Oct 29, 2023

Conversation

ThanosApostolou
Copy link
Contributor

Fixes issues #574 and #576

Flatpak relies on appstream data in order to show versions. @Abestanis would it be easy for you to update the src/res/com.ulduzsoft.Birdtray.appdata.xml file and add a release line before a github release in the future?

After an appdata.xml edit it would be wise to run the following command in order to ensure no mistakes (https://docs.flathub.org/docs/for-app-authors/appdata-guidelines/):

flatpak run org.freedesktop.appstream-glib validate com.ulduzsoft.Birdtray.appdata.xml

@Abestanis Abestanis self-assigned this Oct 26, 2023
@Abestanis
Copy link
Collaborator

@Abestanis would it be easy for you to update the src/res/com.ulduzsoft.Birdtray.appdata.xml file and add a release line before a github release in the future?

Ah, sorry, I forgot about the appdata and didn't realize the Flatpack depends on it. We should make sure that this does not happen in the future by adding some checks to our CI. Could you please include this changed main.yml CI
script in this merge request?

.github/workflows/main.yml
name: Build

on: [push, pull_request]

jobs:
  build:
    name: Build
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [windows-latest, ubuntu-latest]
        arch: [x86, x64]
        qt_version: [5.9.9, 5.15.2]
        include:
          - os: windows-latest
            arch: x86
            qt_compile_suite: win32_msvc2019
          - os: windows-latest
            arch: x64
            qt_compile_suite: win64_msvc2019_64
        exclude:
          # We only want to test for the latest version of Qt on Windows
          - os: windows-latest
            qt_version: 5.9.9
          # We only compile for the current architecture of the runner for Linux
          - os: ubuntu-latest
            arch: x86
    steps:
      - name: Checkout repository
        uses: actions/checkout@v3
      - name: Install Qt ${{ matrix.qt_version }}
        uses: jurplel/install-qt-action@v3
        with:
          version: ${{ matrix.qt_version }}
          arch: ${{ matrix.qt_compile_suite }}
          cache: true
          dir: ${{ runner.temp }}/Qt
      - name: Install additional dependencies
        shell: bash
        env:
          ARCH: ${{ matrix.arch }}
        run: |
          if [ "$RUNNER_OS" == "Linux" ]; then
            sudo apt-get update -qq;
            sudo apt install -qq libx11-dev libqt5svg5-dev libx11-xcb-dev desktop-file-utils appstream-util
          elif [ "$RUNNER_OS" == "Windows" ]; then
            if [ "$ARCH" == "x86" ]; then
              echo "CMAKE_PLATFORM_ARG=-A Win32" >> $GITHUB_ENV
              export archParam="--forcex86"
            else
              echo "CMAKE_PLATFORM_ARG=-A x64" >> $GITHUB_ENV
            fi
            choco install -y --force $archParam openssl.light --version=1.1.1
            echo "C:\\Program Files\\OpenSSL" >> $GITHUB_PATH
          else
            echo "$RUNNER_OS not supported"
            exit 1
          fi
      - name: Create build environment
        run: cmake -E make_directory ${{ runner.workspace }}/build
      - name: Configure CMake
        shell: bash
        working-directory: ${{ runner.workspace }}/build
        run: cmake $GITHUB_WORKSPACE $CMAKE_PLATFORM_ARG -DCMAKE_BUILD_TYPE=Release -DCOMPILER_WARNINGS_AS_ERRORS=ON -DBUILD_WITH_TESTS=ON -DDONT_EXECUTE_INSTALLER=ON
      - name: Register build problem matchers
        run: |
          echo "::add-matcher::.github/problem-matchers/linguist.json"
          echo "::add-matcher::.github/problem-matchers/compiler.json"
      - name: Build
        working-directory: ${{ runner.workspace }}/build
        run: cmake --build . --config Release --target birdtray
      - name: Remove build problem matchers
        run: |
          echo "::remove-matcher owner=linguist::"
          echo "::remove-matcher owner=linguist-old::"
          echo "::remove-matcher owner=compiler-gcc::"
          echo "::remove-matcher owner=compiler-msvc::"
      - name: Tests
        working-directory: ${{runner.workspace}}/build
        run: cmake --build . --config Release --target tests && cmake --build . --config Release --target run_tests
      - name: Validate desktop file and app metadata
        working-directory: ${{ github.workspace }}
        if: runner.os == 'Linux'
        shell: bash
        run: |
          output=$(desktop-file-validate src/res/com.ulduzsoft.Birdtray.desktop)
          if [ ! -z "$output" ]; then
            echo "$output";
            exit 1;
          fi
          appstream-util validate src/res/com.ulduzsoft.Birdtray.appdata.xml
      - name: Check if this is a deployment build
        id: check-deploy
        shell: bash
        run: |
          if [[ '${{ github.event.ref }}' =~ ^refs/tags/v[0-9]+\.[0-9]+\.[0-9]+$ && "$RUNNER_OS" == "Windows" ]]; then
            echo "is_deploy=true" >> $GITHUB_OUTPUT
            echo "Deployment build detected"
          else
            echo "Not a deployment build, skipping deploy steps"
          fi
      - name: Install installer dependencies
        if: steps.check-deploy.outputs.is_deploy == 'true'
        run: choco install -y nsis --version=3.6.1;
      - name: Create installer
        if: steps.check-deploy.outputs.is_deploy == 'true'
        working-directory: ${{ runner.workspace }}/build
        run: cmake --build . --config Release --target install
      - name: Find installer
        if: steps.check-deploy.outputs.is_deploy == 'true'
        id: find_installer_file
        shell: bash
        run: |
          installerFile=`find . -name "Birdtray-*.exe" -exec basename {} \;`
          echo "installer_file=$installerFile" >> $GITHUB_OUTPUT
          echo "Found installer: $installerFile"
          mkdir installer/cache
          mv installer/$installerFile installer/cache
      - name: Cache installer
        uses: actions/upload-artifact@v3
        if: steps.check-deploy.outputs.is_deploy == 'true'
        with:
          name: installer-${{ runner.os }}-${{ matrix.arch }}-${{ github.sha }}
          path: installer/cache/${{ steps.find_installer_file.outputs.installer_file }}

  release:
    name: Create Release
    needs: build
    if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v') && contains(github.ref, '.')
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v3
      - name: Check if this is a deployment build
        id: deploy_check
        shell: bash
        run: |
          if [[ '${{ github.event.ref }}' =~ ^refs/tags/(v[0-9]+\.[0-9]+\.[0-9]+)$ ]]; then
            echo "Creating release ${BASH_REMATCH[1]}..."
            echo "version=${BASH_REMATCH[1]}" >> $GITHUB_OUTPUT
          else
            echo "Tag does not match: ${{ github.event.ref }}"
            exit 1
          fi
      - name: Verify that the app metadata contains the release
        shell: bash
        run: |
          grep "version=\"${{ steps.deploy_check.outputs.version }}\"" src/res/com.ulduzsoft.Birdtray.appdata.xml -q || (echo "Version not found in src/res/com.ulduzsoft.Birdtray.appdata.xml"; exit 1)
      - name: Download installer (x86)
        uses: actions/download-artifact@v3
        with:
          name: installer-Windows-x86-${{ github.sha }}
          path: installer-x86
      - name: Download installer (x64)
        uses: actions/download-artifact@v3
        with:
          name: installer-Windows-x64-${{ github.sha }}
          path: installer-x64
      - name: Create Release
        uses: ncipollo/release-action@v1
        with:
          name: Release ${{ steps.deploy_check.outputs.version }}
          draft: true
          artifacts: installer*/Birdtray-*.exe
          artifactContentType: application/x-msdownload
          artifactErrorsFailBuild: true
          generateReleaseNotes: true

After an appdata.xml edit it would be wise to run the following command in order to ensure no mistakes

Right now the verification of the appdata fails:

src/res/com.ulduzsoft.Birdtray.appdata.xml: FAILED:
• attribute-invalid     : <screenshot> width too large [https://raw.githubusercontent.com/gyunaev/birdtray/master/screenshots/birdtray-settings.png] maximum is 1600px
• attribute-invalid     : <screenshot> height too large [https://raw.githubusercontent.com/gyunaev/birdtray/master/screenshots/birdtray-settings.png] maximum is 900px
• style-invalid         : <image> has vertical padding [https://raw.githubusercontent.com/gyunaev/birdtray/master/screenshots/birdtray-settings.png]
• style-invalid         : <image> has horizontal padding [https://raw.githubusercontent.com/gyunaev/birdtray/master/screenshots/birdtray-settings.png]
Validation of files failed

Looks like the screenshot needs to be adjusted, do you know what needs to be done there?

@Abestanis
Copy link
Collaborator

Actually, let's merge this since the Flatpack release depends on it. We can handle the problems with the image and the automated checking in another merge request. @gyunaev I hope it is ok for me to merge this, since it doesn't change the code or behaviour of anything.

@Abestanis Abestanis merged commit 62e17bc into gyunaev:master Oct 29, 2023
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants