Merge pull request #170 from awesomeWM/gh-actions

chore: switch from travis to gh actions (fixes #169)
This commit is contained in:
Emmanuel Lepage Vallée 2022-06-26 13:11:59 -07:00 committed by GitHub
commit d595da7c18
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 172 additions and 117 deletions

164
.github/workflows/www.yml vendored Normal file
View File

@ -0,0 +1,164 @@
name: Update API docs
on:
# Trigger on push to branche `master`.
push:
branches: [ master ]
# Trigger on pull request events for PRs that have `master` as their target branch
pull_request:
branches: [ master ]
# Allow running the workflow manually
workflow_dispatch:
defaults:
run:
# GitHub Actions adds `errexit` and `pipefail` by default, but we add `xtrace`
# to improve debugging some of the longer scripts.
shell: /bin/bash -o errexit -o pipefail -o xtrace {0}
jobs:
main:
runs-on: ubuntu-20.04
steps:
# Create a cache invalidation key based on the current year + week.
# This way, packages will be checked for updates once every week.
- name: Get Date
id: get-date
run: echo "::set-output name=date::$(/bin/date -u "+%Y%W")"
- name: Cache apt packages
id: cache-apt
uses: actions/cache@v2
with:
path: /var/cache/apt/archives
# The trailing number serves as a version flag that can be incremented
# to invalidate the cache after changing the list of packages.
key: ${{ github.workflow }}-${{ runner.os }}-${{ steps.get-date.outputs.date }}-apt-3
- name: Download apt packages
if: steps.cache-apt.outputs.cache-hit != 'true'
run: |
sudo apt-get update
sudo apt-get install --download-only -y --no-install-recommends \
ikiwiki \
asciidoc \
imagemagick \
perlmagick \
luarocks \
cmake \
libxcb-cursor-dev \
libxcb-randr0-dev \
libxcb-xtest0-dev \
libxcb-xinerama0-dev \
libxcb-shape0-dev \
libxcb-util0-dev \
libxcb-keysyms1-dev \
libxcb-icccm4-dev \
libxcb-xrm-dev \
libxdg-basedir-dev \
libstartup-notification0-dev \
libxcb-xkb-dev \
libxkbcommon-dev \
libxkbcommon-x11-dev \
gir1.2-pango-1.0 \
xutils-dev \
libgirepository1.0-dev \
lua-discount
- name: Install downloaded packages
run: |
sudo dpkg -i /var/cache/apt/archives/*.deb
- name: Cache luarocks
id: cache-luarocks
uses: actions/cache@v2
with:
path: /tmp/luarocks
key: ${{ github.workflow }}-${{ runner.os }}-luarocks-3.5.0
- name: Install fresh Luarocks
if: steps.cache-luarocks.outputs.cache-hit != 'true'
run: |
wget -O /tmp/luarocks.tar.gz https://github.com/luarocks/luarocks/archive/v3.5.0.tar.gz
mkdir /tmp/luarocks
tar -xf /tmp/luarocks.tar.gz -C /tmp/luarocks --strip-components=1
cd /tmp/luarocks
./configure
make build
sudo make install
- name: Install cached Luarocks
if: steps.cache-luarocks.outputs.cache-hit == 'true'
run: |
cd /tmp/luarocks
sudo make install
- name: Install rocks
run: |
sudo -H luarocks install lgi
sudo -H luarocks install ldoc
- name: Install mdl
run: |
sudo gem install mdl -v 0.9.0
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Create Build Environment
run: cmake -E make_directory -B "${{ github.workspace }}/build"
- name: Get Awesome website target repo
env:
APIDOC_TOKEN: ${{ secrets.AWESOME_ROBOT_TOKEN || github.token }}
run: |
set -e
git clone \
https://${APIDOC_TOKEN}@github.com/awesomeWM/awesomeWM.github.io \
"${{ github.workspace }}/build" 2>&1 | sed "s/$APIDOC_TOKEN/APIDOC_TOKEN/g"
if [ "${{ github.event_name }}" != 'pull_request' ]; then
branch="${{ github.head_ref || github.ref_name }} "
else
branch="pr-${{ github.event.pull_request.number }}"
fi
if [ "$branch" != master ]; then
cd "${{ github.workspace }}/build"
if ! git checkout -b "$branch" "origin/$branch"; then
git checkout -b "$branch"
fi
cd -
fi
- name: Build website
run: |
cd "${{ github.workspace }}"
PKG_CONFIG_PATH="$HOME/install/lib/pkgconfig" make build_for_gh_actions
mdl --git-recurse .
- name: Publish website
if: github.event_name != 'pull_request'
env:
APIDOC_TOKEN: ${{ secrets.AWESOME_ROBOT_TOKEN || github.token }}
run: |
set -e
commit_hash=$(git rev-parse --short HEAD)
cd "${{ github.workspace }}/build"
git config user.name "awesome-robot on GH Actions"
git config user.email "awesome-robot@users.noreply.github.com"
git add --all .
NL=$'\n'
git commit -m "Update from GH Actions for awesome-www@${commit_hash}${NL}${NL}Commits: ${{ github.event.pull_request.commits_url }}${NL}Build URL: https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}"
git --no-pager show --stat
git push origin "$(git symbolic-ref --quiet HEAD)" 2>&1 | sed "s/$APIDOC_TOKEN/APIDOC_TOKEN/g"
# Purge CloudFlare cache.
curl -X DELETE "https://api.cloudflare.com/client/v4/zones/$CLOUDFLARE_ZONE/purge_cache" \
-H "X-Auth-Email: $CLOUDFLARE_AUTH_EMAIL" \
-H "X-Auth-Key: $CLOUDFLARE_AUTH_KEY" \
-H "Content-Type: application/json" \
--data '{"purge_everything":true}'
# vim: filetype=yaml:expandtab:shiftwidth=2:tabstop=2

2
.gitmodules vendored
View File

@ -1,3 +1,3 @@
[submodule "src"] [submodule "src"]
path = src path = src
url = git://github.com/awesomeWM/awesome.git url = https://github.com/awesomeWM/awesome

View File

@ -1,109 +0,0 @@
dist: xenial
language: minimal
branches:
only:
- master
env:
global:
- BUILD_WEB=/tmp/build-web
- secure: dMquVRuM4Wi/N3oZJaNIWSW5mpehxVuzDiDnC51OwfMtdNfdyWV7qKJQY44MjbveuyQd7eA/AuTLE+loaAFxiRfBXl2yI5NkAOrJwbbDyw/lAN9Og2FmNi+QLaTsNhpbYZ4zaUNEEqRWs9gIajGaXcWdO/HNYiKHHrk7+XXNDeM=
# CLOUDFLARE_AUTH_EMAIL/CLOUDFLARE_AUTH_KEY
- secure: JYKSA0crhIfgE7l51aF+qYr4JERLU3hXWRzKSmwuBi4uZzNxWfAm1hQ8qJ4+TTIIjJpr4dceVLdXRZDvX5B83hP8W4m4eoRp98IqwLinS5plB86Kv/C53vYGaMIaE+3u0EdehRgpSIN+2qmAUTNoQkFZsZh1Ok4vaN3QZaE2+f8=
# CLOUDFLARE_ZONE
- secure: LYV3F3ink6p8XfR2rjCcYDfTDSK22QRU4kYK4e77t42e3zky/tbiNZcJsrq9J5FwNEBZXDLxuXsgeEza3+x6N0uxjBIdopuEullL5jf5WRISxUja2wplOgCa8RC8CIvWyZOsbtw8UWJvbCyjwUXPT8q9sUT1U+KhYSuqVMo32GI=
addons:
apt:
packages:
- ikiwiki
- asciidoc
- imagemagick
- perlmagick
- luarocks
- cmake
- libxcb-cursor-dev
- libxcb-randr0-dev
- libxcb-xtest0-dev
- libxcb-xinerama0-dev
- libxcb-shape0-dev
- libxcb-util0-dev
- libxcb-keysyms1-dev
- libxcb-icccm4-dev
- libxdg-basedir-dev
- libstartup-notification0-dev
- libxcb-xkb-dev
- libxkbcommon-dev
- libxkbcommon-x11-dev
- gir1.2-pango-1.0
# Dependencies for xcb-util-xrm
- xutils-dev
# Dependencies for lgi
- libgirepository1.0-dev
- lua-discount
# Clone the awesomeWM.github.io repo before building, because we need the
# working copy to be there for updating already.
before_install:
- |
if [ -n "$GH_APIDOC_TOKEN" ]; then
set -e
git clone \
https://${GH_APIDOC_TOKEN}@github.com/awesomeWM/awesomeWM.github.io \
"$BUILD_WEB" 2>&1 | sed "s/$GH_APIDOC_TOKEN/GH_APIDOC_TOKEN/g"
if [ "$TRAVIS_PULL_REQUEST" = false ]; then
branch="$TRAVIS_BRANCH"
else
branch="pr-$TRAVIS_PULL_REQUEST"
fi
if [ "$branch" != master ]; then
cd $BUILD_WEB
if ! git checkout -b "$branch" "origin/$branch"; then
git checkout -b "$branch"
fi
cd -
fi
fi
install:
# xcb-util-xrm is not available in Ubuntu Ancient
- (cd /tmp && git clone --recursive https://github.com/Airblader/xcb-util-xrm.git && cd xcb-util-xrm && ./autogen.sh --prefix=$HOME/install && make && make install)
- travis_retry luarocks --local install ldoc
- luarocks path --bin
- eval `luarocks path --bin`
# Of course Ubuntu's Luarocks version is too old for --bin
- PATH="$PATH:$HOME/.luarocks/bin"
# lgi is too old
- travis_retry luarocks --local install lgi
- gem install mdl -v 0.9.0
after_install:
- luarocks --local list --porcelain | column -t -s $'\t'
script:
- PKG_CONFIG_PATH="$HOME/install/lib/pkgconfig" make build_for_travis
- mdl --git-recurse .
after_success:
- |
if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then exit 0; fi
if [ -n "$GH_APIDOC_TOKEN" ]; then
set -e
commit_hash=$(git rev-parse --short HEAD)
cd $BUILD_WEB
git config user.name "awesome-robot on Travis CI"
git config user.email "awesome-robot@users.noreply.github.com"
git add --all .
NL=$'\n'
git commit -m "Update from Travis for awesome-www@${commit_hash}${NL}${NL}Commits: https://github.com/awesomeWM/awesome-www/compare/${TRAVIS_COMMIT_RANGE/.../..}${NL}Build URL: https://travis-ci.com/awesomeWM/awesome-www/builds/${TRAVIS_BUILD_ID}"
git --no-pager show --stat
git push origin "$(git symbolic-ref --quiet HEAD)" 2>&1 | sed "s/$GH_APIDOC_TOKEN/GH_APIDOC_TOKEN/g"
# Purge CloudFlare cache.
curl -X DELETE "https://api.cloudflare.com/client/v4/zones/$CLOUDFLARE_ZONE/purge_cache" \
-H "X-Auth-Email: $CLOUDFLARE_AUTH_EMAIL" \
-H "X-Auth-Key: $CLOUDFLARE_AUTH_KEY" \
-H "Content-Type: application/json" \
--data '{"purge_everything":true}'
fi

View File

@ -34,10 +34,10 @@ manpages:
do asciidoc -a icons -b xhtml11 -o ../../html/doc/manpages/`basename $${manpage} .txt`.html $$manpage || exit 1; \ do asciidoc -a icons -b xhtml11 -o ../../html/doc/manpages/`basename $${manpage} .txt`.html $$manpage || exit 1; \
done done
build_for_travis: all build_for_gh_actions: all
build_for_travis: BUILD_WEB?=/tmp/awesome-build-web build_for_gh_actions: BUILD_WEB?=/tmp/awesome-build-web
build_for_travis: ASCIIDOC_ICONS_DIR?=/usr/share/asciidoc/icons build_for_gh_actions: ASCIIDOC_ICONS_DIR?=/usr/share/asciidoc/icons
build_for_travis: build_for_gh_actions:
test -d "$(ASCIIDOC_ICONS_DIR)" test -d "$(ASCIIDOC_ICONS_DIR)"
rsync -PaOvz --delete --exclude=.git --chmod=u=rwX,g=rwX,o=rX,Dg+s --exclude src html/ \ rsync -PaOvz --delete --exclude=.git --chmod=u=rwX,g=rwX,o=rX,Dg+s --exclude src html/ \
"$(BUILD_WEB)" "$(BUILD_WEB)"

View File

@ -1,6 +1,6 @@
# Website for awesome WM # Website for awesome WM
[![Build Status](https://travis-ci.org/awesomeWM/awesome-www.svg?branch=master)](https://travis-ci.org/awesomeWM/awesome-www) [![Build Status](https://github.com/awesomeWM/awesome-www/actions/workflows/www.yml/badge.svg)](https://github.com/awesomeWM/awesome-www/actions/workflows/www.yml)
This is the main source of the This is the main source of the
[website for the awesome window manager](https://awesomewm.org/). [website for the awesome window manager](https://awesomewm.org/).
@ -74,7 +74,7 @@ section in `recipes.mdwn` file.
## Publishing ## Publishing
The master branch gets built by The master branch gets built by
[Travis CI](https://travis-ci.org/awesomeWM/awesome-www/), and is then published [GH Actions](https://github.com/awesomeWM/awesome-www/actions), and is then published
through through
[Github's Organization Pages](https://github.com/awesomeWM/awesomeWM.github.io). [Github's Organization Pages](https://github.com/awesomeWM/awesomeWM.github.io).

View File

@ -31,7 +31,7 @@ The following steps are done in a checkout of the *awesome-www* git repository.
* In the awesome-www repository (push just the release branch!) * In the awesome-www repository (push just the release branch!)
* In the awesome repository (make sure the tag is also pushed!) * In the awesome repository (make sure the tag is also pushed!)
* Create a pull request to the awesome-www repository for the release branch. * Create a pull request to the awesome-www repository for the release branch.
This makes sure that the Travis build will be successful when merging into the This makes sure that the Github-Actions build will be successful when merging into the
master branch. master branch.
* Create the release on GitHub: * Create the release on GitHub:
* Go to the GitHub release page <https://github.com/awesomeWM/awesome/releases/new>. * Go to the GitHub release page <https://github.com/awesomeWM/awesome/releases/new>.