Disable Defender in Windows runners #124
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
name: Build Workspace | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- 'v[0-9]+.[0-9]+.[0-9]+' | |
workflow_dispatch: | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
build-linux: | |
runs-on: ubuntu-20.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 run --bin build-plugin -- --release | |
- name: Archive Linux OpenFX plugin | |
uses: actions/upload-artifact@v3 | |
if: ${{ github.ref_type == 'tag' }} | |
with: | |
name: ntsc-rs-linux-openfx | |
path: crates/openfx-plugin/build/ | |
- name: Archive Linux binary | |
uses: actions/upload-artifact@v3 | |
if: ${{ github.ref_type == 'tag' }} | |
with: | |
name: ntsc-rs-linux-standalone | |
path: target/release/ntsc-rs-standalone | |
build-windows: | |
runs-on: windows-2019 | |
steps: | |
- name: Disable Defender | |
run: Set-MpPreference -DisableRealtimeMonitoring $true | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- 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 }} | |
key: 'this should never hit' | |
restore-keys: choco-${{ github.job }}- | |
- name: Install gstreamer | |
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 }} | |
key: choco-${{ github.job }}-${{ hashFiles(format('{0}\**\*', env.CHOCO_TEMP)) }} | |
- uses: Swatinem/rust-cache@v2 | |
- name: Build | |
run: cargo build --release --workspace | |
- name: Build OpenFX plugin | |
run: cargo run --bin build-plugin -- --release | |
- name: Archive Windows OpenFX plugin | |
uses: actions/upload-artifact@v3 | |
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' }} | |
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 } | |
cp ..\target\release\ntsc-rs-standalone.exe .\bin\ | |
cp ..\target\release\ntsc-rs-launcher.exe .\ | |
- name: Archive Windows binary | |
uses: actions/upload-artifact@v3 | |
if: ${{ github.ref_type == 'tag' }} | |
with: | |
name: ntsc-rs-windows-standalone | |
path: ntsc-rs-windows-standalone | |
build-ae-plugin: | |
runs-on: windows-2019 | |
steps: | |
- name: Disable Defender | |
run: Set-MpPreference -DisableRealtimeMonitoring $true | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
- 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 }} | |
key: 'this should never hit' | |
restore-keys: choco-${{ github.job }}- | |
- name: Setup | |
run: | | |
python -m pip install meson ninja | |
meson --version | |
$env:PATH = "C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\ProgramData\chocolatey\bin" | |
[Environment]::SetEnvironmentVariable("Path", $env:PATH, "Machine") | |
choco install gpg4win | |
echo "C:\Program Files (x86)\Gpg4win\..\GnuPG\bin" >> $env:GITHUB_PATH | |
- name: Save Chocolatey cache | |
id: choco-cache-save | |
uses: actions/cache/save@v4 | |
with: | |
path: ${{ env.CHOCO_TEMP }} | |
key: choco-${{ github.job }}-${{ hashFiles(format('{0}\**\*', env.CHOCO_TEMP)) }} | |
- name: Get SDK | |
env: | |
WIN_SDK_KEY: ${{ secrets.WIN_SDK_KEY }} | |
run: | | |
git fetch origin blobs | |
git checkout origin/blobs -- sdkwin.zip.gpg | |
gpg --quiet --batch --yes --decrypt --passphrase="$Env:WIN_SDK_KEY" --output=sdkwin.zip sdkwin.zip.gpg | |
Expand-Archive sdkwin.zip .\ae-plugin\sdk\ | |
mv '.\ae-plugin\sdk\Adobe After Effects CC 15.0 Win SDK\*' .\ae-plugin\sdk\ | |
- name: Prepare MSVC | |
uses: bus1/cabuild/action/msdevshell@v1 | |
with: | |
architecture: x64 | |
- uses: Swatinem/rust-cache@v2 | |
- name: Build | |
run: | | |
cd .\ae-plugin | |
meson setup build | |
cd build | |
meson configure --buildtype=release | |
meson compile | |
- name: Archive Windows AE plugin | |
uses: actions/upload-artifact@v3 | |
if: ${{ github.ref_type == 'tag' }} | |
with: | |
name: ntsc-rs-windows-afterfx | |
path: ae-plugin/build/ntsc-rs-ae.aex | |
release: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
needs: | |
- build-windows | |
- build-linux | |
- build-ae-plugin | |
if: ${{ github.ref_type == 'tag' }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Download artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
path: ./artifacts | |
- name: Zip artifacts | |
run: for dir in */; 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-*-standalone.zip,./artifacts/ntsc-rs-*-openfx.zip,./artifacts/ntsc-rs-*-afterfx.zip" | |
draft: true |