feat: clean mobile build #222
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
release: | |
types: | |
- created | |
name: CI | |
jobs: | |
lints: | |
name: Check and lints | |
runs-on: ubuntu-latest | |
env: | |
GODOT4_BIN: ${{ github.workspace }}/.bin/godot/godot4_bin | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: 1.71 | |
override: true | |
components: clippy, rustfmt | |
- run: rustup component add rustfmt | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
- name: Install gdtoolkit 4 | |
run: pip3 install "gdtoolkit==4.*" | |
- name: Check format GDScript | |
run: gdformat -d godot/ | |
# Depedencies section | |
# => Linux | |
- name: Install alsa and udev | |
if: runner.os == 'linux' | |
run: sudo apt-get update; sudo apt-get install -y --no-install-recommends libasound2-dev libudev-dev | |
- name: install ffmpeg deps (linux) | |
run: sudo apt install -y --no-install-recommends clang curl pkg-config libavcodec-dev libavformat-dev libavutil-dev libavfilter-dev libavdevice-dev | |
if: runner.os == 'linux' | |
- name: cargo xtask install | |
working-directory: rust/xtask | |
run: cargo run -- install --no-templates | |
- name: cargo check | |
working-directory: rust/decentraland-godot-lib | |
run: cargo check | |
- name: cargo fmt | |
working-directory: rust/decentraland-godot-lib | |
run: cargo fmt --all -- --check | |
- name: cargo clippy | |
working-directory: rust/decentraland-godot-lib | |
run: cargo clippy -- -D warnings | |
coverage: | |
name: Coverage | |
runs-on: ubuntu-latest | |
env: | |
GODOT4_BIN: ${{ github.workspace }}/.bin/godot/godot4_bin | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v2 | |
- name: Install stable toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: 1.71 | |
override: true | |
components: llvm-tools-preview | |
- name: Cache | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
rust/decentraland-godot-lib/target/ | |
rust/decentraland-godot-lib/Cargo.lock | |
rust/xtask/target/ | |
rust/xtask/Cargo.lock | |
key: coverage-cargo-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: coverage-cargo- | |
# Depedencies section | |
# => Linux | |
- name: Install alsa and udev | |
if: runner.os == 'linux' | |
run: sudo apt-get update; sudo apt-get install -y --no-install-recommends libasound2-dev libudev-dev | |
- name: install ffmpeg deps (linux) | |
run: sudo apt install -y --no-install-recommends clang curl pkg-config libavcodec-dev libavformat-dev libavutil-dev libavfilter-dev libavdevice-dev | |
if: runner.os == 'linux' | |
- name: cargo xtask install | |
working-directory: rust/xtask | |
run: cargo run -- install --no-templates | |
# Build section | |
- name: Download grcov | |
run: | | |
mkdir -p "${HOME}/.local/bin" | |
curl -sL https://github.com/mozilla/grcov/releases/download/v0.8.10/grcov-x86_64-unknown-linux-gnu.tar.bz2 | tar jxf - -C "${HOME}/.local/bin" | |
echo "$HOME/.local/bin" >> $GITHUB_PATH | |
- name: Run xtask coverage | |
working-directory: rust/xtask | |
run: cargo run -- coverage | |
- name: Upload to codecov.io | |
uses: codecov/codecov-action@v3 | |
with: | |
files: rust/coverage/*.lcov | |
build: | |
name: Build and test | |
# Comment next line to test this job on PRs | |
if: ${{ github.ref == 'refs/heads/main' }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: 1.71 | |
override: true | |
- name: Set up cargo cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
rust/decentraland-godot-lib/target/ | |
rust/decentraland-godot-lib/Cargo.lock | |
rust/xtask/target/ | |
rust/xtask/Cargo.lock | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: ${{ runner.os }}-cargo- | |
# Depedencies section | |
# => Linux | |
- name: Install alsa and udev | |
if: runner.os == 'linux' | |
run: sudo apt-get update; sudo apt-get install -y --no-install-recommends libasound2-dev libudev-dev | |
- name: install ffmpeg deps (linux) | |
run: sudo apt install -y --no-install-recommends clang curl pkg-config libavcodec-dev libavformat-dev libavutil-dev libavfilter-dev libavdevice-dev | |
if: runner.os == 'linux' | |
# => MacOS | |
- name: install ffmpeg deps (macOs) | |
if: runner.os == 'macos' | |
run: brew install ffmpeg pkg-config | |
# TODO: cross-build deprecated with the ffmpeg integration | |
# - name: Set up target platform | |
# if: ${{ matrix.os == 'macos-latest' }} | |
# run: | | |
# rustup target add x86_64-apple-darwin | |
# rustup target add aarch64-apple-darwin | |
# => Windows | |
- name: set CLANG path for ffmpeg deps (windows) | |
if: runner.os == 'windows' | |
run: | | |
$VCINSTALLDIR = $(& "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -property installationPath) | |
Add-Content $env:GITHUB_ENV "LIBCLANG_PATH=${VCINSTALLDIR}\VC\Tools\LLVM\x64\bin`n" | |
Invoke-WebRequest "https://www.gyan.dev/ffmpeg/builds/ffmpeg-release-full-shared.7z" -OutFile ffmpeg-release-full-shared.7z | |
7z x ffmpeg-release-full-shared.7z | |
mkdir ffmpeg | |
mv ffmpeg-*/* ffmpeg/ | |
Add-Content $env:GITHUB_ENV "FFMPEG_DIR=${pwd}\ffmpeg`n" | |
Add-Content $env:GITHUB_PATH "${pwd}\ffmpeg\bin`n" | |
# => All platforms | |
- name: cargo xtask install | |
working-directory: rust/xtask | |
run: cargo run -- install | |
# Build section | |
- name: cargo build | |
working-directory: rust/decentraland-godot-lib | |
run: cargo build --release | |
# TODO: cross-build deprecated with the ffmpeg integration | |
# - uses: actions-rs/cargo@v1 | |
# name: build for x86_64 (macos) | |
# if: ${{ matrix.os == 'macos-latest' }} | |
# with: | |
# command: build | |
# args: --manifest-path rust/decentraland-godot-lib/Cargo.toml --release --target=x86_64-apple-darwin | |
# - uses: actions-rs/cargo@v1 | |
# name: build for arm64 (macos) | |
# if: ${{ matrix.os == 'macos-latest' }} | |
# with: | |
# command: build | |
# args: --manifest-path rust/decentraland-godot-lib/Cargo.toml --release --target=aarch64-apple-darwin | |
- name: cargo test | |
working-directory: rust/decentraland-godot-lib | |
run: cargo test | |
# TODO: cross-build deprecated with the ffmpeg integration | |
# Package section | |
# # => MacOS | |
# - name: Make universal library | |
# if: ${{ matrix.os == 'macos-latest' }} | |
# run: | | |
# mkdir rust/decentraland-godot-lib/target/release || true | |
# lipo -create rust/decentraland-godot-lib/target/x86_64-apple-darwin/release/libdecentraland_godot_lib.dylib rust/decentraland-godot-lib/target/aarch64-apple-darwin/release/libdecentraland_godot_lib.dylib -output rust/decentraland-godot-lib/target/release/libdecentraland_godot_lib.dylib | |
# => Linux/MacOS (unix) | |
- name: Copy library (linux/macos) | |
if: ${{ matrix.os != 'windows-latest' }} | |
run: | | |
cp rust/decentraland-godot-lib/target/release/libdecentraland_godot_lib.so godot/lib/ || true | |
cp rust/decentraland-godot-lib/target/release/libdecentraland_godot_lib.dylib godot/lib/ || true | |
# => Windows | |
- name: Copy library (windows) | |
if: ${{ matrix.os == 'windows-latest' }} | |
run: | | |
cp rust/decentraland-godot-lib/target/release/decentraland_godot_lib.dll godot/lib/ | |
# Export section (multi platform) | |
- name: Export | |
working-directory: rust/xtask | |
run: cargo run -- export | |
- uses: actions/upload-artifact@master | |
with: | |
name: decentraland-godot-${{ matrix.os }} | |
path: | | |
exports/**/* |