From 3d3f333b640268ed1c6517f09a4f60feff8dd39f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADtor=20Vasconcellos?= Date: Sat, 28 Oct 2023 21:25:26 -0300 Subject: [PATCH] Fix Windows CI (#1695) * Add Nasm to setup.ps1 - Nasm is now required to compile the `openssl-sys` crate * Run Clippy CI when setup or prep scripts change * Ensure nasm is also installed in Windows CI - Add nasm to setup.sh - Remove openssl-dev from setup.sh * Ensure nasm is installed in macOS too * Dumb ctrl+c/ctrl+v mistake * 's/==/=/' --- .github/actions/setup-system/action.yml | 4 ++++ .github/workflows/ci.yml | 2 ++ scripts/setup.ps1 | 11 ++++++++- scripts/setup.sh | 30 +++++++++++++------------ 4 files changed, 32 insertions(+), 15 deletions(-) diff --git a/.github/actions/setup-system/action.yml b/.github/actions/setup-system/action.yml index 678fe3b12..f14eb6275 100644 --- a/.github/actions/setup-system/action.yml +++ b/.github/actions/setup-system/action.yml @@ -42,6 +42,10 @@ runs: key: ${{ steps.cache-llvm-restore.outputs.cache-primary-key }} path: C:/Program Files/LLVM + - name: Install Nasm + if: ${{ runner.os != 'Linux' }} + uses: ilammy/setup-nasm@v1 + - name: Setup Rust and Dependencies uses: ./.github/actions/setup-rust with: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index abf1276f4..61d0362be 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -125,6 +125,8 @@ jobs: with: filters: | changes: + - ${{ runner.os == 'Windows' && 'scripts/setup.ps1' || 'scripts/setup.sh' }} + - 'scripts/preprep.mjs' - 'apps/cli/*/**' - 'apps/desktop/crates/*/**' - 'apps/desktop/src-tauri/*/**' diff --git a/scripts/setup.ps1 b/scripts/setup.ps1 index 9ab1902bd..299f364c3 100644 --- a/scripts/setup.ps1 +++ b/scripts/setup.ps1 @@ -101,7 +101,7 @@ https://learn.microsoft.com/windows/package-manager/winget/ } # Check system winget version is greater or equal to v1.4.10052 - $wingetVersion = [Version]((winget --version) -replace '.*?(\d+)\.(\d+)\.(\d+).*', '$1.$2.$3') + $wingetVersion = [Version]((winget --version) -replace '.*?(\d+)\.(\d+)\.(\d+).*', '$1.$2.$3') $requiredVersion = [Version]'1.4.10052' if ($wingetVersion.CompareTo($requiredVersion) -lt 0) { $errorMessage = "You need to update your winget to version $requiredVersion or higher." @@ -152,6 +152,15 @@ https://learn.microsoft.com/windows/package-manager/winget/ $LASTEXITCODE = 0 } + Write-Host + Write-Host 'Installing Nasm...' -ForegroundColor Yellow + winget install -e --accept-source-agreements --disable-interactivity --id NASM.NASM + if (-not ($wingetValidExit -contains $LASTEXITCODE)) { + Exit-WithError 'Failed to install Nasm' + } else { + $LASTEXITCODE = 0 + } + Write-Host Write-Host 'Installing Strawberry perl...' -ForegroundColor Yellow winget install -e --accept-source-agreements --disable-interactivity --id StrawberryPerl.StrawberryPerl diff --git a/scripts/setup.sh b/scripts/setup.sh index 67857041a..a5e7ca32b 100755 --- a/scripts/setup.sh +++ b/scripts/setup.sh @@ -101,6 +101,13 @@ fi # Install system deps case "$(uname)" in "Darwin") + if [ "$(uname -m)" = 'x86_64' ]; then ( + if [ "${CI:-}" = "true" ]; then + export NONINTERACTIVE=1 + fi + brew install nasm + ); fi + # Install rust deps for iOS if [ $MOBILE -eq 1 ]; then echo "Checking for Xcode..." @@ -124,7 +131,7 @@ case "$(uname)" in echo "Installing dependencies with apt..." # Tauri dependencies - set -- build-essential curl wget file patchelf libssl-dev libgtk-3-dev librsvg2-dev \ + set -- build-essential curl wget file patchelf openssl libssl-dev libgtk-3-dev librsvg2-dev \ libwebkit2gtk-4.0-dev libayatana-appindicator3-dev # FFmpeg dependencies @@ -138,8 +145,8 @@ case "$(uname)" in gstreamer1.0-vaapi libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev \ libgstreamer-plugins-bad1.0-dev - # Bindgen dependencies - it's used by a dependency of Spacedrive - set -- "$@" llvm-dev libclang-dev clang + # C/C++ build dependencies, required to build some *-sys crates + set -- "$@" llvm-dev libclang-dev clang nasm sudo apt-get -y update sudo apt-get -y install "$@" @@ -157,9 +164,9 @@ case "$(uname)" in set -- "$@" gst-libav gst-plugins-bad gst-plugins-base gst-plugins-good gst-plugins-ugly \ gst-plugin-pipewire gstreamer-vaapi - # Bindgen dependencies - it's used by a dependency of Spacedrive - set -- "$@" clang - + # C/C++ build dependencies, required to build some *-sys crates + set -- "$@" clang nasm + # React dependencies set -- "$@" libvips @@ -183,9 +190,7 @@ case "$(uname)" in fi # Tauri dependencies - # openssl is manually declared here as i don't think openssl and openssl-devel are actually dependant on eachother - # openssl also has a habit of being missing from some of my fresh Fedora installs - i've had to install it at least twice - set -- openssl openssl-devel curl wget file patchelf libappindicator-gtk3-devel librsvg2-devel + set -- openssl curl wget file patchelf libappindicator-gtk3-devel librsvg2-devel # Webkit2gtk requires gstreamer plugins for video playback to work set -- "$@" gstreamer1-devel gstreamer1-plugins-base-devel \ @@ -194,8 +199,8 @@ case "$(uname)" in gstreamer1-plugins-bad-free gstreamer1-plugins-bad-free-devel \ gstreamer1-plugins-bad-free-extras - # Bindgen dependencies - it's used by a dependency of Spacedrive - set -- "$@" clang clang-devel + # C/C++ build dependencies, required to build some *-sys crates + set -- "$@" clang clang-devel nasm sudo dnf install "$@" @@ -205,9 +210,6 @@ case "$(uname)" in 'This is likely because the RPM Fusion free repository is not enabled.' \ 'https://docs.fedoraproject.org/en-US/quick-docs/setup_rpmfusion' fi - - # required for building the openssl-sys crate - # perl-FindBin perl-File-Compare perl-IPC-Cmd perl-File-Copy else if has lsb_release; then _distro="'$(lsb_release -s -d)' "