Skip to content

Replace deprecated id_source usage #325

Replace deprecated id_source usage

Replace deprecated id_source usage #325

name: Build Workspace
on:
push:
branches:
- main
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
- 'v[0-9]+.[0-9]+.[0-9]+-*'
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
jobs:
build-linux:
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install gstreamer
uses: awalsh128/cache-apt-pkgs-action@v1
with:
packages: libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libatk1.0-dev libgtk-3-dev
version: 2.0
- uses: Swatinem/rust-cache@v2
- name: Build
run: cargo build --release --workspace
- name: Build OpenFX plugin
run: cargo xtask build-ofx-plugin --release
- name: Archive Linux OpenFX plugin
uses: actions/upload-artifact@v4
if: ${{ github.ref_type == 'tag' }}
with:
name: ntsc-rs-linux-openfx
path: crates/openfx-plugin/build/
- name: Archive Linux binary
uses: actions/upload-artifact@v4
if: ${{ github.ref_type == 'tag' }}
with:
name: ntsc-rs-linux-standalone
path: target/release/ntsc-rs-standalone
build-windows:
runs-on: windows-2019
steps:
# This is an attempt to make the Windows CI image faster. Not sure if it works.
- name: Disable Defender
run: Set-MpPreference -DisableRealtimeMonitoring $true
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
# Put the Chocolatey temp directory in a place where we can use the cache action to save and restore it.
- name: Set chocolatey temp directory
run: |
choco config set cacheLocation --value "$Env:GITHUB_WORKSPACE\chocolatey_cache"
echo "CHOCO_TEMP=$Env:GITHUB_WORKSPACE\chocolatey_cache" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
- name: Restore Chocolatey cache
id: choco-cache-restore
uses: actions/cache/restore@v4
with:
path: ${{ env.CHOCO_TEMP }}
# TODO: Why did I set up the cache key like this?
key: 'this should never hit'
restore-keys: choco-${{ github.job }}-
- name: Install gstreamer
# Some things to note:
# - GStreamer adds some environment variables, which we need to pick up.
# - GSTREAMER_1_0_ROOT_MSVC_X86_64 cannot be hardcoded because it can be installed on different drive letters,
# seemingly chosen at random.
# - We need to export said path to the environment variables so that later steps can use it.
run: |
choco install gstreamer gstreamer-devel
Import-Module $env:ChocolateyInstall\helpers\chocolateyProfile.psm1
refreshenv
echo "$($Env:GSTREAMER_1_0_ROOT_MSVC_X86_64)bin"
echo "$($Env:GSTREAMER_1_0_ROOT_MSVC_X86_64)bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
echo "GSTREAMER_1_0_ROOT_MSVC_X86_64=$Env:GSTREAMER_1_0_ROOT_MSVC_X86_64" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Save Chocolatey cache
id: choco-cache-save
uses: actions/cache/save@v4
with:
path: ${{ env.CHOCO_TEMP }}
# TODO: Pretty sure I'm misunderstanding the point of hashFiles here.
key: choco-${{ github.job }}-${{ hashFiles(format('{0}\**\*', env.CHOCO_TEMP)) }}
- uses: Swatinem/rust-cache@v2
- name: Build GUI
run: cargo build --release -p gui
- name: Build OpenFX plugin
run: cargo xtask build-ofx-plugin --release
- name: Build After Effects plugin
run: |
cargo build --release -p ae-plugin
cp target\release\ae_plugin.dll .\ntsc-rs-ae.aex
- name: Archive Windows OpenFX plugin
uses: actions/upload-artifact@v4
if: ${{ github.ref_type == 'tag' }}
with:
name: ntsc-rs-windows-openfx
path: crates/openfx-plugin/build/
- name: Package Windows binary
if: ${{ github.ref_type == 'tag' }}
# Some things to note:
# - Robocopy has a non-zero exit code even when successful. We therefore clear it to 0 so that Actions doesn't
# fail.
run: |
mkdir ntsc-rs-windows-standalone
cd ntsc-rs-windows-standalone
robocopy $Env:GSTREAMER_1_0_ROOT_MSVC_X86_64 .\ *.dll /s /copy:DT; if ($lastexitcode -lt 8) { $global:LASTEXITCODE = $null }
robocopy $Env:GSTREAMER_1_0_ROOT_MSVC_X86_64\share\licenses .\licenses /s /copy:DT; if ($lastexitcode -lt 8) { $global:LASTEXITCODE = $null }
cp ..\target\release\ntsc-rs-standalone.exe .\bin\
cp ..\target\release\ntsc-rs-launcher.exe .\
- name: Archive Windows binary
uses: actions/upload-artifact@v4
if: ${{ github.ref_type == 'tag' }}
with:
name: ntsc-rs-windows-standalone
path: ntsc-rs-windows-standalone
- name: Archive Windows After Effects plugin
uses: actions/upload-artifact@v4
if: ${{ github.ref_type == 'tag' }}
with:
name: ntsc-rs-windows-afterfx
path: .\ntsc-rs-ae.aex
build-macos:
runs-on: macos-14
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Set deployment target
run: echo 'MACOSX_DEPLOYMENT_TARGET=10.12' >> $GITHUB_ENV
- name: Add x86_64 target
run: |
rustup target add x86_64-apple-darwin
- name: Install packages
run: |
brew install --cask gstreamer-runtime
brew install --cask gstreamer-development
- name: Setup GStreamer devel
run: |
echo "/Library/Frameworks/GStreamer.framework/Versions/1.0/bin" >> $GITHUB_PATH
echo 'PKG_CONFIG_PATH="/Library/Frameworks/GStreamer.framework/Versions/1.0/lib/pkgconfig"' >> $GITHUB_ENV
- uses: Swatinem/rust-cache@v2
- name: Build standalone app
run: cargo xtask macos-bundle --release --destdir=build/ntsc-rs-standalone
- name: Build OpenFX plugin
run: cargo xtask build-ofx-plugin --macos-universal --release --destdir=build/ntsc-rs-openfx
- name: Build After Effects plugin
run: cargo xtask macos-ae-plugin --macos-universal --release --destdir=build/ntsc-rs-afterfx
- name: Create .pkg installers for bundles
if: ${{ github.ref_type == 'tag' }}
# Using the "latest" compression setting is slower (50 seconds vs 25ish) but results in a smaller file
# (around 120MB vs around 180MB).
run: |
pkgbuild --install-location /Applications --component build/ntsc-rs-standalone/ntsc-rs.app --min-os-version $MACOSX_DEPLOYMENT_TARGET --compression latest build/ntsc-rs-macos-standalone.pkg
pkgbuild --install-location /Library/OFX/Plugins --component build/ntsc-rs-openfx/NtscRs.ofx.bundle --min-os-version $MACOSX_DEPLOYMENT_TARGET --compression latest build/ntsc-rs-macos-openfx.pkg
pkgbuild --install-location "/Library/Application Support/Adobe/Common/Plug-ins/7.0/MediaCore" --component build/ntsc-rs-afterfx/ntsc-rs.plugin --min-os-version $MACOSX_DEPLOYMENT_TARGET --compression latest build/ntsc-rs-macos-afterfx.pkg
- name: Archive .pkg installers
uses: actions/upload-artifact@v4
if: ${{ github.ref_type == 'tag' }}
with:
name: ntsc-rs-macos
path: build/ntsc-rs-*.pkg
# TODO: sign bundles
release:
runs-on: ubuntu-latest
permissions:
contents: write
needs:
- build-windows
- build-macos
- build-linux
if: ${{ github.ref_type == 'tag' }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: ./artifacts
- name: Zip Windows/Linux artifacts
run: |
shopt -s extglob
for dir in ntsc-rs-@(windows|linux)*/; do zip -r "${dir%/}.zip" "${dir%/}"; done
working-directory: ./artifacts
- name: Display structure of downloaded files
run: ls -l
working-directory: ./artifacts
- name: Create release
uses: ncipollo/release-action@v1
with:
artifacts: "./artifacts/ntsc-rs-*.zip,./artifacts/ntsc-rs-macos/ntsc-rs-*.pkg"
draft: true