Improve AppImage build (#6427)

Publish AboutThisBuild.txt for AppImage builds.
Make AppImage name consistent with Windows builds.
Port Windows build enhancements to AppImage build.
Cache AppImage tools in build workflow.
Fix AppImage publishing script.
Remove "WinVista" from build artifact name.
This commit is contained in:
Lawrence37 2022-02-13 11:41:55 -08:00 committed by GitHub
parent 9a1423db6d
commit b7c3b47ad7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 79 additions and 35 deletions

View File

@ -3,6 +3,8 @@ on:
push: push:
branches: branches:
- dev - dev
tags:
- '[0-9]+.*'
pull_request: pull_request:
branches: branches:
- dev - dev
@ -10,30 +12,45 @@ on:
jobs: jobs:
build: build:
runs-on: ubuntu-18.04 runs-on: ubuntu-18.04
strategy:
fail-fast: false
matrix:
build_type: [release]
steps: steps:
- name: Checkout source - name: Checkout source
uses: actions/checkout@v2 uses: actions/checkout@v2
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Install dependencies - name: Install dependencies
run: | run: |
echo "Running apt update." echo "Running apt update."
sudo apt update sudo apt update
echo "Installing dependencies with apt." echo "Installing dependencies with apt."
DEBIAN_FRONTEND=noninteractive sudo apt install -y cmake libgtk-3-dev libgtkmm-3.0-dev liblensfun-dev librsvg2-dev liblcms2-dev libfftw3-dev libiptcdata0-dev libtiff5-dev libcanberra-gtk3-dev liblensfun-bin DEBIAN_FRONTEND=noninteractive sudo apt install -y cmake libgtk-3-dev libgtkmm-3.0-dev liblensfun-dev librsvg2-dev liblcms2-dev libfftw3-dev libiptcdata0-dev libtiff5-dev libcanberra-gtk3-dev liblensfun-bin
- name: Configure build - name: Configure build
run: | run: |
echo "Getting branch name." export REF_NAME_FILTERED="$(echo '${{github.ref_name}}' | sed 's/[^A-z0-9_.-]//g')"
BRANCH="$(git branch --show-current)"
echo "Branch name is '$BRANCH'." echo "Setting cache suffix."
if [ '${{github.ref_type}}' == 'tag' ]; then
export CACHE_SUFFIX=""
else
export CACHE_SUFFIX="5-$REF_NAME_FILTERED"
fi
export CACHE_SUFFIX="$CACHE_SUFFIX-AppImage"
echo "Cache suffix is '$CACHE_SUFFIX'."
echo "Making build directory." echo "Making build directory."
mkdir build mkdir build
echo "Changing working directory to the build directory." echo "Changing working directory to the build directory."
cd build cd build
echo "Running CMake configure." echo "Running CMake configure."
cmake \ cmake \
-DCMAKE_BUILD_TYPE="release" \ -DCMAKE_BUILD_TYPE='${{matrix.build_type}}' \
-DCACHE_NAME_SUFFIX="5-$BRANCH-AppImage" \ -DCACHE_NAME_SUFFIX="$CACHE_SUFFIX" \
-DPROC_TARGET_NUMBER="1" \ -DPROC_TARGET_NUMBER="1" \
-DBUILD_BUNDLE="ON" \ -DBUILD_BUNDLE="ON" \
-DBUNDLE_BASE_INSTALL_DIR="/" \ -DBUNDLE_BASE_INSTALL_DIR="/" \
@ -45,6 +62,10 @@ jobs:
-DCMAKE_INSTALL_PREFIX=/usr \ -DCMAKE_INSTALL_PREFIX=/usr \
-DLENSFUNDBDIR="../share/lensfun/version_1" \ -DLENSFUNDBDIR="../share/lensfun/version_1" \
.. ..
echo "Recording filtered ref name."
echo "REF_NAME_FILTERED=$REF_NAME_FILTERED" >> $GITHUB_ENV
- name: Build RawTherapee - name: Build RawTherapee
working-directory: ./build working-directory: ./build
run: | run: |
@ -52,6 +73,7 @@ jobs:
make -j$(nproc) install DESTDIR=AppDir/usr/bin make -j$(nproc) install DESTDIR=AppDir/usr/bin
echo "Moving usr/bin/share to usr/share." echo "Moving usr/bin/share to usr/share."
mv AppDir/usr/bin/share AppDir/usr/ mv AppDir/usr/bin/share AppDir/usr/
- name: Include Lensfun - name: Include Lensfun
run: | run: |
echo "Updating Lensfun database." echo "Updating Lensfun database."
@ -60,7 +82,18 @@ jobs:
mkdir -p build/AppDir/usr/share/lensfun mkdir -p build/AppDir/usr/share/lensfun
echo "Copying Lensfun database to the build directory." echo "Copying Lensfun database to the build directory."
cp -R ~/.local/share/lensfun/updates/* build/AppDir/usr/share/lensfun/ cp -R ~/.local/share/lensfun/updates/* build/AppDir/usr/share/lensfun/
- name: Restore AppImage tools from cache
id: appimage-tools-cache
uses: actions/cache@v2
with:
key: appimage-tools
path: |
./build/linuxdeploy-x86_64.AppImage
./build/linuxdeploy-plugin-gtk.sh
- name: Download AppImage tools - name: Download AppImage tools
if: ${{steps.appimage-tools-cache.outputs.cache-hit != 'true'}}
working-directory: ./build working-directory: ./build
run: | run: |
echo "Downloading linuxdeploy." echo "Downloading linuxdeploy."
@ -69,52 +102,63 @@ jobs:
curl --location 'https://raw.githubusercontent.com/linuxdeploy/linuxdeploy-plugin-gtk/master/linuxdeploy-plugin-gtk.sh' > linuxdeploy-plugin-gtk.sh curl --location 'https://raw.githubusercontent.com/linuxdeploy/linuxdeploy-plugin-gtk/master/linuxdeploy-plugin-gtk.sh' > linuxdeploy-plugin-gtk.sh
echo "Setting execute bit on all AppImage tools." echo "Setting execute bit on all AppImage tools."
chmod u+x linuxdeploy-* chmod u+x linuxdeploy-*
- name: Package AppImage - name: Package AppImage
working-directory: ./build working-directory: ./build
run: | run: |
echo "Creating artifact name."
if [ '${{github.ref_type}}' == 'tag' ]; then
ARTIFACT_NAME="RawTherapee_${REF_NAME_FILTERED}_${{matrix.build_type}}"
else
echo "Getting RawTherapee version." echo "Getting RawTherapee version."
export VERSION="$(grep -m 1 '^Version: .*$' AboutThisBuild.txt | sed 's/^Version: \(.\+\)$/\1/')" export VERSION="$(grep -m 1 '^Version: .*$' 'AboutThisBuild.txt' | sed 's/^Version: \(.\+\)$/\1/')"
echo "Version is '$VERSION'." echo "Version is '$VERSION'."
echo "Generating AppImage file name."
FILTERED_VERSION="$(echo "$VERSION" | sed 's/[^A-z0-9_.-]//g')" FILTERED_VERSION="$(echo "$VERSION" | sed 's/[^A-z0-9_.-]//g')"
export OUTPUT="RawTherapee-$FILTERED_VERSION-x86_64.AppImage" ARTIFACT_NAME="RawTherapee_${REF_NAME_FILTERED}_${FILTERED_VERSION}_${{matrix.build_type}}"
fi
echo "Artifact name is '$ARTIFACT_NAME'."
echo "Generating AppImage file name."
export OUTPUT="$ARTIFACT_NAME.AppImage"
echo "AppImage file name will be '$OUTPUT'." echo "AppImage file name will be '$OUTPUT'."
echo "Packaging AppImage." echo "Packaging AppImage."
./linuxdeploy-x86_64.AppImage \ ./linuxdeploy-x86_64.AppImage \
--appimage-extract-and-run \ --appimage-extract-and-run \
--appdir AppDir \ --appdir AppDir \
--plugin gtk \ --plugin gtk \
--output appimage --output appimage
echo "Recording RawTherapee version."
echo "RT_VERSION=$VERSION" >> $GITHUB_ENV echo "Recording artifact name."
echo "Recording AppImage file name." echo "ARTIFACT_NAME=$ARTIFACT_NAME" >> $GITHUB_ENV
echo "APPIMAGE_NAME=$OUTPUT" >> $GITHUB_ENV
- name: Upload artifacts - name: Upload artifacts
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
with: with:
name: ${{env.APPIMAGE_NAME}} name: ${{env.ARTIFACT_NAME}}.AppImage
path: ${{github.workspace}}/build/${{env.APPIMAGE_NAME}} path: ${{github.workspace}}/build/${{env.ARTIFACT_NAME}}.AppImage
- name: Prepare for publishing - name: Prepare for publishing
if: ${{github.ref_type == 'tag' || github.ref_name == 'dev'}}
run: | run: |
echo "Setting dev AppImage file name." echo "Setting publish name."
APPIMAGE_DEV_NAME="RawTherapee-dev-x86_64.AppImage" PUBLISH_NAME="RawTherapee_${REF_NAME_FILTERED}_${{matrix.build_type}}"
echo "dev AppImage file name is '$APPIMAGE_DEV_NAME'." echo "Publish name is '$PUBLISH_NAME'."
echo "Renaming dev AppImage."
cp "build/$APPIMAGE_NAME" "$APPIMAGE_DEV_NAME" echo "Renaming AppImage."
echo "Recording dev AppImage file name." cp "build/$ARTIFACT_NAME.AppImage" "$PUBLISH_NAME.AppImage"
echo "APPIMAGE_DEV_NAME=$APPIMAGE_DEV_NAME" >> $GITHUB_ENV
echo "Setting dev AppImage version file name." echo "Creating version file."
APPIMAGE_DEV_VERSION_NAME="RawTherapee-dev-x86_64-version.txt" cp "build/AboutThisBuild.txt" "$PUBLISH_NAME-AboutThisBuild.txt"
echo "dev AppImage version file name is '$APPIMAGE_DEV_VERSION_NAME'."
echo "Creating dev AppImage version file." echo "Recording publish name."
echo "$RT_VERSION" > "$APPIMAGE_DEV_VERSION_NAME" echo "PUBLISH_NAME=$PUBLISH_NAME" >> $GITHUB_ENV
echo "Recording dev AppImage version file name."
echo "APPIMAGE_DEV_VERSION_NAME=$APPIMAGE_DEV_VERSION_NAME" >> $GITHUB_ENV
- name: Publish artifacts - name: Publish artifacts
uses: softprops/action-gh-release@v1 uses: softprops/action-gh-release@v1
if: ${{github.ref == 'refs/heads/dev'}} if: ${{github.ref_type == 'tag' || github.ref_name == 'dev'}}
with: with:
tag_name: nightly-github-actions tag_name: nightly-github-actions
files: | files: |
${{env.APPIMAGE_DEV_NAME}} ${{env.PUBLISH_NAME}}.AppImage
${{env.APPIMAGE_DEV_VERSION_NAME}} ${{env.PUBLISH_NAME}}-AboutThisBuild.txt

View File

@ -236,13 +236,13 @@ jobs:
- name: Prepare artifact name - name: Prepare artifact name
run: | run: |
if [ '${{github.ref_type}}' == 'tag' ]; then if [ '${{github.ref_type}}' == 'tag' ]; then
ARTIFACT_NAME="RawTherapee_${REF_NAME_FILTERED}_WinVista_64_${{matrix.build_type}}" ARTIFACT_NAME="RawTherapee_${REF_NAME_FILTERED}_win64_${{matrix.build_type}}"
else else
echo "Getting RawTherapee version." echo "Getting RawTherapee version."
export VERSION="$(grep -m 1 '^Version: .*$' './build/${{matrix.build_type}}/AboutThisBuild.txt' | sed 's/^Version: \(.\+\)$/\1/')" export VERSION="$(grep -m 1 '^Version: .*$' './build/${{matrix.build_type}}/AboutThisBuild.txt' | sed 's/^Version: \(.\+\)$/\1/')"
echo "Version is '$VERSION'." echo "Version is '$VERSION'."
FILTERED_VERSION="$(echo "$VERSION" | sed 's/[^A-z0-9_.-]//g')" FILTERED_VERSION="$(echo "$VERSION" | sed 's/[^A-z0-9_.-]//g')"
ARTIFACT_NAME="RawTherapee_${REF_NAME_FILTERED}_${FILTERED_VERSION}_WinVista_64_${{matrix.build_type}}" ARTIFACT_NAME="RawTherapee_${REF_NAME_FILTERED}_${FILTERED_VERSION}_win64_${{matrix.build_type}}"
fi fi
echo "Artifact name is '$ARTIFACT_NAME'." echo "Artifact name is '$ARTIFACT_NAME'."