Skip to content

Commit

Permalink
Update AppImage building process (CentOS-PaaS-SIG#1695)
Browse files Browse the repository at this point in the history
  • Loading branch information
abraverm authored Mar 18, 2020
1 parent 071b12b commit 9768314
Show file tree
Hide file tree
Showing 7 changed files with 693 additions and 43 deletions.
64 changes: 57 additions & 7 deletions .github/workflows/packaging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ jobs:
- run: pip install --user rpmvenv
- run: rpmdev-setuptree
- run: python3 setup.py sdist -d "${HOME}/rpmbuild/SOURCES"
- run: |
- id: rpm
run: |
version="$(cat linchpin/version.py | awk -F "'" '{print $2}' | head -n1)"
echo "::set-output name=version::${version}"
mv "${HOME}/rpmbuild/SOURCES/linchpin-${version}.tar.gz" "${HOME}/rpmbuild/SOURCES/v${version}.tar.gz"
"${HOME}/.local/bin/rpmvenv" rpm/linchpin.json --core_version="${version}" --verbose --spec | tee "${HOME}/rpmbuild/SPECS/linchpin.spec"
sed -i -e "s#^Requires: .*#Requires: git, python3.6#g" \
Expand All @@ -45,13 +47,17 @@ jobs:
-e '/^%post/i unlink %{buildroot}/opt/linchpin/lib64 || true' \
-e '/^%post/i ln -s /opt/linchpin/lib %{buildroot}/opt/linchpin/lib64 || true' \
"${HOME}/rpmbuild/SPECS/linchpin.spec"
- run: |
- id: result
run: |
rpmbuild -ba "${HOME}/rpmbuild/SPECS/linchpin.spec"
mv ~/rpmbuild/RPMS/x86_64/*.x86_64.rpm linchpin.fc31.x86_64.rpm
rpm_path="$(readlink -f $HOME/rpmbuild/RPMS/x86_64/*.rpm)"
rpm_name="$(basename $rpm_path)"
mv $rpm_path ./
echo "::set-output name=name::${rpm_name}"
- uses: actions/upload-artifact@v1
with:
name: linchpin.fc31.x86_64.rpm
path: linchpin.fc31.x86_64.rpm
name: ${{steps.result.outputs.name}}
path: ${{steps.result.outputs.name}}
- name: Upload Release Asset
if: github.event_name == 'release'
id: upload-release-asset
Expand All @@ -60,6 +66,50 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: linchpin.fc31.x86_64.rpm
asset_name: linchpin.fc31.x86_64.rpm
asset_path: ${{steps.result.outputs.name}}
asset_name: ${{steps.result.outputs.name}}
asset_content_type: application/rpm
appimage:
name: Build AppImage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Cache Docker image
id: cache
uses: actions/cache@v1
with:
path: appimage
key: ${{ hashFiles('appimage/Dockerfile') }}
- name: Build Docker image
if: steps.cache.outputs['cache-hit'] != 'true'
run: |
docker build -t appimage-build appimage
docker save appimage-build > appimage/buildimage.tar
- name: Load Docker image
if: steps.cache.outputs['cache-hit'] == 'true'
run: |
docker load < appimage/buildimage.tar
- id: version
run: |
version="$(cat linchpin/version.py | awk -F "'" '{print $2}' | head -n1)"
echo "::set-output name=version::${version}"
- id: appimage
run: |
cd appimage
./pkg2appimage-with-docker appimage.yml 2>&1
- uses: actions/upload-artifact@v1
with:
name: Linchpin-${{ steps.version.outputs.version }}.glibc2.17-x86_64.AppImage
path: appimage/out/Linchpin-${{ steps.version.outputs.version }}.glibc2.17-x86_64.AppImage
- name: Upload Release Asset
if: github.event_name == 'release'
id: upload-release-asset
uses: actions/upload-release-asset@v1.0.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: Linchpin-${{ steps.version.outputs.version }}.glibc2.17-x86_64.AppImage
asset_name: Linchpin-${{ steps.version.outputs.version }}.glibc2.17-x86_64.AppImage
asset_content_type: application/appimage

35 changes: 0 additions & 35 deletions appimage.yml

This file was deleted.

24 changes: 24 additions & 0 deletions appimage/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Beware: only meant for use with pkg2appimage-with-docker

FROM ubuntu:xenial

MAINTAINER "TheAssassin <theassassin@users.noreply.github.com>"

ENV DEBIAN_FRONTEND=noninteractive \
DOCKER_BUILD=1

RUN sed -i 's/archive.ubuntu.com/ftp.fau.de/g' /etc/apt/sources.list ;\
echo "deb http://ppa.launchpad.net/deadsnakes/ppa/ubuntu xenial main" >> /etc/apt/sources.list ;\
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys F23C5A6CF475977595C89F51BA6932366A755776 ;\
apt-get update
RUN apt-get install -y python3.7 python3.7-dev python3.7-venv python3.7-distutils ;\
python3.7 -m ensurepip --default-pip ;\
python3.7 -m pip install --upgrade pip setuptools wheel virtualenv
RUN apt-get install -y apt-transport-https libcurl3-gnutls libarchive13 wget desktop-file-utils aria2 gnupg2 build-essential file libglib2.0-bin git sudo
RUN apt-get install -y pkg-config libvirt-dev
RUN apt-get install -y fuse || true
RUN install -m 0777 -d /workspace

RUN adduser --system --uid 1000 test

WORKDIR /workspace
34 changes: 34 additions & 0 deletions appimage/appimage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
app: Linchpin
binpatch: true
ingredients:
dist: xenial
sources:
- deb http://us.archive.ubuntu.com/ubuntu/ xenial main universe
- deb http://ppa.launchpad.net/deadsnakes/ppa/ubuntu xenial main
packages:
- python3.7
script:
- wget -nc -q -O linchpin.png https://linchpinjobs.com/img/linchpinjobs_logo.png
- virtualenv usr -p $(which python3.7) --always-copy
- ./usr/bin/pip3 install linchpin gitdb2==3.0.1 gitdb==0.6.4
- ./usr/bin/pip3 install linchpin[libvirt]
- rm -rf usr/lib/python3/dist-packages/
- ln -s ../python3.7/site-packages/ usr/lib/python3/dist-packages
- cat > usr/bin/linchpin-wrapper <<\EOF
- HERE="$(dirname "$(readlink -f "${0}")")"
- cd $OWD
- "${HERE}/bin/python3" "${HERE}/bin/linchpin" "$@"
- EOF
- cat > linchpin.desktop <<\EOF
- [Desktop Entry]
- Type=Application
- Name=Linchpin
- Comment=Provisioning
- Icon=linchpin
- Exec=bash linchpin-wrapper
- Terminal=true
- Categories=Application;Development;
- StartupWMClass=linchpin
- MimeType=text/x-python3;text/x-python3;
- EOF
- usr/bin/pip3 freeze | grep "linchpin" | cut -d "=" -f 3 >> ../VERSION
Loading

0 comments on commit 9768314

Please sign in to comment.