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

Run examples with GitHub Actions #310

Merged
merged 8 commits into from
Jan 18, 2025
Merged
Show file tree
Hide file tree
Changes from 6 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
65 changes: 65 additions & 0 deletions .github/workflows/examples.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Examples

on:
push:
branches: [main]
pull_request:

jobs:
list-examples:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v4
- id: set-matrix
run: echo "::set-output name=matrix::$(cd examples && ls *.{ts,json5} | jq -R -s -c 'split("\n")[:-1]')"
examples:
needs: list-examples
runs-on: ubuntu-latest
strategy:
matrix:
example: ${{ fromJson(needs.list-examples.outputs.matrix) }}
fail-fast: false
name: ${{ matrix.example }}
env:
DISPLAY: :0
steps:
- run: |
sudo apt-get update && sudo apt-get install -y \
build-essential \
ffmpeg \
libcairo2-dev \
libgif-dev \
libglew-dev \
libglu1-mesa-dev \
libjpeg-dev \
libpango1.0-dev \
librsvg2-dev \
libxi-dev \
pkg-config
- run: sudo /usr/bin/Xvfb $DISPLAY -screen 0 1280x1024x24 &
- uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
repository: mifi/editly-assets
path: examples/assets
- uses: actions/setup-node@v4
with:
node-version: 22
cache: "yarn"
cache-dependency-path: ./package.json
- run: yarn install
- run: |
cd examples
./run "${{ matrix.example }}"
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.example }}
path: |
examples/*.png
examples/*.gif
examples/*.mp4
examples/*.webp
compression-level: 0
if-no-files-found: error
2 changes: 2 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,5 @@ jobs:
with:
name: video-${{ runner.os }}
path: editly-out.mp4
compression-level: 0
if-no-files-found: error
13 changes: 5 additions & 8 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,12 @@ This folder contains examples and tests for different features.
How to run examples:

```bash
npm i -g editly

git clone https://github.com/mifi/editly.git

cd editly/examples

cd editly
npm install
cd examples
git clone https://github.com/mifi/editly-assets.git assets

editly --fast commonFeatures.json5
./run commonFeatures.json5
```

## Image slideshow with Ken Burns zoom
Expand Down Expand Up @@ -94,4 +91,4 @@ https://user-images.githubusercontent.com/907138/214545896-ab420beb-bd50-4974-9b

## LosslessCut tutorial

[This video](https://www.youtube.com/watch?v=pYHMxXy05Jg) was created with [losslesscut.json5](https://github.com/mifi/editly/blob/master/examples/losslesscut.json5)
[This video](https://www.youtube.com/watch?v=pYHMxXy05Jg) was created with [losslesscut.json5](https://github.com/mifi/editly/blob/master/examples/losslesscut.json5)
36 changes: 0 additions & 36 deletions examples/losslesscut.json5

This file was deleted.

20 changes: 20 additions & 0 deletions examples/run
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#/bin/bash
## Run an example or all examples
# Usage: ./run [example1.ts] [example2.json5] ...
set -e

# Get list of examples from args or all files in examples directory
if [ "$#" -eq 0 ]; then
examples=$(ls *.{ts,json5})
else
examples=$@
fi

for example in $examples; do
echo "Running $example"
if [[ $example == *.ts ]]; then
npx tsx "$example"
else
node ../dist/cli.js --fast --json "$example"
fi
done
10 changes: 0 additions & 10 deletions examples/run-all-examples.sh

This file was deleted.

Empty file modified src/cli.ts
100644 → 100755
Empty file.
Loading