USBSID-Pico Build Tools #14
This file contains hidden or 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: USBSID-Pico Build Tools | |
| env: | |
| BUILD_THREADS: 4 | |
| BUILD_TYPE: Release | |
| on: | |
| push: | |
| paths: | |
| - "src/examples/config-tool/**" | |
| - "src/examples/send_sid/**" | |
| - ".github/workflows/buildtools.yml" | |
| # Only run on dev branch | |
| branches: [dev] | |
| # Allows you to run this workflow manually from the Actions tab when needed | |
| workflow_dispatch: | |
| # Enables calling from other workflows | |
| workflow_call: | |
| inputs: | |
| force_run: | |
| type: boolean | |
| default: false | |
| jobs: | |
| build-tools: | |
| name: Tools | |
| # Allow if it's NOT a tag OR if it's being called by another workflow/manual dispatch | |
| if: | | |
| inputs.force_run == true || | |
| github.event_name == 'workflow_dispatch' || | |
| (github.event_name == 'push' && !startsWith(github.ref, 'refs/tags/')) | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - { os: ubuntu-latest, shell: bash, | |
| directory: config-tool, buildname: cfg_usbsid } | |
| - { os: ubuntu-latest, shell: bash, | |
| directory: send_sid, buildname: send_sid } | |
| - { os: windows-2022, shell: 'msys2 {0}', | |
| directory: config-tool, buildname: cfg_usbsid.exe } | |
| - { os: windows-2022, shell: 'msys2 {0}', | |
| directory: send_sid, buildname: send_sid.exe } | |
| defaults: | |
| run: | |
| shell: ${{ matrix.shell }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| # Forces checkout of the branch head instead of a specific commit SHA | |
| ref: ${{ github.ref }} | |
| submodules: true | |
| path: repo | |
| - name: Install dependencies (Ubuntu) | |
| if: matrix.os == 'ubuntu-latest' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y pkg-config cmake build-essential libusb-1.0-0 libusb-1.0-0-dev | |
| - name: Set up MSYS2 (Windows) | |
| if: matrix.os == 'windows-2022' | |
| uses: msys2/setup-msys2@v2 | |
| with: | |
| msystem: MINGW64 | |
| update: true | |
| install: >- | |
| mingw-w64-x86_64-gcc | |
| mingw-w64-x86_64-libusb | |
| mingw-w64-x86_64-cmake | |
| mingw-w64-x86_64-pkg-config | |
| mingw-w64-x86_64-ninja | |
| - name: Remove pre-built binaries | |
| run: | | |
| pushd repo/examples/${{ matrix.directory }} | |
| ls -lhai | |
| rm ${{ matrix.buildname }} || true | |
| popd | |
| - name: Configure and build ${{ matrix.buildname }} | |
| run: | | |
| pushd repo/examples/${{ matrix.directory }} | |
| cmake -S . -B build && cmake --build build -j$(nproc) | |
| ls -lhai | |
| popd | |
| - name: Upload | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.buildname }}-${{ matrix.os }} | |
| path: | | |
| repo/examples/${{ matrix.directory }}/${{ matrix.buildname }} | |
| ${{ matrix.os == 'windows-2022' && format('repo/examples/{0}/*.dll', matrix.directory) || '' }} | |
| if-no-files-found: ignore |