improve actions

This commit is contained in:
Alex Janka 2023-04-07 09:22:23 +10:00
parent 2c0253ff50
commit c275f92246
2 changed files with 55 additions and 33 deletions

View file

@ -3,56 +3,69 @@ name: Build Emulator
on: on:
push: push:
branches: [ "main" ] branches: [ "main" ]
paths: ["gb-emu/**", "lib/**", "vendored/**", "Cargo.toml"] paths: ["gb-emu/**", "lib/**", "vendored/**", "Cargo.toml", ".github/workflows/build-emu.yml"]
env: env:
CARGO_TERM_COLOR: always CARGO_TERM_COLOR: always
MACOSX_DEPLOYMENT_TARGET: 10.7
jobs: jobs:
build: build:
runs-on: ${{ matrix.os }}-latest runs-on: ${{ matrix.os }}-latest
strategy: strategy:
matrix: fail-fast: false
os: [ubuntu, macos, windows] matrix:
os: [ubuntu, macos, windows]
steps: steps:
- uses: actions/checkout@v3 - name: checkout
- run: git submodule update --init --recursive uses: actions/checkout@v3
- run: | - name: pull submodules
rustup toolchain install nightly --profile minimal --no-self-update run: git submodule update --init --recursive
rustup default nightly - name: get rust toolchain
- run: rustup target add aarch64-apple-darwin x86_64-apple-darwin 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
if: ${{ matrix.os == 'macos' }} if: ${{ matrix.os == 'macos' }}
- uses: Swatinem/rust-cache@v2 - name: cache rust build
uses: Swatinem/rust-cache@v2
with: with:
shared-key: emulator-${{ matrix.os }} shared-key: emulator-${{ matrix.os }}
- uses: awalsh128/cache-apt-pkgs-action@latest - name: install cached apt packages
uses: awalsh128/cache-apt-pkgs-action@latest
if: ${{ matrix.os == 'ubuntu' }} if: ${{ matrix.os == 'ubuntu' }}
with: with:
packages: libasound2-dev libudev-dev packages: libasound2-dev libudev-dev
version: 1.0 version: 1.0
- run: cargo build --release - name: build
run: cargo build --release
if: ${{ matrix.os != 'macos' }} if: ${{ matrix.os != 'macos' }}
- run: cargo build --release --target x86_64-apple-darwin - name: build x86_64
run: cargo build --release --target x86_64-apple-darwin
if: ${{ matrix.os == 'macos' }} if: ${{ matrix.os == 'macos' }}
- run: cargo build --release --target aarch64-apple-darwin - name: build aarch64
run: cargo build --release --target aarch64-apple-darwin
if: ${{ matrix.os == 'macos' }} if: ${{ matrix.os == 'macos' }}
- uses: actions/upload-artifact@v3 - name: upload build (linux)
uses: actions/upload-artifact@v3
if: ${{ matrix.os == 'ubuntu' }} if: ${{ matrix.os == 'ubuntu' }}
with: with:
name: gb-emu-linux name: gb-emu-linux
path: target/release/gb-emu path: target/release/gb-emu
- uses: actions/upload-artifact@v3 - name: upload build (windows)
uses: actions/upload-artifact@v3
if: ${{ matrix.os == 'windows' }} if: ${{ matrix.os == 'windows' }}
with: with:
name: gb-emu-windows name: gb-emu-windows
path: target/release/gb-emu.exe path: target/release/gb-emu.exe
- uses: actions/upload-artifact@v3 - name: upload build (macos x86_64)
uses: actions/upload-artifact@v3
if: ${{ matrix.os == 'macos' }} if: ${{ matrix.os == 'macos' }}
with: with:
name: gb-emu-macos-x86_64 name: gb-emu-macos-x86_64
path: target/x86_64-apple-darwin/release/gb-emu path: target/x86_64-apple-darwin/release/gb-emu
- uses: actions/upload-artifact@v3 - name: upload build (macos aarch64)
uses: actions/upload-artifact@v3
if: ${{ matrix.os == 'macos' }} if: ${{ matrix.os == 'macos' }}
with: with:
name: gb-emu-macos-aarch64 name: gb-emu-macos-aarch64

View file

@ -3,7 +3,7 @@ name: Build VST
on: on:
push: push:
branches: [ "main" ] branches: [ "main" ]
paths: ["gb-vst/**", "lib/**", "vendored/**", "Cargo.toml"] paths: ["gb-vst/**", "lib/**", "vendored/**", "Cargo.toml", ".github/workflows/build-vst.yml"]
env: env:
CARGO_TERM_COLOR: always CARGO_TERM_COLOR: always
@ -12,35 +12,44 @@ jobs:
build: build:
runs-on: ${{ matrix.os }}-latest runs-on: ${{ matrix.os }}-latest
strategy: strategy:
matrix: fail-fast: false
os: [ubuntu, macos, windows] matrix:
os: [ubuntu, macos, windows]
steps: steps:
- uses: actions/checkout@v3 - name: checkout
- run: git submodule update --init --recursive uses: actions/checkout@v3
- name: pull submodules
run: git submodule update --init --recursive
- run: mkdir test-roms - run: mkdir test-roms
- uses: suisei-cn/actions-download-file@v1.3.0 - name: download mGB
uses: suisei-cn/actions-download-file@v1.3.0
with: with:
url: 'https://github.com/trash80/mGB/raw/master/mGB.gb' url: 'https://github.com/trash80/mGB/raw/master/mGB.gb'
target: test-roms/ target: test-roms/
- run: | - name: install rust toolchain
rustup toolchain install nightly --profile minimal --no-self-update uses: dtolnay/rust-toolchain@nightly
rustup default nightly - name: install rust aarch64 and x86_64 targets for mac
- run: rustup target add aarch64-apple-darwin x86_64-apple-darwin run: rustup target add aarch64-apple-darwin x86_64-apple-darwin
if: ${{ matrix.os == 'macos' }} if: ${{ matrix.os == 'macos' }}
- uses: Swatinem/rust-cache@v2 - name: cache rust build
uses: Swatinem/rust-cache@v2
with: with:
shared-key: vst-${{ matrix.os }} shared-key: vst-${{ matrix.os }}
- uses: awalsh128/cache-apt-pkgs-action@latest - name: install cached apt packages
uses: awalsh128/cache-apt-pkgs-action@latest
if: ${{ matrix.os == 'ubuntu' }} if: ${{ matrix.os == 'ubuntu' }}
with: with:
packages: libasound2-dev libudev-dev xorg-dev libjack-jackd2-dev libx11-xcb-dev libxcb-icccm4-dev libxcb-dri2-0-dev packages: libasound2-dev libudev-dev xorg-dev libjack-jackd2-dev libx11-xcb-dev libxcb-icccm4-dev libxcb-dri2-0-dev
version: 1.0 version: 1.0
- run: cargo xtask bundle vst --release - name: build vst
run: cargo xtask bundle vst --release
if: ${{ matrix.os != 'macos' }} if: ${{ matrix.os != 'macos' }}
- run: cargo xtask bundle-universal vst --release - name: build vst (macos)
run: cargo xtask bundle-universal vst --release
if: ${{ matrix.os == 'macos' }} if: ${{ matrix.os == 'macos' }}
- uses: actions/upload-artifact@v3 - name: upload build
uses: actions/upload-artifact@v3
with: with:
name: gb-vst-${{ matrix.os }}.vst3 name: gb-vst-${{ matrix.os }}.vst3
path: target/bundled/vst.vst3 path: target/bundled/vst.vst3