Skip to content

Build GUI Artifacts #70

Build GUI Artifacts

Build GUI Artifacts #70

name: Build GUI Artifacts
on:
workflow_dispatch:
workflow_call:
jobs:
build_gui_linux:
name: Building GUI for Linux x86_64
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target
key: ${{ runner.os }}-release-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-release-
- name: Build Linux GUI binaries
run: cargo build --verbose -p xmodits-gui --release
- name: Create ./bin directory
run: mkdir -p bin
- name: Tarball Linux GUI binary
run: |
tar -czf bin/xmodits-gui-linux-x86_64.tar.gz -C target/release/ xmodits-gui
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: xmodits-gui-linux-x86_64
path: |
bin/xmodits-gui-linux-x86_64.*
build_gui_linux-cross:
name: Building GUI for ${{ matrix.target }}
runs-on: ubuntu-latest
strategy:
matrix:
target:
- linux-aarch64-gnu
- linux-armv7-gnu
include:
- target: linux-aarch64-gnu
arch: aarch64-unknown-linux-gnu
- target: linux-armv7-gnu
arch: armv7-unknown-linux-gnueabihf
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target
key: ${{ runner.os }}-release-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-release-
- name: Install cross
run: cargo install cross
- name: Build Linux GUI binaries
run: cross build -p xmodits-gui --release --target ${{ matrix.arch }}
- name: Create ./bin directory
run: mkdir -p bin
- name: Tarball Linux GUI binary
run: |
tar -czf bin/xmodits-gui-${{ matrix.target }}.tar.gz -C target/${{matrix.arch}}/release/ xmodits-gui
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: xmodits-gui-${{ matrix.target }}
path: |
bin/xmodits-gui-${{ matrix.target }}.*
build_gui_windows:
name: Building GUI for ${{ matrix.target }}
runs-on: windows-latest
strategy:
matrix:
target:
- windows-64-bit
# - windows-32-bit # disabled due to winit bug
include:
- target: windows-64-bit
arch: x86_64-pc-windows-msvc
# - target: windows-32-bit
# arch: i686-pc-windows-msvc
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
with:
target: ${{ matrix.arch }}
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target
key: ${{ runner.os }}-release-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-release-
- name: Install Windows 32 bit target
if: matrix.arch == 'i686-pc-windows-msvc'
run: | # Install 32-bit target and make it the default
rustup target add i686-pc-windows-msvc && rustup default stable-i686-pc-windows-msvc
- name: Build Windows GUI binary
run: cargo build -p xmodits-gui --release
- name: Create ./bin directory
run: mkdir -p bin
- name: Zip Windows GUI binary
run: | # On Windows, remove gui suffix
rm target/release/*xmodits.exe
mv target/release/xmodits-gui.exe target/release/xmodits.exe
Compress-Archive target/release/xmodits.exe bin/xmodits-gui-${{ matrix.target }}.zip
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: xmodits-gui-${{ matrix.target }}
path: |
bin/xmodits-gui-${{ matrix.target}}.*
build_gui_macos:
name: Building GUI for ${{ matrix.target }}
runs-on: macOS-latest
strategy:
matrix:
target:
- macos-intel
# - macos-apple-slicon # TODO: make this a separate task?
include:
- target: macos-intel
arch: x86_64-apple-darwin
# - target: macos-apple-silicon
# arch: aarch64-apple-darwin
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
with:
target: ${{ matrix.arch }}
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target
key: ${{ runner.os }}-release-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-release-
- name: Build macOS GUI binary
run: cargo build -p xmodits-gui --release
- name: Create ./bin directory
run: mkdir -p bin
- name: Zip macOS GUI binary
run: |
mv target/release/xmodits-gui target/release/xmodits
chmod +x target/release/xmodits
zip -j ./bin/xmodits-gui-${{ matrix.target }}.zip target/release/xmodits
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: xmodits-gui-${{ matrix.target }}
path: |
bin/xmodits-gui-${{ matrix.target }}.*
# build:
# name: Building ${{ matrix.build_target }}
# runs-on: ${{ matrix.os }}
# strategy:
# matrix:
# build_target: [linux, windows]
# include:
# - build_target: linux
# os: ubuntu-latest
# - build_target: windows
# os: windows-latest
# steps:
# - uses: actions/checkout@v3
# - uses: dtolnay/rust-toolchain@stable
# - uses: actions/cache@v3
# with:
# path: |
# ~/.cargo/bin/
# ~/.cargo/registry/index/
# ~/.cargo/registry/cache/
# ~/.cargo/git/db/
# target
# key: ${{ runner.os }}-release-${{ hashFiles('**/Cargo.lock') }}
# restore-keys: ${{ runner.OS }}-release-
# - name: Building GUI
# run: cargo build -p xmodits-gui --release
# - name: Create ./bin directory
# run: mkdir -p bin
# - name: Tarball Linux GUI binary
# if: matrix.os != 'windows-latest'
# run: |
# tar -czf bin/xmodits-gui-${{ matrix.build_target }}.tar.gz -C target/release/ xmodits-gui
# - name: Zip Windows GUI binary
# if: matrix.os == 'windows-latest'
# run: | # On Windows, remove gui suffix
# rm target/release/*xmodits.exe
# mv target/release/xmodits-gui.exe target/release/xmodits.exe
# Compress-Archive target/release/xmodits.exe bin/xmodits-gui-${{ matrix.build_target }}.zip
# - name: Upload artifacts
# uses: actions/upload-artifact@v3
# with:
# name: xmodits-gui-${{ matrix.build_target }}
# path: |
# bin/xmodits-gui-${{ matrix.build_target }}.*