Use GitHub actions not travis (#67) #18
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build the documentation and the UI | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
jobs: | |
docs_and_ui: | |
name: Build the Documentation and UI | |
runs-on: ubuntu-latest | |
steps: | |
- name: Skip publishing to GitHub Pages | |
env: | |
REF_NAME: ${{ github.ref }} | |
if: ${{ 'refs/head/master' != env.REF_NAME }} | |
run: | | |
echo "This is NOT a push to master branch, not pushing to github-pages" | |
- uses: actions/checkout@v2 | |
- name: Clean docs | |
run: | | |
if [ -d docs/build/ui ]; then rm -R docs/build/ui; fi | |
shell: bash | |
- name: Setup node | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '18.x' | |
- name: Generate templates | |
run: | | |
npm install nunjucks | |
node_modules/nunjucks/bin/precompile ebu_tt_live/ui/user_input_producer/template/user_input_producer_template.xml > ebu_tt_live/ui/user_input_producer/template/user_input_producer_template.js | |
node_modules/nunjucks/bin/precompile ebu_tt_live/ui/user_input_producer/template/live_message_template.xml > ebu_tt_live/ui/user_input_producer/template/live_message_template.js | |
- name: Copy UI files into place | |
run: | | |
mkdir -p docs/build/ui | |
cp -R ebu_tt_live/ui/user_input_producer docs/build/ui/ | |
cp -R ebu_tt_live/ui/test docs/build/ui/ | |
cp -R ebu_tt_live/ui/assets docs/build/ui/user_input_producer/ | |
cp -R ebu_tt_live/ui/assets docs/build/ui/test/ | |
shell: bash | |
- name: Setup graphviz | |
uses: ts-graphviz/setup-graphviz@v1 | |
- name: Setup Python 3.11 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
cache: 'pip' | |
#---------------------------------------------- | |
# ----- install & configure poetry ----- | |
#---------------------------------------------- | |
- name: Install Poetry | |
uses: snok/install-poetry@v1 | |
with: | |
virtualenvs-create: true | |
virtualenvs-in-project: true | |
installer-parallel: true | |
#---------------------------------------------- | |
# load cached venv if cache exists | |
#---------------------------------------------- | |
- name: Load cached venv | |
id: cached-poetry-dependencies | |
uses: actions/cache@v3 | |
with: | |
path: .venv | |
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }} | |
#---------------------------------------------- | |
# install dependencies if cache does not exist | |
#---------------------------------------------- | |
- name: Install dependencies | |
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' | |
run: | | |
poetry install --no-interaction | |
shell: bash | |
- name: Generate bindings | |
run: | | |
poetry run pyxbgen --binding-root=. -m __init__ --schema-root=./ebu_tt_live/xsd/ -r -u ebutt_all.xsd --module-prefix=ebu_tt_live.bindings | |
shell: bash | |
- name: Build the documentation | |
run: | | |
poetry run sphinx-build docs/source docs/build | |
- name: Publish to GitHub Pages | |
env: | |
GITHUB_REF: ${{ github.ref }} | |
if: ${{ env.GITHUB_REF == 'refs/heads/master' }} | |
uses: JamesIves/[email protected] | |
with: | |
branch: gh-pages | |
folder: docs/build | |
clean: true | |
clean-exclude: | | |
.nojekyll | |
- name: Skip publishing to GitHub Pages | |
env: | |
GITHUB_REF: ${{ github.ref }} | |
if: ${{ env.GITHUB_REF != 'refs/heads/master' }} | |
run: | | |
echo "This is NOT a push to master branch, not pushing to github-pages" | |
echo "ref is ${{ env.GITHUB_REF }}" |