name: Build CCExtractor on Windows env: RUSTFLAGS: -Ctarget-feature=+crt-static VCPKG_COMMIT: ab2977be50c702126336e5088f4836060733c899 on: workflow_dispatch: push: paths: - ".github/workflows/build_windows.yml" - "**.c" - "**.h" - "**CMakeLists.txt" - "**.cmake" - "windows/**" - "src/rust/**" pull_request: types: [opened, synchronize, reopened] paths: - ".github/workflows/build_windows.yml" - "**.c" - "**.h" - "**CMakeLists.txt" - "**.cmake" - "windows/**" - "src/rust/**" jobs: build: runs-on: windows-2022 strategy: fail-fast: false matrix: include: - arch: x64 platform: x64 vcpkg_triplet: x64-windows-static rust_target: x86_64-pc-windows-msvc gpac_install: "C:\\Program Files\\GPAC" outdir: "x64/" - arch: x86 platform: Win32 vcpkg_triplet: x86-windows-static rust_target: i686-pc-windows-msvc gpac_install: "C:\\Program Files (x86)\\GPAC" outdir: "" steps: - name: Check out repository uses: actions/checkout@v6 - name: Setup MSBuild.exe uses: microsoft/setup-msbuild@v2.0.0 with: msbuild-architecture: x64 # Install GPAC (fast, ~30s, not worth caching complexity) - name: Install gpac run: choco install gpac --version 2.4.0 --no-progress ${{ matrix.arch == 'x86' && '--forcex86' || '' }} # Use lukka/run-vcpkg for better caching - name: Setup vcpkg uses: lukka/run-vcpkg@v11 id: runvcpkg with: vcpkgGitCommitId: ${{ env.VCPKG_COMMIT }} vcpkgDirectory: ${{ github.workspace }}/vcpkg vcpkgJsonGlob: 'windows/vcpkg.json' # Cache vcpkg installed packages separately for faster restores - name: Cache vcpkg installed packages id: vcpkg-installed-cache uses: actions/cache@v5 with: path: ${{ github.workspace }}/vcpkg/installed key: vcpkg-installed-${{ runner.os }}-${{ matrix.vcpkg_triplet }}-${{ env.VCPKG_COMMIT }}-${{ hashFiles('windows/vcpkg.json') }} restore-keys: | vcpkg-installed-${{ runner.os }}-${{ matrix.vcpkg_triplet }}-${{ env.VCPKG_COMMIT }}- - name: Install vcpkg dependencies if: steps.vcpkg-installed-cache.outputs.cache-hit != 'true' run: ${{ github.workspace }}/vcpkg/vcpkg.exe install --triplet ${{ matrix.vcpkg_triplet }} --x-install-root ${{ github.workspace }}/vcpkg/installed/ working-directory: windows # Cache Rust/Cargo artifacts - name: Cache Cargo registry uses: actions/cache@v5 with: path: | ~/.cargo/registry ~/.cargo/git key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} restore-keys: | ${{ runner.os }}-cargo-registry- # Cache Cargo build artifacts - rust.bat sets CARGO_TARGET_DIR to windows/ - name: Cache Cargo build artifacts uses: actions/cache@v5 with: path: ${{ github.workspace }}/windows/${{ matrix.rust_target }} key: ${{ runner.os }}-${{ matrix.arch }}-cargo-build-${{ hashFiles('**/Cargo.lock') }}-${{ hashFiles('src/rust/**/*.rs') }} restore-keys: | ${{ runner.os }}-${{ matrix.arch }}-cargo-build-${{ hashFiles('**/Cargo.lock') }}- ${{ runner.os }}-${{ matrix.arch }}-cargo-build- - name: Setup Rust toolchain uses: dtolnay/rust-toolchain@stable with: targets: ${{ matrix.rust_target }} - name: Install Win 10 SDK uses: ilammy/msvc-dev-cmd@v1 with: arch: ${{ matrix.arch }} # Build Release-Full (min Rust — C paths where available) - name: Build Release-Full (min Rust) env: LIBCLANG_PATH: "C:\\Program Files\\LLVM\\lib" LLVM_CONFIG_PATH: "C:\\Program Files\\LLVM\\bin\\llvm-config" BINDGEN_EXTRA_CLANG_ARGS: -fmsc-version=0 VCPKG_ROOT: ${{ github.workspace }}/vcpkg VCPKG_DEFAULT_TRIPLET: ${{ matrix.vcpkg_triplet }} run: msbuild ccextractor.sln /p:Configuration=Release-Full /p:Platform=${{ matrix.platform }} /p:GpacDir="${{ matrix.gpac_install }}" /p:ExtraDefines=DISABLE_RUST working-directory: ./windows - name: Display Release version information if: matrix.arch == 'x64' run: ./ccextractorwinfull.exe --version working-directory: ./windows/${{ matrix.outdir }}Release-Full # NOTE: The sample-platform test runner (CCExtractor/sample-platform) # matches artifact names exactly. Update Artifact_names in # mod_ci/controllers.py there if you rename these artifacts. - name: Upload Release artifact uses: actions/upload-artifact@v7 with: name: CCExtractor Windows ${{ matrix.arch }} Release build path: | ./windows/${{ matrix.outdir }}Release-Full/ccextractorwinfull.exe ./windows/${{ matrix.outdir }}Release-Full/*.dll # Build Release-Full (with migrations — max Rust) - name: Build Release-Full (with migrations) env: LIBCLANG_PATH: "C:\\Program Files\\LLVM\\lib" LLVM_CONFIG_PATH: "C:\\Program Files\\LLVM\\bin\\llvm-config" BINDGEN_EXTRA_CLANG_ARGS: -fmsc-version=0 VCPKG_ROOT: ${{ github.workspace }}/vcpkg VCPKG_DEFAULT_TRIPLET: ${{ matrix.vcpkg_triplet }} run: msbuild ccextractor.sln /t:Rebuild /p:Configuration=Release-Full /p:Platform=${{ matrix.platform }} /p:GpacDir="${{ matrix.gpac_install }}" working-directory: ./windows - name: Upload Release artifact (with migrations) uses: actions/upload-artifact@v7 with: name: CCExtractor Windows ${{ matrix.arch }} Release build (with migrations) path: | ./windows/${{ matrix.outdir }}Release-Full/ccextractorwinfull.exe ./windows/${{ matrix.outdir }}Release-Full/*.dll # Build Debug-Full (reuses cached Cargo artifacts) - name: Build Debug-Full env: LIBCLANG_PATH: "C:\\Program Files\\LLVM\\lib" LLVM_CONFIG_PATH: "C:\\Program Files\\LLVM\\bin\\llvm-config" BINDGEN_EXTRA_CLANG_ARGS: -fmsc-version=0 VCPKG_ROOT: ${{ github.workspace }}/vcpkg VCPKG_DEFAULT_TRIPLET: ${{ matrix.vcpkg_triplet }} run: msbuild ccextractor.sln /p:Configuration=Debug-Full /p:Platform=${{ matrix.platform }} /p:GpacDir="${{ matrix.gpac_install }}" working-directory: ./windows - name: Display Debug version information if: matrix.arch == 'x64' continue-on-error: true run: ./ccextractorwinfull.exe --version working-directory: ./windows/${{ matrix.outdir }}Debug-Full - name: Upload Debug artifact uses: actions/upload-artifact@v7 with: name: CCExtractor Windows ${{ matrix.arch }} Debug build path: | ./windows/${{ matrix.outdir }}Debug-Full/ccextractorwinfull.exe ./windows/${{ matrix.outdir }}Debug-Full/ccextractorwinfull.pdb ./windows/${{ matrix.outdir }}Debug-Full/*.dll