|
| 1 | +name: Gem Build Check (cross-platform) |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + ruby-version: |
| 7 | + description: 'Ruby version to test' |
| 8 | + required: false |
| 9 | + default: '3.4' |
| 10 | + type: choice |
| 11 | + options: |
| 12 | + - '3.3' |
| 13 | + - '3.4' |
| 14 | + - '4.0' |
| 15 | + |
| 16 | +concurrency: |
| 17 | + group: "${{ github.workflow }} @ ${{ github.head_ref || github.ref }}" |
| 18 | + cancel-in-progress: true |
| 19 | + |
| 20 | +jobs: |
| 21 | + build-linux: |
| 22 | + name: "Build gem (Linux / Ruby ${{ inputs.ruby-version || '3.4' }})" |
| 23 | + runs-on: ubuntu-latest |
| 24 | + defaults: |
| 25 | + run: |
| 26 | + working-directory: ruby/smalruby3 |
| 27 | + steps: |
| 28 | + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5 |
| 29 | + |
| 30 | + - name: Install SDL2 development libraries |
| 31 | + run: | |
| 32 | + sudo apt-get update |
| 33 | + sudo apt-get install -y libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-ttf-dev |
| 34 | +
|
| 35 | + - name: Install Rust toolchain |
| 36 | + uses: dtolnay/rust-toolchain@stable |
| 37 | + |
| 38 | + - uses: ruby/setup-ruby@v1 |
| 39 | + with: |
| 40 | + ruby-version: ${{ inputs.ruby-version || '3.4' }} |
| 41 | + bundler-cache: true |
| 42 | + working-directory: ruby/smalruby3 |
| 43 | + |
| 44 | + - name: Build gem |
| 45 | + run: gem build smalruby3.gemspec |
| 46 | + |
| 47 | + - name: Install gem locally |
| 48 | + run: gem install --local smalruby3-*.gem --no-document |
| 49 | + |
| 50 | + - name: Compile native extension |
| 51 | + run: bundle exec rake compile |
| 52 | + |
| 53 | + - name: Run tests |
| 54 | + run: bundle exec rake test |
| 55 | + |
| 56 | + - name: Verify smalruby3 loads |
| 57 | + run: ruby -r smalruby3 -e 'puts "smalruby3 v#{Smalruby3::VERSION} loaded OK"' |
| 58 | + |
| 59 | + - name: Upload gem artifact |
| 60 | + uses: actions/upload-artifact@v4 |
| 61 | + with: |
| 62 | + name: smalruby3-gem-linux |
| 63 | + path: ruby/smalruby3/smalruby3-*.gem |
| 64 | + |
| 65 | + build-windows: |
| 66 | + name: "Build gem (Windows / Ruby ${{ inputs.ruby-version || '3.4' }})" |
| 67 | + runs-on: windows-latest |
| 68 | + defaults: |
| 69 | + run: |
| 70 | + working-directory: ruby/smalruby3 |
| 71 | + steps: |
| 72 | + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5 |
| 73 | + |
| 74 | + - name: Install SDL2 via MSYS2 |
| 75 | + uses: msys2/setup-msys2@v2 |
| 76 | + with: |
| 77 | + msystem: UCRT64 |
| 78 | + update: true |
| 79 | + install: >- |
| 80 | + mingw-w64-ucrt-x86_64-SDL2 |
| 81 | + mingw-w64-ucrt-x86_64-SDL2_image |
| 82 | + mingw-w64-ucrt-x86_64-SDL2_mixer |
| 83 | + mingw-w64-ucrt-x86_64-SDL2_ttf |
| 84 | +
|
| 85 | + - name: Install Rust toolchain |
| 86 | + uses: dtolnay/rust-toolchain@stable |
| 87 | + |
| 88 | + - uses: ruby/setup-ruby@v1 |
| 89 | + with: |
| 90 | + ruby-version: ${{ inputs.ruby-version || '3.4' }} |
| 91 | + bundler-cache: true |
| 92 | + working-directory: ruby/smalruby3 |
| 93 | + |
| 94 | + - name: Add MSYS2 to PATH |
| 95 | + shell: bash |
| 96 | + run: echo "C:/msys64/ucrt64/bin" >> "$GITHUB_PATH" |
| 97 | + |
| 98 | + - name: Build gem |
| 99 | + run: gem build smalruby3.gemspec |
| 100 | + |
| 101 | + - name: Compile native extension |
| 102 | + shell: bash |
| 103 | + env: |
| 104 | + CPATH: C:/msys64/ucrt64/include |
| 105 | + LIBRARY_PATH: C:/msys64/ucrt64/lib |
| 106 | + PKG_CONFIG_PATH: C:/msys64/ucrt64/lib/pkgconfig |
| 107 | + run: bundle exec rake compile |
| 108 | + |
| 109 | + - name: Run tests |
| 110 | + shell: bash |
| 111 | + env: |
| 112 | + CPATH: C:/msys64/ucrt64/include |
| 113 | + LIBRARY_PATH: C:/msys64/ucrt64/lib |
| 114 | + PKG_CONFIG_PATH: C:/msys64/ucrt64/lib/pkgconfig |
| 115 | + run: bundle exec rake test |
| 116 | + |
| 117 | + - name: Verify smalruby3 loads |
| 118 | + run: ruby -r smalruby3 -e "puts \"smalruby3 v#{Smalruby3::VERSION} loaded OK\"" |
| 119 | + |
| 120 | + - name: Upload gem artifact |
| 121 | + uses: actions/upload-artifact@v4 |
| 122 | + with: |
| 123 | + name: smalruby3-gem-windows |
| 124 | + path: ruby/smalruby3/smalruby3-*.gem |
0 commit comments