Skip to content

Commit

Permalink
ci(build): automated builds and deployment to pages
Browse files Browse the repository at this point in the history
Use a matrix to parallelize building the docs for listed DEVFAMILY and
OS combinations. Aggregate the results to build an expected pages
artifact. Deploy the monolithic artifact to GitHub pages.

If any platform fails for any reason, the arguments and logs for that
build will be logged under a separate section of this workflow, and the
results should not be deployed.

This also builds a rudimentary landing page linking to all builds since
GitHub pages will not allow you to browse deployed files directly.

Signed-off-by: Randolph Sapp <[email protected]>
  • Loading branch information
StaticRocket committed Dec 12, 2024
1 parent 71bdf5e commit 068fa5f
Show file tree
Hide file tree
Showing 2 changed files with 140 additions and 0 deletions.
70 changes: 70 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
---
name: "build"

on:
push:
branches: [master]

concurrency:
group: ${{ github.ref_name }}
cancel-in-progress: true

defaults:
run:
shell: bash

jobs:
build:
name: Build Linux Documents
runs-on: ubuntu-latest
container:
image: ghcr.io/texasinstruments/processor-sdk-doc:latest
options: --entrypoint /bin/bash
strategy:
matrix:
os: [linux]
device:
- AM335X
- AM437X
- AM57X
- AM62AX
- AM62PX
- AM62X
- AM64X
- AM65X
- AM67
- AM68
- AM69
- CORESDK
- DRA821A
- GEN
- J7200
- J721E
- J721S2
- J722S
- J742S2
- J784S4
include:
- os: android
device: AM62PX
- os: android
device: AM62X
- os: android
device: GEN

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Build ${{ matrix.device }}
run: |
make DEVFAMILY=${{ matrix.device }} OS=${{ matrix.os }} \
VERSION=${{ github.ref_name }}
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.device }}-${{ matrix.os }}
path: build/
retention-days: 1

70 changes: 70 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
---
name: "deploy"

on:
workflow_run:
workflows:
- build
types:
- completed

jobs:
agregate:
name: Agregate build artifacts
runs-on: ubuntu-latest

steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path: build
merge-multiple: true
run-id: ${{ github.event.workflow_run.id }}

- name: Generate root index
run: |
cat << EOF > build/index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>PSDK Documentation Landing Page</title>
</head>
<body>
<main class="inner cover" role="main">
<h1>PSDK Documentation Landing Page</h1>
EOF
for path in build/*/; do
root_index=$(find "$path" -name index.html | sort -u | tail -1)
if [ -n "$root_index" ]; then
text=$(basename "$path")
relative_path=$(realpath "$root_index" --relative-to=build)
printf ' <a href="%s">%s</a>\n' \
"$relative_path" "$text" >> build/index.html
fi
done
cat << EOF >> build/index.html
</main>
</body>
</html>
EOF
- name: Upload static files as single artifact
uses: actions/upload-pages-artifact@v3
with:
path: build

deploy:
name: Deploy
runs-on: ubuntu-latest
needs: agregate
permissions:
pages: write
id-token: write

steps:
- name: Update github page deployment
uses: actions/deploy-pages@v4

0 comments on commit 068fa5f

Please sign in to comment.