From 5a67104916e791319ffb2d03c58c6bc47555be27 Mon Sep 17 00:00:00 2001 From: Andy Alt Date: Sat, 10 Jul 2021 10:57:59 -0500 Subject: [PATCH] add GitHub actions workflow file (#2560) --- .github/workflows/test.yml | 43 +++++++++++++++++++++++++++++++++++ .travis.yml | 44 ------------------------------------ README.md | 10 ++++---- code/prep-dummy-soundcard.sh | 10 ++++---- code/worker.sh | 26 ++++++++++----------- 5 files changed, 67 insertions(+), 66 deletions(-) create mode 100644 .github/workflows/test.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..822e7aa7 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,43 @@ + +on: [push, pull_request] + +env: + DISPLAY: :99 + IS_PULLREQUEST: ${{ github.event_name == 'pull_request' }} + +jobs: + build: + runs-on: ubuntu-18.04 + steps: + - uses: actions/checkout@v2 + - name: Install dependencies + run: | + sudo apt-get -qq -y install imagemagick libasound2-dev pulseaudio-utils alsa-utils alsa-oss libjack0 desktop-file-utils xmlstarlet xterm xvfb icewm x11-utils x11-apps netpbm xdotool libgl1-mesa-dri libgl1-mesa-dev mesa-utils libosmesa6 libsdl1.2-dev libsdl2-2.0-0 fonts-wqy-microhei libfile-mimeinfo-perl # appstream # TODO: Cache me! + sudo bash code/prep-dummy-soundcard.sh + sudo gem install dupervisor -v 1.0.5 # To convert ini to yaml files + sudo npm install -g asar # to get pacakges.json from resources/app.asar for electron-builder applications + # npm install -g @alexlafroscia/yaml-merge # to merge yaml files + - name: Main test + run: | + mkdir $HOME/.icewm/ + echo "ShowTaskBar = 0" > $HOME/.icewm/preferences + echo "TaskBarAutoHide = 1" > $HOME/.icewm/preferences + echo "TaskBarShowWorkspaces = 0" > $HOME/.icewm/preferences + echo "TaskBarShowAllWindows = 0" > $HOME/.icewm/preferences + echo "TaskBarShowClock = 0" > $HOME/.icewm/preferences + echo "TaskBarShowMailboxStatus = 0" > $HOME/.icewm/preferences + echo "TaskBarShowCPUStatus = 0" > $HOME/.icewm/preferences + echo "TaskBarShowWindowListMenu = 0" > $HOME/.icewm/preferences + # xpra start :99 # Cannot get screenshots to work + Xvfb :99 -screen 0 800x600x24 >/dev/null 2>&1 & # Need to set bit depth, otherwise get some black screenshots + # until xset -q; do echo "Waiting for X server to start..."; sleep 1; done # We are not immediately using it anyway + # Find out which files in data/ have been changed in the last commit + #set -x # Debug #379 + FILES=$(git log -1 -p data/ | grep +++ | cut -d '/' -f 2-| sed -e 's|dev/null||g') + echo "$FILES" ; if [ -z "$FILES" ] ; then echo "Variable FILES is empty." && exit 1 ; fi + # Work on these files that have been changed in the last commit + # Check if $FILES is not empty + if [ -n "$FILES" ] ; then for FILE in $FILES ; do echo "$FILE" ; bash -e code/worker.sh $(readlink -f "$FILE") ; done ; fi + # xpra stop :99 + killall Xvfb + # bundle exec jekyll build # https://help.github.com/en/articles/viewing-jekyll-build-error-messages#configuring-a-third-party-service-to-display-jekyll-build-error-messages diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 72c65d77..00000000 --- a/.travis.yml +++ /dev/null @@ -1,44 +0,0 @@ -language: generic - -sudo: true # Otherwise there seems to be no fuse available -dist: bionic - -env: - global: - - DISPLAY=:99 - -script: - - sudo apt-get -qq -y install imagemagick libasound2-dev pulseaudio-utils alsa-utils alsa-oss libjack0 desktop-file-utils xmlstarlet xterm xvfb icewm x11-utils x11-apps netpbm xdotool libgl1-mesa-dri libgl1-mesa-dev mesa-utils libosmesa6 libsdl1.2-dev libsdl2-2.0-0 fonts-wqy-microhei libfile-mimeinfo-perl > /dev/null # appstream # TODO: Cache me! - - sudo bash code/prep-dummy-soundcard.sh - - gem install dupervisor -v 1.0.5 # To convert ini to yaml files - - npm install -g asar # to get pacakges.json from resources/app.asar for electron-builder applications - - # npm install -g @alexlafroscia/yaml-merge # to merge yaml files - - mkdir $HOME/.icewm/ - - echo "ShowTaskBar = 0" > $HOME/.icewm/preferences - - echo "TaskBarAutoHide = 1" > $HOME/.icewm/preferences - - echo "TaskBarShowWorkspaces = 0" > $HOME/.icewm/preferences - - echo "TaskBarShowAllWindows = 0" > $HOME/.icewm/preferences - - echo "TaskBarShowClock = 0" > $HOME/.icewm/preferences - - echo "TaskBarShowMailboxStatus = 0" > $HOME/.icewm/preferences - - echo "TaskBarShowCPUStatus = 0" > $HOME/.icewm/preferences - - echo "TaskBarShowWindowListMenu = 0" > $HOME/.icewm/preferences - - # xpra start :99 # Cannot get screenshots to work - - Xvfb :99 -screen 0 800x600x24 >/dev/null 2>&1 & # Need to set bit depth, otherwise get some black screenshots - - # until xset -q; do echo "Waiting for X server to start..."; sleep 1; done # We are not immediately using it anyway - - # Find out which files in data/ have been changed in the last commit - - #set -x # Debug #379 - - FILES=$(git log -1 -p data/ | grep +++ | cut -d '/' -f 2- | sed -e 's|dev/null||g') - - echo "$FILES" ; if [ x"$FILES" == x ] ; then echo "Variable FILES is empty." && exit 1 ; fi - - # Work on these files that have been changed in the last commit - - # Check if $FILES is not empty - - if [ x"$FILES" != x ] ; then for FILE in $FILES ; do echo "$FILE" ; bash -e code/worker.sh $(readlink -f "$FILE") ; done ; fi - -after_script: - - # xpra stop :99 - - killall Xvfb - # bundle exec jekyll build # https://help.github.com/en/articles/viewing-jekyll-build-error-messages#configuring-a-third-party-service-to-display-jekyll-build-error-messages - -branches: - only: - - gh-pages # test the gh-pages branch (it is not tested on Travis CI by default) - - /(.*)/ # test every other branch diff --git a/README.md b/README.md index e23cb788..80610092 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# AppImageHub [![Build Status](https://travis-ci.org/AppImage/appimage.github.io.svg?branch=master)](https://travis-ci.org/AppImage/appimage.github.io) +# AppImageHub [![Build Status](https://github.com/AppImage/appimage.github.io.svg/actions/workflows/test.yml/badge.svg)](https://github.com/AppImage/appimage.github.io/actions/workflows/test.yml) https://appimage.github.io/ @@ -24,13 +24,13 @@ Create a new file using ### **[this link](https://github.com/AppImage/AppImageHub/new/master/data)** -and send a Pull Request. +and send a Pull Request. **The file should contain one line with a link to the GitHub repository that hosts AppImages on its Releases page.** **Alternatively, a link to the AppImage. Nothing else.** -Then send a Pull Request to this repository. Travis CI will instantly perform an automated review of the AppImage, and in case it succeeds, you will see a __green__ result in your pull request. If you get a __red__ result, check the log of the Travis CI build, and fix it. +Then send a Pull Request to this repository. GitHub Actions will instantly perform an automated review of the AppImage, and in case it succeeds, you will see a __green__ result in your pull request. If you get a __red__ result, check the log of the GitHub Actions build, and fix it. ### Checklist for submitting your own AppImage @@ -38,7 +38,7 @@ As a format, AppImage is designed in a way that does not impose restrictions on * Must be downloadable from an URL. Our testing system fetches the AppImage using `wget`. Currently we cannot get AppImages from locations behind authentication and/or cookie-protected locations. For commercial applications we recommend to have a generally downloadable demo/trial version. Please contact us if you would like to add your commercial AppImage to the directory and it is not available for general download * Must run on the [oldest still-supported Ubuntu LTS release](https://www.ubuntu.com/info/release-end-of-life) (currently Ubuntu 18.04) without the installation of additional packages. Targeting the oldest still-supported LTS is to ensure that the AppImage will run not only on the very latest, but also on older target systems, such as enterprise distributions (not limited to Ubuntu) -* Must execute in our Travis CI based testing environment +* Must execute in our GitHub Actions based testing environment * Must pass [appdir-lint.sh](https://github.com/AppImage/AppImages/blob/master/appdir-lint.sh) * Must have a desktop file that passes `desktop-file-validate` * Must run without active Internet connection (and at least show some information) @@ -61,7 +61,7 @@ As a format, AppImage is designed in a way that does not impose restrictions on ## How to use -App stores and software centers can consume the metadata collected by this project. See [AppImage ecosystem](https://github.com/AppImage/AppImageKit/wiki/Ecosystem). +App stores and software centers can consume the metadata collected by this project. See [AppImage ecosystem](https://github.com/AppImage/AppImageKit/wiki/Ecosystem). ![peek 2017-11-26 11-28](https://user-images.githubusercontent.com/2480569/33243768-497bf74a-d2ba-11e7-8336-ae2018229e57.gif) diff --git a/code/prep-dummy-soundcard.sh b/code/prep-dummy-soundcard.sh index c9e55164..0cce4631 100644 --- a/code/prep-dummy-soundcard.sh +++ b/code/prep-dummy-soundcard.sh @@ -1,18 +1,18 @@ # https://github.com/travis-ci/travis-ci/issues/1754#issuecomment-497986438 # Mirrored from https://github.com/k3it/qsorder/blob/master/test/prep-dummy-soundcard.sh -cat << EOF > /home/travis/.asoundrc +cat << EOF > "$HOME"/.asoundrc pcm.dummy { type hw card 0 } - + ctl.dummy { type hw card 0 } EOF -chmod go+r /home/travis/.asoundrc +chmod go+r "$HOME"/.asoundrc cat << EOF >> /etc/modules.conf # OSS/Free portion - card #1 alias sound-slot-0 snd-card-0 @@ -22,6 +22,8 @@ alias sound-service-0-3 snd-pcm-oss alias sound-service-0-8 snd-seq-oss alias sound-service-0-12 snd-pcm-oss EOF -modprobe snd-dummy +# Commenting out this modprobe line for now. Otherwise the workflow fails that +# the module can't be found. +modprobe snd-dummy # ; modprobe snd-pcm-oss ; modprobe snd-mixer-oss ; modprobe snd-seq-oss mkdir -p tmp && chmod 777 tmp diff --git a/code/worker.sh b/code/worker.sh index 64719189..067eae58 100644 --- a/code/worker.sh +++ b/code/worker.sh @@ -3,8 +3,8 @@ URL=$(cat $1 | head -n 1) echo $URL -if [ x"$TRAVIS_PULL_REQUEST" == xfalse ] ; then - git checkout "$TRAVIS_BRANCH" +if [ "$IS_PULLREQUEST" = false ] ; then + git checkout "$GITHUB_REF" fi INPUTBASENAME=$(basename $1) @@ -92,7 +92,7 @@ if [ ! -f appdir-lint.sh ] ; then fi set -x - + # If we have a type 2 AppImage, then mount it using appimagetool (not using itself for security reasons) if [ x"$TYPE" == x2 ] ; then if [ ! -e appimagetool-x86_64.AppImage ] ; then @@ -120,7 +120,7 @@ if [ x"$TYPE" == x1 ] ; then sudo mount "$FILENAME" -o ro,loop /mnt APPDIR=/mnt echo $APPDIR - bash appdir-lint.sh "$APPDIR" + bash appdir-lint.sh "$APPDIR" # https://github.com/AppImage/AppImageSpec/blob/master/draft.md#updateinformation UPDATE_INFORMATION=$(dd if="${FILENAME}" bs=1 skip=33651 count=512 2>/dev/null) || echo "Could not get update information from the AppImage" # later # sudo umount -l /mnt @@ -259,7 +259,7 @@ if [ $(($NUMBER_OF_WINDOWS)) -lt 1 ] ; then fi # Works with Xvfb but cannot select window by ID -# sudo apt-get -y install scrot +# sudo apt-get -y install scrot # scrot -b 'screenshot_$wx$h.jpg' # -u gives "X Error of failed request: BadDrawable (invalid Pixmap or Window parameter)" # mv screenshot_* database/$INPUTBASENAME/ @@ -283,7 +283,7 @@ fi # Works with Xvfb # sudo apt-get -y install x11-apps netpbm xdotool # We do this in .travis.yml -# -display :99 needed here? +# -display :99 needed here? # xwd -id $(xdotool getactivewindow) -silent | xwdtopnm | pnmtojpeg > database/$INPUTBASENAME/screenshot.jpg && echo "Snap!" mkdir -p database/$INPUTBASENAME/ @@ -449,7 +449,7 @@ sudo chmod a+x appstreamcli-x86_64.AppImage echo "" >> apps/$INPUTBASENAME.md echo "icons:" >> apps/$INPUTBASENAME.md echo " - $INPUTBASENAME/icons/$ICONSIZE/$ICONBASENAME" >> apps/$INPUTBASENAME.md - fi + fi # Screenshot if [ -f database/$INPUTBASENAME/*appdata.xml ] ; then SCREENSHOT=$(cat database/$INPUTBASENAME/*appdata.xml | xmlstarlet sel -t -m "/component/screenshots/screenshot[1]/image" -v . || true) @@ -533,13 +533,13 @@ echo "===========================================" # If this a PR, then just check whether the files have generated # See https://github.com/AppImage/appimage.github.io/issues/476 for more information -if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then +if [ "$IS_PULLREQUEST" = true ]; then cat "apps/${INPUTBASENAME}.md" || exit 1 cat "database/${INPUTBASENAME}/"*.desktop || exit 1 # Asterisk must not be inside quotes, https://travis-ci.org/AppImage/appimage.github.io/builds/360847207#L782 ls -lh "database/${INPUTBASENAME}/screenshot.png" || exit 1 curl --upload-file "database/${INPUTBASENAME}/screenshot.png" https://transfer.sh/screenshot.png echo "" - echo "Since we are on a TRAVIS_PULL_REQUEST and the required files are there, we are assuming the test is OK" + echo "We will assume the test is OK (a pull request event was triggered and the required files exist)." exit 0 fi @@ -547,17 +547,17 @@ fi # https://gist.github.com/willprice/e07efd73fb7f13f917ea git pull # To prevent from: error: failed to push some refs to 'https://[secure]@github.com/AppImage/AppImageHub.git' -git config --global user.email "travis@travis-ci.org" -git config --global user.name "Travis CI" +#git config --global user.email "travis@travis-ci.org" +#git config --global user.name "Travis CI" set -x ( cd database/ ; git diff ; git add . ; git rm *.yaml || true ) # Recursively add everything in this directory ( cd apps/ ; git diff ; git add . || true ) # Recursively add everything in this directory git commit -F- < /dev/null 2>&1 +git remote add deploy https://${GITHUB_TOKEN}@github.com/$GITHUB_REPOSITORY.git > /dev/null 2>&1 # wrong logic? # if [ x"$TRAVIS_PULL_REQUEST" == x"false" ] ; then set -x git push --set-upstream deploy