Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
99 changes: 99 additions & 0 deletions .github/workflows/build-tutorials.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
#
# Copyright 2025 Paul Guyot <[email protected]>
#
# SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later
#
name: Build Tutorials

on:
# Triggers the workflow on push request and tag events on main branch
pull_request:
tags:
- '**'
branches:
- 'main'
- 'release-**'
paths:
- '.github/workflows/**'
- 'CMakeLists.txt'
- 'CMakeModules/**'
- 'tutorials/**'
push:
repositories:
- '!atomvm_examples/AtomVM'
paths:
- '.github/workflows/**'
- 'CMakeLists.txt'
- 'CMakeModules/**'
- 'tutorials/**'

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref != 'refs/heads/main' && github.ref || github.run_id }}
cancel-in-progress: true

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:

# The type of runner that the job will run on
runs-on: ubuntu-24.04
container: erlang:28.1

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Install Deps
run: |
apt update -y
DEBIAN_FRONTEND=noninteractive apt install -y git cmake doxygen graphviz python3-pip python3-virtualenv python3-setuptools python3-stemmer wget

- uses: actions/cache@v4
id: sphinx-cache
with:
path: /home/runner/python-env/sphinx
key: ${{ job.container.id }}-${{ hashFiles('**/requirements.txt') }}

- name: Install Sphinx
if: ${{ steps.sphinx-cache.outputs.cache-hit != 'true' }}
run: |
virtualenv /home/runner/python-env/sphinx
. /home/runner/python-env/sphinx/bin/activate
python3 -m pip install -r tutorials/requirements.txt

- name: Set docs target name
shell: bash
run: |
if [[ ${{ github.ref_name }} == *"/merge" ]]; then
echo "AVM_DOCS_NAME=${{ github.event.pull_request.base.ref }}" | tr '/' '-' >> "$GITHUB_ENV";
else
echo "AVM_DOCS_NAME=${{ github.ref_name }}" | tr '/' '-' >> "$GITHUB_ENV";
fi

- uses: actions/checkout@v4
with:
repository: ${{ vars.GITHUB_REPOSITORY }}
fetch-depth: 0

- name: Track all branches
shell: bash
run: |
git config --global --add safe.directory /__w/AtomVM/AtomVM
for branch in `git branch -a | grep "remotes/origin" | grep -v HEAD | grep -v "${{ github.ref_name }}"`; do
git branch --track ${branch#remotes/origin/} $branch
done

- name: Build site
id: build
shell: bash
run: |
. /home/runner/python-env/sphinx/bin/activate
git config --global --add safe.directory ${PWD}
cd tutorials
python generate_diagrams.py
sphinx-build . build/html/
touch build/html/.nojekyll

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
**/deps/**
**/mix.lock
**/rebar3.crashdump
.DS_Store
Loading