feat: add ffmpeg (desktop builds) #198
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
release: | |
types: | |
- created | |
name: CI | |
jobs: | |
lints: | |
if: false | |
name: Check and lints | |
runs-on: ubuntu-latest | |
env: | |
GODOT4_BIN: ${{ github.workspace }}/.bin/godot/godot4_bin | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
override: true | |
- run: rustup component add rustfmt | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
- name: Install gdtoolkit 4 | |
run: pip3 install "gdtoolkit==4.*" | |
- name: Check format GDScript | |
run: gdformat -d godot/ | |
- name: Install alsa and udev | |
if: runner.os == 'linux' | |
run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev | |
- name: install ffmpeg deps (linux) | |
run: sudo apt install -y --no-install-recommends clang curl pkg-config libavcodec-dev libavformat-dev libavutil-dev libavfilter-dev libavdevice-dev | |
if: runner.os == 'linux' | |
- name: install ffmpeg deps (macOs) | |
if: runner.os == 'macos' | |
run: brew install ffmpeg pkg-config | |
- name: set CLANG path for ffmpeg deps (windows) | |
if: runner.os == 'windows' | |
run: | | |
$VCINSTALLDIR = $(& "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -property installationPath) | |
Add-Content $env:GITHUB_ENV "LIBCLANG_PATH=${VCINSTALLDIR}\VC\Tools\LLVM\x64\bin`n" | |
- name: cargo xtask install | |
working-directory: rust/xtask | |
run: cargo run -- install --no-templates | |
- uses: actions-rs/cargo@v1 | |
name: cargo check | |
with: | |
command: check | |
args: --manifest-path rust/Cargo.toml | |
- uses: actions-rs/cargo@v1 | |
name: cargo fmt | |
with: | |
command: fmt | |
args: --manifest-path rust/Cargo.toml --all -- --check | |
- uses: actions-rs/cargo@v1 | |
name: cargo clippy | |
with: | |
command: clippy | |
args: --manifest-path rust/Cargo.toml -- -D warnings | |
coverage: | |
name: Coverage | |
if: false | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
rust: ["1.71.1"] | |
runs-on: ${{ matrix.os }} | |
env: | |
GODOT4_BIN: ${{ github.workspace }}/.bin/godot/godot4_bin | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v2 | |
- name: Install stable toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: ${{ matrix.rust }} | |
override: true | |
components: llvm-tools-preview | |
- name: Cache | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/git | |
rust/decentraland-godot-lib/target | |
rust/Cargo.lock | |
key: coverage-cargo-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: coverage-cargo- | |
- name: install ffmpeg deps (linux) | |
run: sudo apt install -y --no-install-recommends clang curl pkg-config libavcodec-dev libavformat-dev libavutil-dev libavfilter-dev libavdevice-dev | |
if: runner.os == 'linux' | |
- name: install ffmpeg deps (macOs) | |
if: runner.os == 'macos' | |
run: brew install ffmpeg pkg-config | |
- name: set CLANG path for ffmpeg deps (windows) | |
if: runner.os == 'windows' | |
run: | | |
$VCINSTALLDIR = $(& "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -property installationPath) | |
Add-Content $env:GITHUB_ENV "LIBCLANG_PATH=${VCINSTALLDIR}\VC\Tools\LLVM\x64\bin`n" | |
- name: cargo xtask install | |
working-directory: rust/xtask | |
run: cargo run -- install --no-templates | |
- name: Download grcov | |
run: | | |
mkdir -p "${HOME}/.local/bin" | |
curl -sL https://github.com/mozilla/grcov/releases/download/v0.8.10/grcov-x86_64-unknown-linux-gnu.tar.bz2 | tar jxf - -C "${HOME}/.local/bin" | |
echo "$HOME/.local/bin" >> $GITHUB_PATH | |
- name: Run xtask coverage | |
working-directory: rust/xtask | |
run: cargo run -- coverage | |
- name: Upload to codecov.io | |
uses: codecov/codecov-action@v3 | |
with: | |
files: rust/coverage/*.lcov | |
build: | |
name: Build and test | |
# Comment next line to test this job on PRs | |
# if: ${{ github.ref == 'refs/heads/main' }} | |
strategy: | |
matrix: | |
os: [windows-latest] | |
# Multi platform CI build dropped for now | |
# os: [windows-latest, ubuntu-latest, macos-latest] | |
runs-on: ${{ matrix.os }} | |
continue-on-error: true | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: 1.71.1 | |
override: true | |
# Old single action to Setup Cache | |
# - name: Set up cargo cache | |
# uses: actions/cache@v3 | |
# continue-on-error: false | |
# with: | |
# path: | | |
# ~/.cargo/bin/ | |
# ~/.cargo/registry/index/ | |
# ~/.cargo/registry/cache/ | |
# ~/.cargo/git/db/ | |
# rust/decentraland-godot-lib/target/ | |
# rust/xtask/target/ | |
# key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
# restore-keys: ${{ runner.os }}-cargo- | |
- uses: actions/cache/restore@v3 | |
id: restore-cache | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
rust/decentraland-godot-lib/target/ | |
rust/xtask/target/ | |
key: ${{ runner.os }}-cargo- | |
# Depedencies section | |
# => Linux | |
# - name: Install alsa and udev | |
# if: runner.os == 'linux' | |
# run: sudo apt-get update; sudo apt-get install -y --no-install-recommends libasound2-dev libudev-dev | |
# - name: install ffmpeg deps (linux) | |
# run: sudo apt install -y --no-install-recommends clang curl pkg-config libavcodec-dev libavformat-dev libavutil-dev libavfilter-dev libavdevice-dev | |
# if: runner.os == 'linux' | |
# => MacOS | |
# - name: install ffmpeg deps (macOs) | |
# if: runner.os == 'macos' | |
# run: brew install ffmpeg pkg-config | |
# - name: Set up target platform | |
# if: ${{ matrix.os == 'macos-latest' }} | |
# run: | | |
# rustup target add x86_64-apple-darwin | |
# rustup target add aarch64-apple-darwin | |
# => Windows | |
- name: set CLANG path for ffmpeg deps (windows) | |
if: runner.os == 'windows' | |
run: | | |
$VCINSTALLDIR = $(& "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -property installationPath) | |
Add-Content $env:GITHUB_ENV "LIBCLANG_PATH=${VCINSTALLDIR}\VC\Tools\LLVM\x64\bin`n" | |
Invoke-WebRequest "https://www.gyan.dev/ffmpeg/builds/ffmpeg-release-full-shared.7z" -OutFile ffmpeg-release-full-shared.7z | |
7z x ffmpeg-release-full-shared.7z | |
mkdir ffmpeg | |
mv ffmpeg-*/* ffmpeg/ | |
Add-Content $env:GITHUB_ENV "FFMPEG_DIR=${pwd}\ffmpeg`n" | |
Add-Content $env:GITHUB_PATH "${pwd}\ffmpeg\bin`n" | |
# => All platforms | |
- name: cargo xtask install | |
working-directory: rust/xtask | |
run: cargo run -- install | |
# Build section | |
- name: cargo build (linux/windows) | |
continue-on-error: true | |
if: ${{ matrix.os != 'macos-latest' }} | |
working-directory: rust/xtask | |
run: cargo run -- run -r --only-build | |
# - uses: actions-rs/cargo@v1 | |
# name: build for x86_64 (macos) | |
# if: ${{ matrix.os == 'macos-latest' }} | |
# with: | |
# command: build | |
# args: --manifest-path rust/decentraland-godot-lib/Cargo.toml --release --target=x86_64-apple-darwin | |
# - uses: actions-rs/cargo@v1 | |
# name: build for arm64 (macos) | |
# if: ${{ matrix.os == 'macos-latest' }} | |
# with: | |
# command: build | |
# args: --manifest-path rust/decentraland-godot-lib/Cargo.toml --release --target=aarch64-apple-darwin | |
- uses: actions-rs/cargo@v1 | |
continue-on-error: true | |
if: false # TODO: enable tests! | |
name: cargo test | |
with: | |
command: test | |
args: --manifest-path rust/decentraland-godot-lib/Cargo.toml --release | |
# Package section | |
# # => MacOS | |
# - name: Make universal library | |
# if: ${{ matrix.os == 'macos-latest' }} | |
# run: | | |
# mkdir rust/decentraland-godot-lib/target/release || true | |
# lipo -create rust/decentraland-godot-lib/target/x86_64-apple-darwin/release/libdecentraland_godot_lib.dylib rust/decentraland-godot-lib/target/aarch64-apple-darwin/release/libdecentraland_godot_lib.dylib -output rust/decentraland-godot-lib/target/release/libdecentraland_godot_lib.dylib | |
# # => Linux/MacOS (unix) | |
# - name: Copy library (linux/macos) | |
# if: ${{ matrix.os != 'windows-latest' }} | |
# run: | | |
# cp rust/decentraland-godot-lib/target/release/libdecentraland_godot_lib.so godot/lib/ || true | |
# cp rust/decentraland-godot-lib/target/release/libdecentraland_godot_lib.dylib godot/lib/ || true | |
# => Windows | |
- name: Copy library (windows) | |
continue-on-error: true | |
if: ${{ matrix.os == 'windows-latest' }} | |
run: | | |
cp rust/decentraland-godot-lib/target/release/decentraland_godot_lib.dll godot/lib/ | |
# Export section (multi platform) | |
- name: Export | |
continue-on-error: true | |
working-directory: rust/xtask | |
run: cargo run -- export | |
- uses: actions/upload-artifact@master | |
continue-on-error: true | |
with: | |
name: decentraland-godot-${{ matrix.os }} | |
path: | | |
exports/**/* | |
- uses: actions/cache/save@v3 | |
if: always() | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
rust/decentraland-godot-lib/target/ | |
rust/xtask/target/ | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} |