Skip to content

Commit

Permalink
testing
Browse files Browse the repository at this point in the history
  • Loading branch information
MathiasReker committed Jan 1, 2025
1 parent 891a438 commit 8208cd4
Show file tree
Hide file tree
Showing 3 changed files with 89 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
* text=auto eol=lf
*.md text
*.php text diff=php
/.gitattributes export-ignore
Expand All @@ -14,4 +15,4 @@
/rector.php export-ignore
/tests export-ignore
/.github export-ignore
* text=auto eol=lf
/scripts export-ignore
72 changes: 72 additions & 0 deletions .github/workflows/terminal.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Run PHP Script with Asciinema

on:
push:
branches:
- develop
pull_request:
branches:
- '*'

permissions:
contents: write # Allow pushing to the repository
pull-requests: write # If you want to interact with pull requests

jobs:
run_script:
runs-on: ubuntu-latest

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

- name: Set Up PHP Environment
uses: shivammathur/setup-php@v2
with:
php-version: 8.4
extensions: mbstring

- name: Install Pipe Viewer (pv)
run: |
sudo apt install -y pv
pv --version
- name: Install Asciinema
run: |
sudo apt install -y asciinema
- name: Make script executable
run: |
# Ensure the 'scripts/demo.sh' script is executable
chmod +x scripts/demo.sh
pwd
echo ~
echo /
- name: Record the script execution
run: |
# Record the terminal session by running the demo script located in 'scripts/demo.sh'
asciinema rec --command="./scripts/demo.sh" --quiet --overwrite output.cast
- name: Download the prebuilt `agg` binary for Ubuntu (x86_64)
run: |
# Download the appropriate binary for x86_64 Linux from the release page
wget https://github.com/asciinema/agg/releases/download/v1.5.0/agg-x86_64-unknown-linux-gnu -O agg
chmod +x agg
sudo mv agg /usr/local/bin
- name: Convert .cast to .gif using `agg` binary
run: |
# Convert the output.cast file to demo.gif and save it in the assets directory
agg output.cast assets/demo.gif
- name: Commit and push demo.gif to the repository
run: |
# Commit the demo.gif to the assets folder and push it back to the repository
git config --global user.name "github-actions"
git config --global user.email "[email protected]"
git add assets/demo.gif
git commit -m "Add demo.gif to assets folder"
git push origin HEAD:develop
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
15 changes: 15 additions & 0 deletions scripts/demo.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

echo "Hello, World!" | pv -qL 10
sleep 1

echo "This is a scripted session." | pv -qL 10
sleep 1

echo "Listing files:" | pv -qL 10
sleep 0.5
ls | pv -qL 10
sleep 1

echo "Goodbye!" | pv -qL 10
EOF

0 comments on commit 8208cd4

Please sign in to comment.