Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add demo workflow #872

Open
wants to merge 104 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
104 commits
Select commit Hold shift + click to select a range
e0d4b39
Add demo workflow
osterman Dec 19, 2024
75ae8d8
Add pull request trigger
osterman Dec 19, 2024
69cb6f0
install util-linux
osterman Dec 19, 2024
9e0777a
format
osterman Dec 19, 2024
9062468
format
osterman Dec 19, 2024
2600a6f
only commit when files changes
osterman Dec 19, 2024
2bbedb9
set committer
osterman Dec 23, 2024
8a2c86e
set committer
osterman Dec 23, 2024
63c62ca
set committer
osterman Dec 23, 2024
1e55e9d
set committer
osterman Dec 23, 2024
1fe7ffa
show status of files
osterman Dec 23, 2024
e838a8a
Rename Screengrabs to tmp
osterman Dec 23, 2024
a80687a
Rename tmp to screengrabs
osterman Dec 23, 2024
1df005f
Rename screengrabs to tmp
osterman Dec 23, 2024
806317c
Rename tmp to Screengrabs
osterman Dec 23, 2024
d27fceb
install to case sensitive path
osterman Dec 23, 2024
6b30d09
add new screengrabs
osterman Dec 23, 2024
1471ae2
simplify
osterman Dec 23, 2024
e77df1d
cannot import more than one level deep
osterman Dec 23, 2024
08673a8
use git ls
osterman Dec 23, 2024
a529cea
use git ls
osterman Dec 23, 2024
3031aa0
fix jq
osterman Dec 23, 2024
4f486b1
Add vhs step
osterman Dec 23, 2024
ef49fc9
Add vhs step
osterman Dec 23, 2024
09d0558
Add vhs step
osterman Dec 23, 2024
e0b4781
test install of atmos
osterman Dec 23, 2024
e1f5109
set path
osterman Dec 23, 2024
65608d2
set path
osterman Dec 23, 2024
c22cfb8
update
osterman Dec 23, 2024
62a9a70
update demo to add docs
osterman Dec 23, 2024
957aad4
update demo to add docs
osterman Dec 23, 2024
3e92700
increase ram
osterman Dec 23, 2024
97ff562
reduce frame rate
osterman Dec 23, 2024
6f1ce5b
reduce framerate
osterman Dec 24, 2024
4d84db3
install missing dep
osterman Dec 24, 2024
f9d23b3
strip out text
osterman Dec 24, 2024
6cafabf
add bat
osterman Dec 24, 2024
df2782a
add bat
osterman Dec 24, 2024
07390f8
Merge branch 'main' into regen-screengrabs
osterman Dec 24, 2024
cb688d9
symlink bat
osterman Dec 24, 2024
bddcb50
debug hanging vhs
osterman Dec 24, 2024
513c8e2
debug hanging screengrabs
osterman Dec 24, 2024
6c63877
debug broken tapes
osterman Dec 25, 2024
81eb5ee
debug broken tapes
osterman Dec 25, 2024
aa6599d
debug vhs
osterman Dec 25, 2024
2047d8e
debug vhs
osterman Dec 25, 2024
d859b4b
debug vhs
osterman Dec 25, 2024
f161810
debug vhs
osterman Dec 25, 2024
3d15df5
debug vhs
osterman Dec 25, 2024
b868732
debug vhs
osterman Dec 25, 2024
880c3e0
debug vhs
osterman Dec 25, 2024
a1e2006
debug vhs
osterman Dec 25, 2024
3195b0a
debug vhs
osterman Dec 25, 2024
73a8c1b
debug vhs
osterman Dec 25, 2024
67e5fff
debug vhs
osterman Dec 25, 2024
5793749
debug vhs
osterman Dec 25, 2024
1339e56
debug vhs
osterman Dec 25, 2024
0ab6e38
debug vhs
osterman Dec 25, 2024
3a0dccd
debug vhs
osterman Dec 25, 2024
dedf76c
debug vhs
osterman Dec 25, 2024
ce2bff7
debug vhs
osterman Dec 25, 2024
bd5cafd
debug vhs
osterman Dec 25, 2024
1856da7
debug vhs
osterman Dec 26, 2024
33956c4
switch vhs strategy and add audio
osterman Dec 26, 2024
e7c8db4
fix truncation
osterman Dec 26, 2024
d9245a4
move assets to cloudposse-corp
osterman Dec 31, 2024
dc6a905
move assets to cloudposse-corp
osterman Dec 31, 2024
f285b78
use github app
osterman Dec 31, 2024
1dfde36
use github app
osterman Dec 31, 2024
e2b8df7
test AWS connection
osterman Jan 10, 2025
729d283
test AWS connection
osterman Jan 10, 2025
7f1243a
Add permissions to auth with OIDC
goruha Jan 10, 2025
14b38cf
Allow to create PRs
goruha Jan 10, 2025
2f932e3
test AWS connection
osterman Jan 10, 2025
100917d
test AWS connection
osterman Jan 10, 2025
ad6817f
Merge branch 'main' into regen-screengrabs
osterman Jan 10, 2025
d307e71
Merge branch 'main' into regen-screengrabs
osterman Jan 10, 2025
1879d87
fix typo
osterman Jan 10, 2025
de8ca40
too many problems
osterman Jan 10, 2025
7e23dd1
only build mp4 when tape is newer than video
osterman Jan 11, 2025
3c08575
debug commit errors
osterman Jan 11, 2025
e1031b2
fix conflict
osterman Jan 11, 2025
203fbaf
Merge branch 'main' into regen-screengrabs
osterman Jan 20, 2025
1bd1584
test fix to push PR
osterman Jan 20, 2025
96cfb63
debug hung vhs recording
osterman Jan 21, 2025
ac16b12
debug hung vhs
osterman Jan 21, 2025
1f92a8d
try to use ubuntu-24.04 to fix vhs hang
osterman Jan 21, 2025
17ae449
try ctrl+c fix
osterman Jan 21, 2025
615f847
try ctrl+c fix
osterman Jan 21, 2025
78edd0c
try ctrl+c fix and increase timeout
osterman Jan 21, 2025
83fcd04
debug vhs
osterman Jan 21, 2025
d390e67
hide ps
osterman Jan 21, 2025
c04072c
upload to s3
osterman Jan 21, 2025
8928fac
polish tapes
osterman Jan 22, 2025
801f7b6
wip
osterman Jan 24, 2025
c6665c0
backup
osterman Feb 9, 2025
11795f4
backup
osterman Feb 11, 2025
14d310f
Use run with spinner
osterman Feb 12, 2025
b82d65c
Rewrite demo generation in go
osterman Feb 12, 2025
e969089
[autofix.ci] apply automated fixes
autofix-ci[bot] Feb 12, 2025
684b6fb
Merge branch 'main' into regen-screengrabs
osterman Feb 12, 2025
5f47cfc
Merge branch 'main' into regen-screengrabs
osterman Feb 12, 2025
d42fea5
change color of blue
osterman Feb 12, 2025
7721fc7
Merge branch 'regen-screengrabs' of github.com:cloudposse/atmos into …
osterman Feb 12, 2025
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
232 changes: 232 additions & 0 deletions .github/workflows/demo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,232 @@
name: Demo

on:
workflow_dispatch:
pull_request:
types: [labeled, opened, synchronize]
paths:
- ".github/workflows/demo.yml"
osterman marked this conversation as resolved.
Show resolved Hide resolved

osterman marked this conversation as resolved.
Show resolved Hide resolved
permissions:
contents: write
id-token: write
pull-requests: write

env:
TERM: "xterm-256color"
COLORTERM: "truecolor"
LANG: "en_US.UTF-8"
ATMOS_LOGS_LEVEL: "Info"
TERRAFORM_VERSION: "1.9.7"

jobs:
prepare:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Get Atmos version
id: get-version
run: |
VERSION=$(curl -s https://api.github.com/repos/cloudposse/atmos/releases/latest | jq -r .tag_name)
echo "version=$VERSION" >> $GITHUB_OUTPUT
osterman marked this conversation as resolved.
Show resolved Hide resolved

outputs:
version: ${{ steps.get-version.outputs.version }}

screengrabs:
needs: [prepare]
runs-on: ubuntu-latest
steps:
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y aha util-linux make jq bat
sudo ln -s /usr/bin/batcat /usr/bin/bat
osterman marked this conversation as resolved.
Show resolved Hide resolved

- name: Set Git Preferences for windows
run: |
git config --global core.autocrlf false
git config --global core.eol lf

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

- name: Install Atmos
uses: jaxxstorm/[email protected]
with:
repo: cloudposse/atmos
tag: ${{ needs.prepare.outputs.version }}
chmod: 0755
extension-matching: disable
rename-to: atmos

- uses: hashicorp/setup-terraform@v3
with:
terraform_version: ${{ env.TERRAFORM_VERSION }}
terraform_wrapper: false

- name: Run make build-all install
run: |
make -C demo/screengrabs build-all install
git add -A
git status

- name: Create or update PR
uses: peter-evans/create-pull-request@v7
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: "chore/update-build-screengrabs-for-${{ needs.prepare.outputs.version }}"
title: "Update screengrabs for ${{ needs.prepare.outputs.version }}"
delete-branch: true
sign-commits: true
commit-message: |
chore: update screengrabs for ${{ needs.prepare.outputs.version }}
body: |
This PR updates the screengrabs for Atmos version ${{ needs.prepare.outputs.version }}.
base: main
labels: "no-release"

vhs:
needs: [prepare]
runs-on: ubuntu-24.04
# Longer timeouts typically indicate VHS has hung
timeout-minutes: 20
environment: demo
env:
AWS_REGION: us-east-2
steps:
# Determine environment-specific settings
- name: Set Environment Variables
id: set-env
run: |
if [[ "${{ github.event_name }}" == "release" ]]; then
echo "IAM_ROLE_ARN=arn:aws:iam::557075604627:role/cplive-plat-ue2-prod-atmos-docs-gha" >> $GITHUB_ENV
echo "IAM_ROLE_SESSION_NAME=cloudposse-atmos-ci-deploy-release" >> $GITHUB_ENV
echo "S3_BUCKET_NAME=cplive-plat-ue2-prod-atmos-docs-origin" >> $GITHUB_ENV
echo "S3_PATH=assets" >> $GITHUB_ENV
echo "BASE_URL=https://atmos.tools/assets" >> $GITHUB_ENV
elif [[ "${{ github.event_name }}" == "pull_request" ]]; then
echo "IAM_ROLE_ARN=arn:aws:iam::068007702576:role/cplive-plat-ue2-dev-atmos-docs-gha" >> $GITHUB_ENV
echo "IAM_ROLE_SESSION_NAME=cloudposse-atmos-ci-deploy-${{ github.run_id }}" >> $GITHUB_ENV
echo "S3_BUCKET_NAME=cplive-plat-ue2-dev-atmos-docs-origin" >> $GITHUB_ENV
echo "PR_NUMBER=${{ github.event.pull_request.number }}" >> $GITHUB_ENV
echo "S3_PATH=pr-${{ github.event.pull_request.number }}/assets" >> $GITHUB_ENV
echo "BASE_URL=https://pr-${{ github.event.pull_request.number }}.atmos-docs.ue2.dev.plat.cloudposse.org/assets" >> $GITHUB_ENV
fi

# https://github.com/marketplace/actions/configure-aws-credentials-action-for-github-actions
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: ${{ env.AWS_REGION }}
osterman marked this conversation as resolved.
Show resolved Hide resolved
role-to-assume: ${{ env.IAM_ROLE_ARN }}
role-session-name: ${{ env.IAM_ROLE_SESSION_NAME }}

- name: Test AWS
run: |
aws sts get-caller-identity
osterman marked this conversation as resolved.
Show resolved Hide resolved

- uses: actions/create-github-app-token@v1
id: github-app
with:
app-id: ${{ vars.BOT_GITHUB_APP_ID }}
private-key: ${{ secrets.BOT_GITHUB_APP_PRIVATE_KEY }}
owner: cloudposse-corp
repositories: assets

- uses: actions/checkout@v4
- name: Checkout cloudposse-corp/assets
uses: actions/checkout@v4
with:
repository: cloudposse-corp/assets
token: ${{ steps.github-app.outputs.token }}
path: assets

- name: Install audio track
run: |
cp assets/artlist/background-1.mp3 demo/recordings/background.mp3

- name: Set Swap Space
uses: pierotofy/set-swap-space@0404882bc4666c0ff2f6fd8b3d32af69a730183c
with:
swap-size-gb: 15
Comment on lines +150 to +153
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Pin the set-swap-space action to a specific version.

Using a commit SHA for the action version is not recommended. Use a proper version tag instead.

-  uses: pierotofy/set-swap-space@0404882bc4666c0ff2f6fd8b3d32af69a730183c
+  uses: pierotofy/[email protected]
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- name: Set Swap Space
uses: pierotofy/set-swap-space@0404882bc4666c0ff2f6fd8b3d32af69a730183c
with:
swap-size-gb: 15
- name: Set Swap Space
uses: pierotofy/set-swap-space@v1.0
with:
swap-size-gb: 15


- name: Install Atmos
uses: jaxxstorm/[email protected]
with:
repo: cloudposse/atmos
tag: ${{ needs.prepare.outputs.version }}
chmod: 0755
extension-matching: disable
rename-to: atmos

- uses: hashicorp/setup-terraform@v3
with:
terraform_version: ${{ env.TERRAFORM_VERSION }}
terraform_wrapper: false

- name: Test Atmos
run: |
which atmos
atmos version
atmos --help

osterman marked this conversation as resolved.
Show resolved Hide resolved
- name: Prepare variables
id: vars
run: |
VERSION="${{ needs.prepare.outputs.version }}"
echo "version=${VERSION}" >> $GITHUB_OUTPUT
echo "job_name=${JOB_NAME}" >> $GITHUB_OUTPUT
echo "branch_name=chore/update-${JOB_NAME}-for-${VERSION}" >> $GITHUB_OUTPUT
osterman marked this conversation as resolved.
Show resolved Hide resolved

- name: Setup VHS
uses: charmbracelet/vhs-action@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
install-fonts: true

- name: Record screencast
working-directory: demo/recordings
run: |
go run studio.go build
cp demo/recordings/gif/atmos.gif docs/demo.gif
git add docs/demo.gif

- name: Upload Assets to S3 (atmos.tools)
run: |
cd demo/recordings
aws s3 ls s3://${{ env.S3_BUCKET_NAME }}
for ext in mp4 gif; do
aws s3 sync $ext/ s3://${{ env.S3_BUCKET_NAME }}/${{ env.S3_PATH }}/${ext}/
aws s3 ls s3://${{ env.S3_BUCKET_NAME }}/${{ env.S3_PATH }}/${ext}/ --recursive --human-readable --summarize
done

- name: Create or update PR
uses: peter-evans/create-pull-request@v7
id: auto-commit
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ steps.vars.outputs.branch_name }}
sign-commits: true
commit-message: |
chore: update ${{ steps.vars.outputs.job_name }} for ${{ steps.vars.outputs.version }}
title: Update ${{ steps.vars.outputs.job_name }} for ${{ steps.vars.outputs.version }}
body: |
This PR updates the demo gif for ${{ steps.vars.outputs.job_name }} with Atmos version ${{ steps.vars.outputs.version }}.
base: main
labels: no-release

- name: Add Image to Job Summary
if: steps.auto-commit.outputs.pull-request-operation == 'created' || steps.auto-commit.outputs.pull-request-operation == 'updated'
run: |
echo "## Demo GIF" >> $GITHUB_STEP_SUMMARY
echo "![Demo GIF](https://github.com/${{ github.repository }}/blob/${{ steps.auto-commit.outputs.pull-request-head-sha }}/docs/demo.gif?raw=true)" >> $GITHUB_STEP_SUMMARY
osterman marked this conversation as resolved.
Show resolved Hide resolved

echo "## Demo Video" >> $GITHUB_STEP_SUMMARY
echo "${{ env.BASE_URL }}/mp4/atmos-with-audio.mp4" >> $GITHUB_STEP_SUMMARY

- name: No changes
if: steps.auto-commit.outputs.pull-request-operation == 'none' || steps.auto-commit.outputs.pull-request-operation == 'closed'
run: |
echo "No changes to demo" >> $GITHUB_STEP_SUMMARY
102 changes: 0 additions & 102 deletions .github/workflows/vhs.yaml

This file was deleted.

31 changes: 31 additions & 0 deletions demo/defaults.tape
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# VHS Defaults for Recordings and Screenshots

#Set Theme "Monokai Vivid"

# It's not possible to combine named themes, with explicitly defined themes
Set Theme { "name": "Monokai Vivid", "black": "#121212", "red": "#fa2934", "green": "#98e123", "yellow": "#fff30a", "blue": "#0443ff", "magenta": "#f800f8", "cyan": "#01b6ed", "white": "#ffffff", "brightBlack": "#838383", "brightRed": "#f6669d", "brightGreen": "#b1e05f", "brightYellow": "#fff26d", "brightBlue": "#0443ff", "brightMagenta": "#f200f6", "brightCyan": "#51ceff", "brightWhite": "#ffffff", "background": "#121212", "foreground": "#f9f9f9", "cursor": "#b3b0d6", "selection": "#ffffff"}

Set FontFamily "FiraCode Nerd Font"
#Set FontFamily "Hack Nerd Font"
Set FontSize 14

Set TypingSpeed 20ms

Set WindowBar Colorful

Set BorderRadius 8

Set Margin 0

Set Padding 10

# !! WARNING !!
# Large aspect ratios require more memory to process (and a factor of the framerate)
# Free-tier GitHub Action runners do not have sufficient memory to process long recordings
# at a high framerate before crashing. Therefore, for automation purposes we need to keep these small.

# Use standard aspect ratios
Set Width 1280
Set Height 720

Set Shell "bash"
1 change: 1 addition & 0 deletions demo/recordings/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
background.mp3
Loading
Loading