gb-emu/.github/workflows/build-emu.yml

72 lines
2.2 KiB
YAML
Raw Normal View History

2023-04-06 13:13:59 +10:00
name: Build Emulator
on:
push:
branches: [ "main" ]
2023-04-07 09:22:23 +10:00
paths: ["gb-emu/**", "lib/**", "vendored/**", "Cargo.toml", ".github/workflows/build-emu.yml"]
2023-04-06 13:13:59 +10:00
env:
CARGO_TERM_COLOR: always
2023-04-07 09:22:23 +10:00
MACOSX_DEPLOYMENT_TARGET: 10.7
2023-04-06 13:13:59 +10:00
jobs:
2023-04-06 14:32:40 +10:00
build:
runs-on: ${{ matrix.os }}-latest
strategy:
2023-04-07 09:22:23 +10:00
fail-fast: false
matrix:
os: [ubuntu, macos, windows]
2023-04-06 13:13:59 +10:00
2023-04-06 14:04:41 +10:00
steps:
2023-04-07 09:22:23 +10:00
- name: checkout
uses: actions/checkout@v3
- name: pull submodules
run: git submodule update --init --recursive
- name: get rust toolchain
uses: dtolnay/rust-toolchain@nightly
- name: install rust aarch64 and x86_64 targets for mac
run: rustup target add aarch64-apple-darwin x86_64-apple-darwin
2023-04-06 16:02:56 +10:00
if: ${{ matrix.os == 'macos' }}
2023-04-07 09:22:23 +10:00
- name: cache rust build
uses: Swatinem/rust-cache@v2
2023-04-07 08:54:07 +10:00
with:
shared-key: emulator-${{ matrix.os }}
2023-04-07 09:22:23 +10:00
- name: install cached apt packages
uses: awalsh128/cache-apt-pkgs-action@latest
2023-04-06 14:44:09 +10:00
if: ${{ matrix.os == 'ubuntu' }}
2023-04-06 14:04:41 +10:00
with:
packages: libasound2-dev libudev-dev
version: 1.0
2023-04-07 09:22:23 +10:00
- name: build
run: cargo build --release
2023-04-06 16:02:56 +10:00
if: ${{ matrix.os != 'macos' }}
2023-04-07 09:22:23 +10:00
- name: build x86_64
run: cargo build --release --target x86_64-apple-darwin
2023-04-06 16:02:56 +10:00
if: ${{ matrix.os == 'macos' }}
2023-04-07 09:22:23 +10:00
- name: build aarch64
run: cargo build --release --target aarch64-apple-darwin
2023-04-06 16:02:56 +10:00
if: ${{ matrix.os == 'macos' }}
2023-04-07 09:22:23 +10:00
- name: upload build (linux)
uses: actions/upload-artifact@v3
2023-04-06 16:02:56 +10:00
if: ${{ matrix.os == 'ubuntu' }}
2023-04-06 14:15:05 +10:00
with:
2023-04-06 16:02:56 +10:00
name: gb-emu-linux
2023-04-06 14:32:40 +10:00
path: target/release/gb-emu
2023-04-07 09:22:23 +10:00
- name: upload build (windows)
uses: actions/upload-artifact@v3
2023-04-06 14:44:09 +10:00
if: ${{ matrix.os == 'windows' }}
2023-04-06 14:15:05 +10:00
with:
2023-04-06 16:02:56 +10:00
name: gb-emu-windows
path: target/release/gb-emu.exe
2023-04-07 09:22:23 +10:00
- name: upload build (macos x86_64)
uses: actions/upload-artifact@v3
2023-04-06 16:02:56 +10:00
if: ${{ matrix.os == 'macos' }}
with:
name: gb-emu-macos-x86_64
path: target/x86_64-apple-darwin/release/gb-emu
2023-04-07 09:22:23 +10:00
- name: upload build (macos aarch64)
uses: actions/upload-artifact@v3
2023-04-06 16:02:56 +10:00
if: ${{ matrix.os == 'macos' }}
with:
name: gb-emu-macos-aarch64
path: target/aarch64-apple-darwin/release/gb-emu