|
| 1 | +name: USBSID-Pico Build Tools |
| 2 | + |
| 3 | +env: |
| 4 | + BUILD_THREADS: 4 |
| 5 | + BUILD_TYPE: Release |
| 6 | + |
| 7 | +on: |
| 8 | + push: |
| 9 | + paths: |
| 10 | + - "src/examples/config-tool/**" |
| 11 | + - "src/examples/send_sid/**" |
| 12 | + - ".github/workflows/buildtools.yml" |
| 13 | + # Only run on dev branch |
| 14 | + branches: [dev] |
| 15 | + # Allows you to run this workflow manually from the Actions tab when needed |
| 16 | + workflow_dispatch: |
| 17 | + |
| 18 | +jobs: |
| 19 | + build-tools: |
| 20 | + name: Build config-tool and send_sid |
| 21 | + runs-on: ${{ matrix.os }} |
| 22 | + if: ${{ ! startsWith(github.ref, 'refs/tags/') }} |
| 23 | + strategy: |
| 24 | + matrix: |
| 25 | + os: [ubuntu-latest, windows-2022] |
| 26 | + include: |
| 27 | + - { |
| 28 | + buildname: cfg_tool, |
| 29 | + directory: config-tool, |
| 30 | + } |
| 31 | + - { |
| 32 | + buildname: send_sid, |
| 33 | + directory: send_sid, |
| 34 | + } |
| 35 | + |
| 36 | + fail-fast: false |
| 37 | + |
| 38 | + steps: |
| 39 | + - name: Checkout repository |
| 40 | + uses: actions/checkout@v4 |
| 41 | + with: |
| 42 | + submodules: true |
| 43 | + path: master |
| 44 | + |
| 45 | + - name: Install dependencies (Ubuntu) |
| 46 | + if: matrix.os == 'ubuntu-latest' |
| 47 | + run: | |
| 48 | + sudo apt-get update |
| 49 | + sudo apt-get install -y pkg-config cmake build-essential libusb-1.0-0 libusb-1.0-0-dev |
| 50 | +
|
| 51 | + - name: Set up MSYS2 (Windows) |
| 52 | + if: matrix.os == 'windows-2022' |
| 53 | + uses: msys2/setup-msys2@v2 |
| 54 | + with: |
| 55 | + msystem: MINGW64 |
| 56 | + update: true |
| 57 | + install: >- |
| 58 | + mingw-w64-x86_64-gcc |
| 59 | + mingw-w64-x86_64-libusb |
| 60 | + mingw-w64-x86_64-cmake |
| 61 | + mingw-w64-x86_64-pkg-config |
| 62 | + mingw-w64-x86_64-ninja |
| 63 | +
|
| 64 | + # Unified Build Step |
| 65 | + - name: Configure and Build |
| 66 | + shell: ${{ matrix.os == 'windows-2022' && 'msys2 {0}' || 'bash' }} |
| 67 | + run: | |
| 68 | + pushd master/examples/${{ matrix.directory }} |
| 69 | + cmake -S . -B build && cmake --build build -j$(nproc) |
| 70 | + popd |
| 71 | +
|
| 72 | + - name: Upload |
| 73 | + uses: actions/upload-artifact@v4 |
| 74 | + with: |
| 75 | + name: binary-${{ matrix.os }} |
| 76 | + path: | |
| 77 | + master/examples/${{ matrix.directory }}/${{ matrix.buildname }} |
| 78 | + master/examples/${{ matrix.directory }}/${{ matrix.buildname }}.exe |
0 commit comments