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

[GitHub Actions] Flatpak build tweaks #3494

Merged
merged 4 commits into from
Nov 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions .ci/flatpak/publish_to_flathub.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# - FH_TOKEN
# - FLAT_MANAGER_URL
# - FH_REPOSITORY
# - WZ_BUILD_LOG_URL

if [ -z "$WZ_FLATPAK_LOCAL_REPO_NAME" ]; then
echo "Missing WZ_FLATPAK_LOCAL_REPO_NAME environment variable"
Expand All @@ -21,6 +22,10 @@ if [ -z "$FH_REPOSITORY" ]; then
echo "Missing FH_REPOSITORY environment variable"
exit 1
fi
if [ -z "$WZ_BUILD_LOG_URL" ]; then
echo "Missing WZ_BUILD_LOG_URL environment variable"
exit 1
fi

echo "::group::flatpak build-update-repo"
flatpak build-update-repo --generate-static-deltas "${WZ_FLATPAK_LOCAL_REPO_NAME}"
Expand All @@ -31,23 +36,27 @@ if [ $exit_status -ne 0 ]; then
fi
echo "::endgroup::"

BUILD_ID="$(flat-manager-client --token "${FH_TOKEN}" create "${FLAT_MANAGER_URL}" ${FH_REPOSITORY})"
BUILD_ID="$(flat-manager-client --token "${FH_TOKEN}" create "${FLAT_MANAGER_URL}" ${FH_REPOSITORY} --build-log-url "${WZ_BUILD_LOG_URL}")"
if [ $? -ne 0 ]; then
echo "ERROR: flat-manager-client failed to create a build id"
exit 1
fi
BUILD_ID="$(echo -e "${BUILD_ID}" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')"
echo "Created build id: \"${BUILD_ID}\""

echo "::group::flat-manager-client push"
flat-manager-client --token "${FH_TOKEN}" push --commit --publish --wait "${BUILD_ID}" "${WZ_FLATPAK_LOCAL_REPO_NAME}"
exit_status=$?
if [ $exit_status -ne 0 ]; then
echo "ERROR: Pushing / publishing failed?"
fi
echo "::endgroup::"

echo "::group::flat-manager-client purge"
flat-manager-client --token "${FH_TOKEN}" purge "${BUILD_ID}"
if [ $? -ne 0 ]; then
echo "ERROR: Purging failed"
exit_status=1
fi
echo "::endgroup::"

exit ${exit_status}
17 changes: 17 additions & 0 deletions .github/workflows/CI_flatpak.yml
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,9 @@ jobs:
# SDK For target runtime
flatpak --system install -y --noninteractive flathub org.freedesktop.Sdk.Compat.${WZ_FLATPAK_TARGET_ARCH}//${WZ_FREEDESKTOP_RUNTIME_VERSION}
fi

# Builder (which includes flatpak-builder-lint)
flatpak install flathub -y --noninteractive org.flatpak.Builder
- name: Build Flatpak
id: build
env:
Expand All @@ -223,6 +226,18 @@ jobs:
. src/.ci/flatpak/build.sh
echo "WZ_FLATPAK_LOCAL_REPO_NAME=${WZ_FLATPAK_LOCAL_REPO_NAME}"
echo "WZ_FLATPAK_LOCAL_REPO_NAME=${WZ_FLATPAK_LOCAL_REPO_NAME}" >> $GITHUB_OUTPUT
- name: Lint Flatpak
if: success() && matrix.arch == 'x86_64'
env:
WZ_FLATPAK_LOCAL_REPO_NAME: ${{ steps.build.outputs.WZ_FLATPAK_LOCAL_REPO_NAME }}
run: |
# Start a dbus session within the container to allow flatpaks to run
# See: https://discussion.fedoraproject.org/t/cannot-run-flatpaks-in-a-fedora-container/73867/2
mkdir /run/dbus
dbus-send --system /org/freedesktop/DBus org.freedesktop.DBus || dbus-daemon --system --fork

flatpak run --command=flatpak-builder-lint org.flatpak.Builder --exceptions repo "${WZ_FLATPAK_LOCAL_REPO_NAME}"
echo "flatpak-builder-lint - OK"
###############################################################
# Upload the .flatpak and debugsymbols artifacts
- name: Upload Artifact
Expand Down Expand Up @@ -469,6 +484,7 @@ jobs:
FH_REPOSITORY: '${{ env.WZ_FLATPAK_BRANCH }}'
FH_STABLE_TOKEN: ${{ secrets.FLATHUB_TOKEN }}
FH_BETA_TOKEN: ${{ secrets.FLATHUB_BETA_TOKEN }}
WZ_BUILD_LOG_URL: '${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}'
shell: bash --noprofile --norc {0} # no pipefail
run: |
# choose which token to use, based on the WZ_FLATPAK_BRANCH
Expand Down Expand Up @@ -514,6 +530,7 @@ jobs:
FLAT_MANAGER_URL: 'https://hub.flathub.org/'
FH_REPOSITORY: beta
FH_TOKEN: ${{ secrets.FLATHUB_BETA_TOKEN }}
WZ_BUILD_LOG_URL: '${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}'
WZ_FLATPAK_LOCAL_REPO_NAME: ${{ steps.build-beta.outputs.WZ_FLATPAK_LOCAL_REPO_NAME }}
shell: bash --noprofile --norc {0} # no pipefail
run: |
Expand Down
Loading