diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 5fe0594..d13d72c 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -12,11 +12,10 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions-rs/toolchain@v1 + - uses: dtolnay/rust-toolchain@stable with: - profile: minimal toolchain: stable - override: true + - uses: Swatinem/rust-cache@v2 - uses: actions-rs/cargo@v1 with: command: check @@ -27,12 +26,11 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions-rs/toolchain@v1 + - uses: dtolnay/rust-toolchain@stable with: - profile: minimal toolchain: stable - target: wasm32-unknown-unknown - override: true + targets: wasm32-unknown-unknown + - uses: Swatinem/rust-cache@v2 - uses: actions-rs/cargo@v1 with: command: check @@ -43,11 +41,10 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions-rs/toolchain@v1 + - uses: dtolnay/rust-toolchain@stable with: - profile: minimal toolchain: stable - override: true + - uses: Swatinem/rust-cache@v2 - run: sudo apt-get install libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libxkbcommon-dev libssl-dev - uses: actions-rs/cargo@v1 with: @@ -59,12 +56,12 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions-rs/toolchain@v1 + - uses: dtolnay/rust-toolchain@stable with: - profile: minimal toolchain: stable - override: true components: rustfmt + - uses: Swatinem/rust-cache@v2 + - uses: actions-rs/cargo@v1 with: command: fmt @@ -75,12 +72,11 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions-rs/toolchain@v1 + - uses: dtolnay/rust-toolchain@stable with: - profile: minimal toolchain: stable - override: true components: clippy + - uses: Swatinem/rust-cache@v2 - uses: actions-rs/cargo@v1 with: command: clippy @@ -91,12 +87,11 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions-rs/toolchain@v1 + - uses: dtolnay/rust-toolchain@stable with: - profile: minimal - toolchain: 1.81.0 - target: wasm32-unknown-unknown - override: true + toolchain: stable + targets: wasm32-unknown-unknown + - uses: Swatinem/rust-cache@v2 - name: Download and install Trunk binary run: wget -qO- https://github.com/thedodd/trunk/releases/latest/download/trunk-x86_64-unknown-linux-gnu.tar.gz | tar -xzf- - name: Build @@ -108,63 +103,54 @@ jobs: fail-fast: false matrix: include: - - os: macos-latest - TARGET: aarch64-apple-darwin - - - os: ubuntu-latest - TARGET: aarch64-unknown-linux-gnu + - os-name: Ubuntu latest x86 + os: ubuntu-latest + TARGET: x86_64-unknown-linux-musl - - os: ubuntu-latest - TARGET: armv7-unknown-linux-gnueabihf + - os-name: Ubuntu latest ARM + os: ubuntu-latest + TARGET: aarch64-unknown-linux-musl - - os: ubuntu-latest - TARGET: x86_64-unknown-linux-gnu + - os-name: Windows latest x86 + os: windows-latest + TARGET: x86_64-pc-windows-msvc + EXTENSION: .exe - - os: windows-latest - TARGET: x86_64-pc-windows-msvc - EXTENSION: .exe + - os-name: MacOS latest ARM + os: macos-latest + TARGET: aarch64-apple-darwin steps: - - name: Building ${{ matrix.TARGET }} - run: echo "${{ matrix.TARGET }}" - - - uses: actions/checkout@master - - name: Install build dependencies - Rustup - run: | - curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-toolchain stable --profile default --target ${{ matrix.TARGET }} -y - echo "$HOME/.cargo/bin" >> $GITHUB_PATH - - # For linux, it's necessary to use cross from the git repository to avoid glibc problems - # Ref: https://github.com/cross-rs/cross/issues/1510 - - name: Install cross for linux - if: contains(matrix.TARGET, 'linux') - run: | - cargo install cross --git https://github.com/cross-rs/cross --rev 1b8cf50d20180c1a394099e608141480f934b7f7 - - - name: Install cross for mac and windows - if: ${{ !contains(matrix.TARGET, 'linux') }} - run: | - cargo install cross - - - name: Build - run: | - cross build --verbose --release --target=${{ matrix.TARGET }} - - - name: Rename - run: cp target/${{ matrix.TARGET }}/release/eframe_template${{ matrix.EXTENSION }} eframe_template-${{ matrix.TARGET }}${{ matrix.EXTENSION }} - - - uses: actions/upload-artifact@master - with: - name: eframe_template-${{ matrix.TARGET }}${{ matrix.EXTENSION }} - path: eframe_template-${{ matrix.TARGET }}${{ matrix.EXTENSION }} - - - uses: svenstaro/upload-release-action@v2 - name: Upload binaries to release - if: ${{ github.event_name == 'push' }} - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: eframe_template-${{ matrix.TARGET }}${{ matrix.EXTENSION }} - asset_name: eframe_template-${{ matrix.TARGET }}${{ matrix.EXTENSION }} - tag: ${{ github.ref }} - prerelease: ${{ !startsWith(github.ref, 'refs/tags/') }} - overwrite: true + - name: Checkout + uses: actions/checkout@v4 + + - name: Get Cargo.toml Metadata + id: metadata + uses: nicolaiunrein/cargo-get@master + + - name: Build binary with Rust cross + uses: houseabsolute/actions-rust-cross@v1 + with: + command: build + target: ${{ matrix.TARGET }} + args: "--release" + strip: true + + - name: Rename + run: cp target/${{ matrix.TARGET }}/release/${{ steps.metadata.outputs.package_name}}${{ matrix.EXTENSION }} ${{ steps.metadata.outputs.package_name}}-${{ matrix.TARGET }}${{ matrix.EXTENSION }} + + - uses: actions/upload-artifact@master + with: + name: ${{ steps.metadata.outputs.package_name}}-${{ matrix.TARGET }}${{ matrix.EXTENSION }} + path: ${{ steps.metadata.outputs.package_name}}-${{ matrix.TARGET }}${{ matrix.EXTENSION }} + + - uses: svenstaro/upload-release-action@v2 + name: Upload binaries to release + if: ${{ github.event_name == 'push' }} + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: ${{ steps.metadata.outputs.package_name}}-${{ matrix.TARGET }}${{ matrix.EXTENSION }} + asset_name: ${{ steps.metadata.outputs.package_name}}-${{ matrix.TARGET }}${{ matrix.EXTENSION }} + tag: ${{ github.ref }} + prerelease: ${{ !startsWith(github.ref, 'refs/tags/') }} + overwrite: true \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index a4997b1..6acdc9b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -250,7 +250,7 @@ dependencies = [ "parking_lot", "thiserror 1.0.69", "winapi", - "x11rb", + "x11rb 0.12.0", ] [[package]] @@ -259,6 +259,12 @@ version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" +[[package]] +name = "as-raw-xcb-connection" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "175571dd1d178ced59193a6fc02dde1b972eb0bc56c892cde9beeceac5bf0f6b" + [[package]] name = "ash" version = "0.38.0+1.3.281" @@ -1329,6 +1335,16 @@ dependencies = [ "winapi", ] +[[package]] +name = "gethostname" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0176e0459c2e4a1fe232f984bca6890e681076abb9934f6cea7c326f3fc47818" +dependencies = [ + "libc", + "windows-targets 0.48.5", +] + [[package]] name = "getrandom" version = "0.2.11" @@ -1375,6 +1391,7 @@ dependencies = [ "core-foundation", "dispatch", "glutin_egl_sys", + "glutin_glx_sys", "glutin_wgl_sys", "libloading", "objc2", @@ -1384,6 +1401,7 @@ dependencies = [ "raw-window-handle", "wayland-sys", "windows-sys 0.52.0", + "x11-dl", ] [[package]] @@ -1408,6 +1426,16 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "glutin_glx_sys" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a7bb2938045a88b612499fbcba375a77198e01306f52272e692f8c1f3751185" +dependencies = [ + "gl_generator", + "x11-dl", +] + [[package]] name = "glutin_wgl_sys" version = "0.6.0" @@ -3580,6 +3608,7 @@ dependencies = [ "atomic-waker", "bitflags 2.9.0", "block2", + "bytemuck", "calloop", "cfg_aliases", "concurrent-queue", @@ -3596,6 +3625,7 @@ dependencies = [ "objc2-foundation", "objc2-ui-kit", "orbclient", + "percent-encoding", "pin-project", "raw-window-handle", "redox_syscall", @@ -3613,6 +3643,8 @@ dependencies = [ "web-sys", "web-time", "windows-sys 0.52.0", + "x11-dl", + "x11rb 0.13.1", "xkbcommon-dl", ] @@ -3625,17 +3657,43 @@ dependencies = [ "memchr", ] +[[package]] +name = "x11-dl" +version = "2.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38735924fedd5314a6e548792904ed8c6de6636285cb9fec04d5b1db85c1516f" +dependencies = [ + "libc", + "once_cell", + "pkg-config", +] + [[package]] name = "x11rb" version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b1641b26d4dec61337c35a1b1aaf9e3cba8f46f0b43636c609ab0291a648040a" dependencies = [ - "gethostname", + "gethostname 0.3.0", "nix 0.26.4", "winapi", "winapi-wsapoll", - "x11rb-protocol", + "x11rb-protocol 0.12.0", +] + +[[package]] +name = "x11rb" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d91ffca73ee7f68ce055750bf9f6eca0780b8c85eff9bc046a3b0da41755e12" +dependencies = [ + "as-raw-xcb-connection", + "gethostname 0.4.3", + "libc", + "libloading", + "once_cell", + "rustix", + "x11rb-protocol 0.13.1", ] [[package]] @@ -3647,6 +3705,12 @@ dependencies = [ "nix 0.26.4", ] +[[package]] +name = "x11rb-protocol" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec107c4503ea0b4a98ef47356329af139c0a4f7750e621cf2973cd3385ebcb3d" + [[package]] name = "xcursor" version = "0.3.5" diff --git a/rust-toolchain b/rust-toolchain deleted file mode 100644 index dd9d16c..0000000 --- a/rust-toolchain +++ /dev/null @@ -1,10 +0,0 @@ -# If you see this, run "rustup self update" to get rustup 1.23 or newer. - -# NOTE: above comment is for older `rustup` (before TOML support was added), -# which will treat the first line as the toolchain name, and therefore show it -# to the user in the error, instead of "error: invalid channel name '[toolchain]'". - -[toolchain] -channel = "1.81" # Avoid specifying a patch version here; see https://github.com/emilk/eframe_template/issues/145 -components = [ "rustfmt", "clippy" ] -targets = [ "wasm32-unknown-unknown" ]