name: Bindings on: [push, pull_request] jobs: test-windows: runs-on: windows-latest steps: - uses: actions/checkout@v4 - name: test_win run: | cd tests test_win.cmd shell: cmd test-mac: runs-on: macos-latest steps: - uses: actions/checkout@v4 - uses: seanmiddleditch/gha-setup-ninja@master - name: test_macos run: | cd tests ./test_macos.sh test-linux: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: seanmiddleditch/gha-setup-ninja@master - name: prepare run: | sudo apt-get update sudo apt-get install libgl1-mesa-dev libegl1-mesa-dev mesa-common-dev xorg-dev libasound-dev - name: test_linux run: | cd tests ./test_linux.sh gen-bindings: needs: [ test-windows, test-mac, test-linux ] runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/checkout@v4 with: repository: floooh/sokol-zig path: bindgen/sokol-zig - uses: actions/checkout@v4 with: repository: floooh/sokol-nim path: bindgen/sokol-nim - uses: actions/checkout@v4 with: repository: floooh/sokol-odin path: bindgen/sokol-odin - uses: actions/checkout@v4 with: repository: floooh/sokol-rust path: bindgen/sokol-rust - name: generate run: | cd bindgen python3 gen_all.py - name: upload-zig-artifact uses: actions/upload-artifact@v4 with: name: ignore-me-zig retention-days: 1 path: bindgen/sokol-zig/src/sokol - name: upload-nim-artifact uses: actions/upload-artifact@v4 with: name: ignore-me-nim retention-days: 1 path: bindgen/sokol-nim/src/sokol - name: upload-odin-artifact uses: actions/upload-artifact@v4 with: name: ignore-me-odin retention-days: 1 path: | bindgen/sokol-odin/sokol bindgen/sokol-odin/c - name: upload-rust-artifact uses: actions/upload-artifact@v4 with: name: ignore-me-rust retention-days: 1 path: bindgen/sokol-rust/src test-zig: needs: gen-bindings strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest] runs-on: ${{matrix.os}} steps: - uses: actions/checkout@v4 with: repository: floooh/sokol-zig - uses: goto-bus-stop/setup-zig@v2 - uses: actions/download-artifact@v4 with: name: ignore-me-zig path: src/sokol - name: prepare if: runner.os == 'Linux' run: | sudo apt-get update sudo apt-get install libgl1-mesa-dev libegl1-mesa-dev mesa-common-dev xorg-dev libasound-dev - name: build run: zig build test-nim: needs: gen-bindings strategy: fail-fast: false matrix: #os: [ubuntu-latest, macos-latest, windows-latest] os: [ubuntu-latest, macos-latest ] runs-on: ${{matrix.os}} steps: - uses: jiro4989/setup-nim-action@v1 with: nim-version: '2.x' repo-token: ${{ secrets.GITHUB_TOKEN }} - uses: actions/checkout@v4 with: repository: floooh/sokol-nim - uses: actions/download-artifact@v4 with: name: ignore-me-nim path: src/sokol - if: runner.os == 'Linux' name: prepare run: | sudo apt-get update sudo apt-get install libgl1-mesa-dev libegl1-mesa-dev mesa-common-dev xorg-dev libasound-dev - name: build run: | nimble install -Y nimble install glm -Y nimble build_all test-odin: needs: gen-bindings strategy: fail-fast: false matrix: # FIXME: macOS Odin vs Homebrew LLVM currently seems broken # os: [ubuntu-latest, macos-latest, windows-latest] os: [ubuntu-latest, windows-latest] runs-on: ${{matrix.os}} steps: - uses: actions/checkout@v4 with: repository: floooh/sokol-odin - uses: actions/download-artifact@v4 with: name: ignore-me-odin # NOTE: see https://github.com/floooh/sokol-odin/blob/main/.github/workflows/main.yml - uses: ilammy/msvc-dev-cmd@v1 - if: runner.os == 'Linux' name: prepare-linux run: | sudo apt-get update sudo apt-get install libglu1-mesa-dev mesa-common-dev xorg-dev libasound-dev llvm-14 curl -L https://github.com/odin-lang/Odin/releases/download/dev-2023-08/odin-ubuntu-amd64-dev-2023-08.zip --output odin.zip unzip odin.zip chmod a+x ./odin ./build_clibs_linux.sh - if: runner.os == 'macOS' name: prepare-macos run: | brew install llvm@14 curl -L https://github.com/odin-lang/Odin/releases/download/dev-2023-08/odin-macos-amd64-dev-2023-08.zip --output odin.zip unzip odin.zip chmod a+x ./odin ./build_clibs_macos.sh - if: runner.os == 'Windows' name: prepare-windows shell: cmd run: | curl -L https://github.com/odin-lang/Odin/releases/download/dev-2023-08/odin-windows-amd64-dev-2023-08.zip --output odin.zip unzip odin.zip build_clibs_windows.cmd - name: build run: | ./odin build examples/clear -debug ./odin build examples/triangle -debug ./odin build examples/quad -debug ./odin build examples/bufferoffsets -debug ./odin build examples/cube -debug ./odin build examples/noninterleaved -debug ./odin build examples/texcube -debug ./odin build examples/shapes -debug ./odin build examples/offscreen -debug ./odin build examples/instancing -debug ./odin build examples/mrt -debug ./odin build examples/blend -debug ./odin build examples/debugtext -debug ./odin build examples/debugtext-print -debug ./odin build examples/debugtext-userfont -debug ./odin build examples/saudio -debug ./odin build examples/sgl -debug ./odin build examples/sgl-points -debug ./odin build examples/sgl-context -debug test-rust: needs: gen-bindings env: CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse strategy: fail-fast: false matrix: # os: [ubuntu-latest, macos-latest, windows-latest] os: [ubuntu-latest, windows-latest] runs-on: ${{matrix.os}} steps: - uses: actions/checkout@v4 with: repository: floooh/sokol-rust - uses: actions/download-artifact@v4 with: name: ignore-me-rust path: src - uses: dtolnay/rust-toolchain@master with: toolchain: stable - name: prepare-linux if: runner.os == 'Linux' run: | sudo apt-get update sudo apt-get install libglu1-mesa-dev mesa-common-dev xorg-dev libasound-dev - name: build run: | cargo --version cargo build --examples --verbose # only deploy the bindings for commits on the main branch deploy-zig: needs: test-zig if: github.ref == 'refs/heads/master' runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: repository: floooh/sokol-zig ssh-key: ${{ secrets.GHACTIONS_ZIG_PUSH }} - uses: actions/download-artifact@v4 with: name: ignore-me-zig path: src/sokol - name: "commit and push" run: | git config user.email "none" git config user.name "GH Action" git add -A git diff-index --quiet HEAD || git commit -m "updated (https://github.com/floooh/sokol/commit/${{ github.sha }})" git push deploy-nim: needs: test-nim if: github.ref == 'refs/heads/master' runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: repository: floooh/sokol-nim ssh-key: ${{ secrets.GHACTIONS_NIM_PUSH }} - uses: actions/download-artifact@v4 with: name: ignore-me-nim path: src/sokol - name: "commit and push" run: | git config user.email "none" git config user.name "GH Action" git add -A git diff-index --quiet HEAD || git commit -m "updated (https://github.com/floooh/sokol/commit/${{ github.sha }})" git push deploy-odin: needs: test-odin if: github.ref == 'refs/heads/master' runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: repository: floooh/sokol-odin ssh-key: ${{ secrets.GHACTIONS_ODIN_PUSH }} - uses: actions/download-artifact@v4 with: name: ignore-me-odin - name: "commit and push" run: | git config user.email "none" git config user.name "GH Action" git add -A git diff-index --quiet HEAD || git commit -m "updated (https://github.com/floooh/sokol/commit/${{ github.sha }})" git push deploy-rust: needs: test-rust env: CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse if: github.ref == 'refs/heads/master' runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: repository: floooh/sokol-rust ssh-key: ${{ secrets.GHACTIONS_RUST_PUSH }} - uses: actions/download-artifact@v4 with: name: ignore-me-rust path: src - uses: dtolnay/rust-toolchain@master with: toolchain: stable - name: "cargo fmt" run: cargo fmt - name: "commit and push" run: | git config user.email "none" git config user.name "GH Action" git status -vv git add -A git diff-index --quiet HEAD || git commit -m "updated (https://github.com/floooh/sokol/commit/${{ github.sha }})" git push