name: Windows Companion 64-bit on: push: branches: - 'main' tags: - v* paths: - '.github/workflows/win_cpn-64.yml' - 'companion/**' - 'tools/build-companion.sh' pull_request: branches: - 'main' paths: - '.github/workflows/win_cpn-64.yml' - 'companion/**' - 'tools/build-companion.sh' workflow_dispatch: env: # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) CMAKE_BUILD_TYPE: "Release" CMAKE_GENERATOR: "Ninja" QT_VERSION: "6.9.0" QT_ARCH: "win64_msvc2022_64" SDL_VERSION: "2.32.8" CXX: "clang++" CC: "clang" jobs: build: # The CMake configure and build commands are platform agnostic and should work equally # well on Windows or Mac. You can convert this to a matrix build if you need # cross-platform coverage. # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix runs-on: windows-latest defaults: run: shell: bash steps: - name: Check out the repo uses: actions/checkout@v4 with: submodules: recursive - name: Install Qt uses: jdpurcell/install-qt-action@v5 env: AQT_CONFIG: ${{ github.workspace }}/tools/aqt-settings.ini with: cache: true cache-key-prefix: 'install-qt-action-${{ env.QT_ARCH }}' version: ${{ env.QT_VERSION }} arch: ${{ env.QT_ARCH }} modules: 'qtmultimedia qtserialport' - name: Setup SDL2 id: setup-sdl2 uses: libsdl-org/setup-sdl@v1 with: version: ${{ env.SDL_VERSION }} build-type: "Release" - name: Install Python Dependencies run: | echo $PATH $Python3_ROOT_DIR/python3.exe -m pip install clang jinja2 lz4 pillow - name: Setup dfu-util and libusb run: | #!/bin/bash set -e echo "Setting up dfu-util and libusb..." # Create target directory mkdir -p dfu-util-0.11 # Download and extract dfu-util echo "Downloading dfu-util binaries..." curl -LO https://dfu-util.sourceforge.net/releases/dfu-util-0.11-binaries.tar.xz tar -xf dfu-util-0.11-binaries.tar.xz cp dfu-util-0.11-binaries/win64/dfu-util.exe dfu-util-0.11/ # Install 7zip if not available if ! command -v 7z &> /dev/null; then echo "Installing 7zip..." sudo apt-get update -qq sudo apt-get install -y p7zip-full fi # Download and extract libusb echo "Downloading libusb..." curl -LO https://github.com/libusb/libusb/releases/download/v1.0.29/libusb-1.0.29.7z 7z x -olibusb-1.0.29 libusb-1.0.29.7z > /dev/null cp libusb-1.0.29/VS2022/MS64/dll/* dfu-util-0.11/ # Clean up temporary files rm -f dfu-util-0.11-binaries.tar.xz libusb-1.0.29.7z rm -rf dfu-util-0.11-binaries libusb-1.0.29 echo "Setup complete. Contents of dfu-util-0.11:" ls -la dfu-util-0.11/ echo "LIBUSB1_ROOT_DIR=$(pwd)/dfu-util-0.11" >> $GITHUB_ENV echo "DFU_UTIL_ROOT_DIR=$(pwd)/dfu-util-0.11" >> $GITHUB_ENV - name: Setup MSVC uses: ilammy/msvc-dev-cmd@v1 - name: Build run: | mkdir output && \ CMAKE_PREFIX_PATH="$QT_ROOT_DIR;$SDL2_ROOT" \ tools/build-companion.sh "$(pwd)" "$(pwd)/output/" - name: Compose release filename # https://stackoverflow.com/questions/58033366/how-to-get-current-branch-within-github-actions run: echo "artifact_name=edgetx-cpn-win64-${GITHUB_REF##*/}" >> $GITHUB_ENV - name: Archive production artifacts uses: actions/upload-artifact@v4 with: name: "${{ env.artifact_name }}" path: ${{github.workspace}}/output retention-days: 15